Posting to WordPress with Emacs (weblogger.el)

When you spend most of your day in Emacs, it can be annoying to switch to something else for a text oriented task. With weblogger.el you can post to your blog without ever leaving Emacs.

I have WordPress installed, but it should work for any other blogging software with the same XMLRPC interface.

Acquiring weblogger.el

First grab the latest copy of weblogger.el and xml-rpc.el from Savannah. It’s your typical Web-CVS interface, just click the .el file and then click “download”.

Once you’ve gotten both weblogger.el and xml-rpc.el place them somewhere that Emacs can find them. I’ve added ~/.emacs.d/ to my load-path so I placed both weblogger and xml-rpc there. (Note: xml-rpc comes with Emacs 22, so it may not be needed. The version at Savannah is newer though so if you run into any problems get it as well.)

Initial Setup

First you need to load weblogger. I added a require line for weblogger to my ~/.emacs.

; load-path setting is only needed if the directory you put
; weblogger.el in isn’t already in your load-path
(add-to-list ‘load-path “~/.emacs.d/”)

; Load weblogger
(requireweblogger)

Hit C-x C-e with the cursor after the sexp to evaluate it and load weblogger. Finally weblogger is loaded and you are ready to set it up and post.

First type M-x weblogger-setup-weblog . This will create a profile for posting, saving the username, url, and some settings to your ~/.emacs. You will be asked for the “Server Endpoint (url)” which for WordPress is http://www.server.com/xmlrpc.php.

Posting

You’re now ready to make your first post. Hit M-x weblogger-start-entry to start your first entry. When you are finished hit C-x C-s to save and submit the post. To save your post as a draft without submitting it hit C-c C-c.

Editing Earlier Posts (including Drafts)

To come back to a previous post hit M-x weblogger-fetch-entries. This will open a buffer with your latest entry. You can then move to previous entries with C-c C-p and later entries with C-c C-n.

I did notice a bug though, which may actually be in WordPress’s XMLRPC code. If you use the <!--more--> tag in your post you will not get the entire post when you try to edit the entry in weblogger. You need to remove the tag with the WordPress entry and then editing the post from Emacs will work again.

[Digg] [Reddit] [DZone]

3 Comments

  1. A fine line » Blog Archive » A test of emacs weblogger.el:

    [...] If this works, it will be a miracle. I followed the instructions on tolchz.net [...]

  2. Linux etc. » Blog Archive » Emacs & weblogger.el:

    [...] Weblogger.el offers a nice way to post directly to a Wordpress blog from Emacs; here’s a good description how to set it up. [...]

  3. twiddling with weblogger.el (emacs + wordpress) « mindless mind:

    [...] but more interesting would be to post from withing emacs. Thats were weblogger.el comes in. Here is some help on how to set it up. But still, I was a little uncomfortable with the default [...]

Leave a comment