Using Emacs and Markdown for WordPress posting

While setting up this site (which is based on WordPress), I was evaluating 
a few offline blog editors, and came upon MarsEdit and Ecto – both of which seem to be well-accepted commercial blog editors in the Mac 
world. Both allow easy setup of the blog configurations, have a hassle-free 
configuration, and allow a mail-inbox like access to previous posts.
My needs for the offline blogging tool are:

  1. Support WordPress (obviously)
  2. Support formatting in Markdown (the default WordPress formatting         is atrocious). Note that you will need to enable Markdown syntax on your blog by using any         of the plugins available for WordPress.
  3. Provide easy access to prior posts
  4. Have a decent text editor built-in
  5. Provide at least a subset of my current editing muscle-memory

However, I happen to be a Emacs fanatic, and perform majority of my day-to-day computing tasks in that tool (another post on this later). So I googled around a bit for the current state of blogging using Emacs, and voila! EmacsWiki pointed to the weblogger mode, which supports WordPress, and also handles Markdown formatting easily with the markdown mode. And to top it off, the code is open-source, which means that I can tinker and change the functionality when needed.

The default version of Weblogger mode seems to have some problems as listed in Emacs Wiki, but the patched versions from jwicker work great!

The next section describes the Emacs configuration needed to setup offline blogging using Weblogger mode.

Emacs Configuration

After downloading the patched versions of xml-rpc.el and weblogger.el to your computer, perform the following steps:

  1. Rename both files, as the downloaded files have the incorrect suffix/extension .doc, which should be removed
  2. Add the renamed .el files in your Emacs load-path directory (e.g., site-lisp)
  3. Load the adding the following lines to your .emacs (i.e., the user-init) file: 
(require ‘weblogger)
  4. Restart Emacs, and initialize the blog-setup by issuing the command:
 M-x weblogger-setup-weblog and follow the prompts. Note that for WordPress, your blog URL needs to be suffixed with /xmlrpc.php
  5. If the setup worked fine till this point, you can fetch all previous posts by using the M-x weblogger-fetch-entries command, and
  6. Then access each entry using the command: M-x weblogger-next-entry or M-x weblogger-previous-entry

You can create a new post by using the weblogger-start-entry command. This brings up a mail-like buffer, where the subject line denotes title of the post, and the body is the actual post content.

At this point, you can enter your post-entry (using Markdown syntax, if you have enabled the WordPress plugin, or else by using raw HTML). Once the content is completed, press C-x C-s to save the file, which will also post the entry to your blog.

    Caveat: The current Emacs mode does not provide any categorization mechanism, which still needs to be done via the admin interface on your blog. Categorization is actually supported. While composing the post, use the Keywords: meta-header to provide names of existing categories, separated by comma.


      This setup has been working pretty well for me, and lets me use all the other 
Emacs functionalities as well. In summary, the pros and cons are:


      • Enables me to blog from within Emacs, and use all the Emacs-goodness the platform brings
      • Emacs is a multi-platform editor, and I can blog from any system I have access to (i.e., not tied to my Mac)
      • I can tweak the behavior of the system by directly accessing the code, if needed
      • This is a free and open-source solution


      Note that Ecto and MarsEdit are both capable systems, and are more Mac-like. I do have the trial versions downloaded, and will be trying both out over the next couple of weeks as well.


      3 Comments on “Using Emacs and Markdown for WordPress posting”

      1. hexmode says:

        If you’re still using weblogger.el please join the mailing list and let us know of your experience.

      2. zettt says:

        Thanks you so much!

      3. catphive says:

        Is it possible to use this setup if you are hosted on I’d love to switch over to emacs + markdown.

        For some reason I thought you could only install plugins and the like if you hosted your own wordpress install. Since this site is on, presumably that’s wrong?

      Leave a Reply

      Fill in your details below or click an icon to log in: Logo

      You are commenting using your account. Log Out / Change )

      Twitter picture

      You are commenting using your Twitter account. Log Out / Change )

      Facebook photo

      You are commenting using your Facebook account. Log Out / Change )

      Google+ photo

      You are commenting using your Google+ account. Log Out / Change )

      Connecting to %s