3

I have .authinfo.gpg set up and working as the authentication mechanism for ERC (with multiple IRC servers) and Gnus (with multiple IMAP servers) using the following in my config:

(require 'auth-source)

(setq
 auth-sources '(default
                 "secrets:session"
                 "secrets:Login"
                 "~/.authinfo.gpg"
                 "~/.authinfo"
                 "~/.netrc"
                 )
 epa-file-cache-passphrase-for-symmetric-encryption t)

My .authinfo.gpg includes entries like this (sanitized, naturally, and trimmed to just WordPress blog samples):

machine example.com login JohnDoe password "password" port http
machine example2.com login JohnDoeJr password "password2" port http

My org2blog config is:

(use-package org2blog
  :defer t
  :ensure t
  :config
  (require 'org2blog-autoloads)
  ;;  (org2blog/wp-use-sourcecode-shortcode ‘t)
  (setq
   org2blog/wp-confirm-post t
   org2blog/wp-blog-alist
   '(
     ("example1"
      :url "http://www.example.com/xmlrpc.php"
      :username ,(car (auth-source-user-and-password "example.com"))
      :password ,(cadr (auth-source-user-and-password "example.com"))
      :default-title "Hello, World!"
      :default-categories ("Uncategorized")
      )
     ("example2"
      :url "http://www.example2.com/xmlrpc.php"
      :username ,(car (auth-source-user-and-password "example2.com"))
      :password ,(cadr (auth-source-user-and-password "example2.com"))
      :default-title "Hello, World!"
      :default-categories ("Uncategorized")
      ))))

Using the above when logging into either, I get

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

I've tried variations on the above but can't seem get get it to use .authinfo.gpg. The above error message is returned or I am prompted for my password.

I've used the following references to help me but so far to no avail:

I'm running:

  • GNU Emacs 24.4.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.10.8) of 2015-03-03 on lm-lvm-tpt430
  • Org-mode version 8.2.10 (8.2.10-35-g19a7d6-elpaplus @
    /home/username/.emacs.d/elpa/org-plus-contrib-20150316/)
  • org2blog 20150114.2301 from Melpa
0

According to punchagan, the org2blog maintainer:

You'll need to use a backtick instead of a quote (when setting org2blog/wp-blog-alist) to evaluate the expressions following a comma. See the 2nd example in the README.

(setq
 org2blog/wp-confirm-post t
 org2blog/wp-blog-alist
 `(
   ("example1"
    :url "http://www.example.com/xmlrpc.php"
    :username ,(car (auth-source-user-and-password "example.com"))
    :password ,(cadr (auth-source-user-and-password "example.com"))
    :default-title "Hello, World!"
    :default-categories ("Uncategorized")
    )
   ("example2"
    :url "http://www.example2.com/xmlrpc.php"
    :username ,(car (auth-source-user-and-password "example2.com"))
    :password ,(cadr (auth-source-user-and-password "example2.com"))
    :default-title "Hello, World!"
    :default-categories ("Uncategorized")
    )))

Oh, the backtick!

  • I just ran into this, but only on my macbook, the fix works. Just a week ago, I still published with the old config, but from my linux laptop. Do you know if this is changed behaviour? (BTW, I'm the author of that vxlabs post you referred to in the question, will update if required :) – Charl Botha Jun 28 '15 at 11:30
  • I don't know if it is changed behavior or not. I just solved a portability issue in the auth-source library that was causing me problems on Windows with Punchagan's help, so maybe ping him at the org2blog GitHub page? Thanks for the article. It was a great help. – prjorgensen Jun 29 '15 at 15:37
  • Is there a way to make sure that auth-source works correctly? When I inspect the variable org2blog-wp-blog-alist, I get "nil" for username and password. – Lucas Apr 5 '16 at 22:53
  • I'm not sure what the official way or "best way" might be. I simply tried it over and over again, also with ERC for authentication to freenode, and dug through backtraces when it failed. Wish I had more for you 3 months after you asked. – prjorgensen Jun 30 '16 at 19:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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