Blogging with emacs, org-mode and wordpress

I want to be able to seemlessly publish from emacs to wordpress. I’d like to create or update posts as an org-mode entry and then to publish them on this blog.

To achieve this I’ll need org2blog/wp, a lisp package that can export org entries to wordpress, org2blog depends on xml-rpc-el.

So first step is to get the software from the code repos:

$ cd ~/.emacs.d/
$ bzr branch lp:xml-rpc-el
$ git clone https://github.com/punchagan/org2blog.git

Then add some lines in ~/.emacs.d/init.el:

 1:  (add-to-list 'load-path "~/.emacs.d/xml-rpc-el")
 2:  (add-to-list 'load-path "~/.emacs.d/org2blog")
 3:  (require 'org2blog)
 4:  
 5:  (setq org2blog/wp-blog-alist
 6:    '(("42kettles"
 7:      :url "http://42kettles.net/xmlrpc.php"
 8:      :username "xxxx"   
 9:      :tags-as-categories nil)))
10:  
11:  (setq org2blog/wp-track-posts nil)

Then try to login just to be sure that everything is working smoothly:

M-x org2blog/wp-login

If it doesn’t work, check that xml-rpc is enabled in wordpress’s writing settings.

Now to post or update an article all I have to do is to go to the org-mode entry I want to publish and do:

M-x org2blog/wp-post-subtree

And that’s it !

Small tweaks I need to do:

  • by default the entry is posted as a draft, I’ve yet to find how to publish it.
  • define settings for syntax highlighting
  • define settings for categories/tags and org file structure (test tag inheritance).

I’m all for ATOM so as wordpress support it, I may give a try to org2blog/atom.

Comments !