Editing Wordpress Articles in Emacs

I’ve got my blog on WordPress.com, which has some positive aspects (I don’t have to run it) and some negative (I can’t control it fully). But whether I’m running WordPress myself or not, there’s one thing that’s always true: I loathe the browser-based editor.

When composing blog articles, I’ve been using the post-by-mail interface that WordPress.com offers, and it works OK. It’s got severe limitations in what it accepts, though: No <div>s or anything more fancy than a link and an image, really, and even those can’t be combined.

But editing is the main problem: I’ve tried using the Edit with Emacs Firefox plugin, and it doesn’t work with WordPress.com, apparently. So I’ve just… not… edited much, because it’s such a pain in the ass. The “visual” editor doesn’t even have reliable scrolling.

So yesterday evening I pulled myself together and started googling “emacs wordpress”, and found org2blog, which allows you to edit your WordPress blog posts using org mode. So it’s possible!

It turns out that this all is so much easier than I had imagined: WordPress has an old xmlrpc interface that you can just call with your credentials to do all this stuff. (It also has a new interface that’s oauth2-based, i.e., it requires a web browser in the auth flow with is just ick.)

The org2blog people have kindly separated out the low-level stuff into its own library, and I wrote a new library, ewp on top of that. Because even if Org is nice and stuff, I just want to edit my WordPress articles. I want WordPress to have the articles, and don’t want to have a “shadow” set of master texts.

With the help of that library (after fixing a multi/unibyte bug in the xml-rpl.el library (that was merged fast by the nice maintainer)), I finished off the library yesterday, and it’s basic, but does what I need, I think.

It lists the posts on WordPress, allows me to edit them, and to create new posts. (And, of course, since I’m very picture-happy, I also added some stuff to upload embedded media (which was a problem with the post-by-mail interface, because WordPress’ SMTP servers had a size limit of 100MB per email which they refused to increase, even after I asked them (so unreasonable!!!ONE!)).)

Here’s a Youtube demo of me typing away at my very shiny sofa laptop:

This has all been tested very, very lightly, of course, so I’d caution er caution. I’ve tried posting and editing myself on my WordPress.com blog, but who knows what happens on other WordPress installations…

And I’m sure it’ll grow more features as time passes. Things tend that way, don’t they?

2 thoughts on “Editing Wordpress Articles in Emacs”

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 )

Google+ photo

You are commenting using your Google+ 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 )

Connecting to %s