1

This question already has an answer here:

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 ?

marked as duplicate by Malabarba Apr 18 '15 at 21:04

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

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)))
  • 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

Not the answer you're looking for? Browse other questions tagged or ask your own question.