1

I want to store the credentials for posting to my blog secret. Therefore I load them using EasyPG and put them in the variables blog-username and blog-password.

When I show the content of those vars using C-h v blog-username (describe-variable) the values are correct.

However when I set the wp-blog-alist value those values seem to not be parsed. This is the error message:

xml-rpc-value-to-xml-list: Wrong type argument: stringp, blog-username

Here is how I use the function.

(setq
 org2blog/wp-confirm-post t
 org2blog/wp-blog-alist
 '(
   ("0xcb0"
    :url "http://www.my_blog_address.com/xmlrpc.php"
    :username blog-username
    :password blog-password
    :default-title "Hello, World!"
    :default-categories ("Uncategorized")
    :tags-as-categories nil)
    ))

What syntax do I need to use inside the second setqfor org2blog/wp-blog-alist ?

Malabarba
  • 22,878
  • 6
  • 78
  • 163
cb0
  • 1,077
  • 8
  • 11

1 Answers1

4

The quote (') causes the following expression to be not evaluated, therefore blog-username and blog-password are not evaluated to their string values, but instead taken as symbols.

One way of getting around this is using the list function to explicitly quote symbols when necessary (note that the colon automatically quotes keywords):

(setq
 org2blog/wp-confirm-post t
 org2blog/wp-blog-alist
 (list (list "0xcb0"
             :url "http://www.my_blog_address.com/xmlrpc.php"
             :username blog-username
             :password blog-password
             :default-title "Hello, World!"
             :default-categories (list "Uncategorized")
             :tags-as-categories nil)))

The other option is using the backquote construct (```) and selectively unquote (,) values you want to be exempt from quoting:

(setq
 org2blog/wp-confirm-post t
 org2blog/wp-blog-alist
 `(("0xcb0"
    :url "http://www.my_blog_address.com/xmlrpc.php"
    :username ,blog-username
    :password ,blog-password
    :default-title "Hello, World!"
    :default-categories ("Uncategorized")
    :tags-as-categories nil)))
wasamasa
  • 21,803
  • 1
  • 65
  • 97
  • Thanks very much, that solved it! In my opinion I find the second option to be more readable. – cb0 Apr 18 '15 at 18:23