Blogging from Emacs

October 20, 2008

After switching to WordPress, I can now post entries from Emacs, thanks to weblogger.el.

Note that there seems to be several “weblogger mode” packages for Emacs. Follow the link above to see how I got it working.

weblogger.el had a few problems, most of which were fixed by ciju. Thanks for that! However, it did require a few additional hacks to get it working in the way I wanted to.

Below is the diff between ciju’s version and mine.

2a3,6
> ;; NOTE: Modified by ciju as described here:
> ;; http://ciju.wordpress.com/2008/06/06/twiddling-with-webloggerel-emacs-wordpress/
> ;; Also, further hacking by Chopmo
>
584c588,589
 		    ; (list "Subject" title) ; fixed by chopmo
>           (list "Subject" (or title"\n"))
938,939c943,945
<   (if (buffer-modified-p)
   ;; modified by ciju, disabled by chopmo
> ;;   (if (buffer-modified-p)
> ;;       (weblogger-prepare-and-send nil nil)) ;; ciju's modification

You can also download the patched weblogger.el here.

The diff above tweaks the weblogger feature in two ways:

  1. Fixes a small bug which caused the newline after “Subject:” to be missing when starting a new entry.
  2. Reverts a change made by ciju which caused the current entry to be saved as a draft when navigating to the next (with C-c C-n) or the previous (with C-c C-p) entry.

The second change means that published entries stay published and that navigation between entries is very fast, but also that you need to actively save a modified entry before leaving it. This is done with C-c C-s to save it as published or C-c C-c to save it as draft.

Both commands simply overwrite the previous published/draft state of the entry, so there’s not explicit “publish” step. You just save the entry as published. Also, both commands can be used for initially saving the entry.

Another small tip: Note that after initially saving an entry, the URL to the entry is displayed in the header:

X-URL: http://chopmo.wordpress.com/?p=92

As long as you’re logged into your WordPress account, you can use this URL to see a preview of the entry as you work on it. The preview is updated as soon as you save the entry in Emacs.

About these ads

2 Responses to “Blogging from Emacs”


  1. [...] I have described in another entry, blogging from Emacs works beautifully with WordPress. And Emacs is where I want to spend my time, [...]

  2. Thomas Says:

    Teknisk? Nej vel… Okay lidt måske, men jeg synes det er lidt for meget om dit eget liv, Kristine, jeres katte og generelle betragtninger :-)

    PS. Lidt ironi måske anvendt…

    Lidt mere seriøst:
    Kunne godt lide at læse om din far, om Thomas Winding (føler det samme – er også næsten 33) Din kattevander er for griner!

    Skal vi snart presse hønsene til kalenderbingo?


Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: