When I blog with Emacs and when I blog with other tools

English: org-mode logo: http://orgmode.org/wor...

English: org-mode logo: http://orgmode.org/worg/org-faq.php#unicorn (Photo credit: Wikipedia)

Updated 2014-10-29: I no longer use Windows Live Writer. I now use Org2blog (thanks to this thumbnail code!) or the WordPress web interface to write and update my posts.

I would love to be able to write all of my blog posts within Emacs. I like the outline tools and simple markup of Org Mode. Org Mode and org2blog are invaluable when I’m writing a post with lots of code or keyboard commands, because it’s easy to set up syntax highlighting or add teletype text. Here’s an interesting self-referential example of org2blog’s power that uses #INCLUDE to include the Org blog post source in the post itself.

If I expect that a post will have lots of images, I tend to use Windows Live Writer because it takes care of resizing and aligning images, linking to the original size. Because it uses my blog’s stylesheet, I can get a sense of how the text will flow around it. I can quickly draw an idea in Autodesk Sketchbook Pro, copy and paste it into Windows Live Writer, and then resize it until it feels balanced on the page. Sometimes I draft a post in Emacs and then open it in Windows Live Writer or ScribeFire so that I can add images.

Org Mode also supports images, but it’s not as easy to resize things there. If I wrote a function that used ImageMagick to save the clipboard image to a file, resize it to the appropriate dimensions, and link it to the full-size image, maybe that would do the trick. Still, that sounds like it would be a fair bit of work. Maybe someday. Hmm – any chance someone reading this blog happens to already have that snippet handy? =)

If I need to edit an existing post, I either use the WordPress web interface or I use ScribeFire. That way, I don’t have to fill in the post publishing date again.

It’s a bit of a patchwork system of different tools, but it does the job. What’s your workflow like?

3 Pingbacks/Trackbacks

  • I use Emacs’ markdown mode pretty exclusively. Then I just copy and paste that into WordPress’ text tab. I use WordPress’ image tools for all my images; I have no patience for resizing images and WordPress does an excellent job IMHO.

    I think there is a way to upload it to WordPress as a draft? Does org2blog do that? Somewhere in the markdown conversion or pasting to WordPress, all of my 2 spaces become 1 which is annoying.

    I don’t publish until I’ve read the post over in preview mode though, so it doesn’t interrupt my workflow that much. Lastly, I have somebody else review each post before I send it. It’s hard to catch your own grammatical mistakes!

    • As jcs noted, org2blog posts drafts by default. =) I’ve also set it up to use my heading tags as categories, which is pretty handy. I usually reschedule posts using the Editorial Calendar plugin for WordPress, and I almost always preview drafts before posting them.

      Double spaces: HTML collapses whitespace by default, right? Since you’re working in Emacs, you might be able to write some Emacs Lisp that converts your double spaces into ”  ” or something like that. Or maybe a CSS rule that uses pre-wrap or something like that? http://www.w3schools.com/cssref/pr_text_white-space.asp

      What kind of setup do you have for someone else reviewing your posts before publishing? I’ve been meaning to pay someone to edit my posts to improve clarity (more that than typos, although typos can be really embarrassing if they’re in code), but I haven’t hired anyone yet.

      • Thanks for the whitespace tip. I’ll have to look into that.

        So, my wife is my editor :) She begrudgingly reviews my technical posts, but she is quite good at finding issues even in those posts.

  • jcs

    I use org2blog exclusively. When I edit a post after it’s published, I make the changes in the original org file and reexport it. That keeps the date the same so it’s never an issue for me. The publishing date can be a problem if you use WordPress to schedule or queue a post because then the published date and the org2blog date will differ. I stopped using WordPress to queue my posts after the (fairly) recent attack on WordPress admin pages because I couldn’t get to the admin page to release the posts. Now I just queue them locally and push when I’m ready to publish. I have a bit of Elisp that automatically adds a post to my local queue that helps keep me from getting confused or forgetting things.

    I don’t have nearly as many images as you do and mine are most often something like a screenshot so org2blog’s image handling is fine for me. Really, after dealing with Blogger image handling on my old blog, I was overjoyed that org2blog exported the images and changed the link for me.

    • So, with org2blog can you save as a draft first or does it publish right away? I like the direct interaction with Emacs and WordPress, but I like to see the preview before I finally push the button.

      • jcs

        You can have it your way. By default it gets pushed as a draft so you can view it on your site before publishing. You can also publish it directly by specifying the universal argument first.

        Also, you can send it to your local browser before you push it to WordPress to see how things look. Unless you have a local copy of your .CSS file it won’t look exactly like it does on WordPress but it’s close enough. I usually do this as a rough sanity check before I push.

    • Oh, that’s an interesting idea. Would you happen to have shared that queueing code anywhere, in case other people find it useful?

      I use org2blog for the initial draft and occasional edits (I love how it can update posts!), although I also tend to use the WordPress editor (for quick changes) or Windows Live Writer (because I can see how resizing images makes my text wrap). Have you figured out how to get org2blog to create thumbnails for you, or do you upload the image at the original size and either set the size in the browser or resize it before linking to it in org2blog?

      • jcs

        I wrote about the problem and the Elisp I use here.

        I like to make all my changes to the org file because it acts as a (portable) backup and I can search locally and get an accurate copy. As I said, my images are never complicated enough to require much preprocessing. I mostly just let org2blog handle it. Since Emacs can display the image in-line, I get a pretty good idea of what things will look like on the site.

  • I have a small journal for post planning, and try to draw a mind map for each post. Most of the time I use Blogsy on my iPad to write posts. I keep all of my pics on Flickr and link to them. I admire your rigorous schedule of daily posts – I’m lucky for one per week!

    • Mindmaps and outlines are great for exploring ideas. =) I like doing those too!

      I’d write more if I could get away with it. There’s so much to learn and share. Since daily posts are overwhelming enough, I just schedule posts for some point in the future, and I combine or update posts whenever possible. I’m thinking of starting a topic-focused blog, and would love to hear from you about what you might want to read more about. =)

  • Tomas Zellerin

    I tried to automate image handling of the images in the org mode (not a blog) a bit, but I did not use it from clipboard (good idea, I might explore), but from photos.

    What I did is move the files to the appropriate heading as attachment (org-attach), and use defined function to insert empty captions, make previews and insert links to that. The caveat is that unless you patch org-display-inline-images, the previews are not shown as inline images in emacs. It was in old emacs/org (23), but I do not think it changed after upgrade.

    But the code is dirty and the process is not very refined (I needed that at one point of time, then no longer).

  • I often write a blog article in Emacs org-mode, then export to HTML and open in a browser. I then copy the text from the browser into the WordPress edit window. I havent looked at org2blog or Microsoft Live Writer.

    Sometimes I write a blog article in Word then paste into WordPress.

    • Oh, maybe you’ll like Org2Blog then! I find it to be really handy for posting, since I don’t have to find the specific HTML snippet in the region export output. =)

  • Pingback: The learning machine: How I turn what I learn into blog posts » sacha chua :: living an awesome lifesacha chua :: living an awesome life()

  • Pingback: When I blog with Emacs and when I blog with other tools » sacha chua :: living an awesome lifesacha chua :: living an awesome life » Think *NIX()

  • Hi Sacha,
    you might find this blog entry interesting – I basically decided that I usually only need two sizes (if it needs to be resized), either filling half or all of my blog width – I also keep the original size around… I have a pretty simple workflow that does exactly what I want, and it works great for me. Using Ruby and Keyboard Maestro instead of EMacs (which I’m just starting to look into), but the concept is simple and it shouldn’t be hard to do. sips is great if you’re on a Mac.


    • Neat, thanks for sharing! I’m going to stick with WordPress for a number of reasons, but this might come in handy someday (or for other people who are interested in static site generators). =)

  • ic3guy

    Just discovered org-page, https://github.com/kelvinh/org-page which is great for generating a slim, static blog site from org-files. I am currently using oblog http://renard.github.io/o-blog/, but am finding templating difficult and you can’t separate blog posts into different files.

    • I love how there are so many options! =)

  • Pingback: Using Research Everything by Zemanta | Tomato Cheese Code()

  • Sylver Stone

    Hi, interesting discussion indeed but it can get complicated also.
    I e.g. like (at first sight) this script => org-blog.el => https://pastebin.com/8HyViHRp because it’s a kind of standalone solution but I cannot make it work to. Probably have to do with the new features org-mode has since version 8.0. I tried by changing requiring ‘ox-publishing’ rather than ‘org-publishing’ in line 127 if you visit the pastebin file above, but it seems to be not enough. Hey, I’m far of being any kind of expert, just fascinated by emacs and reading and digging has led me to this point, where actually I’m stuck.
    If someone would know to

    • Mmm, I’m still using org2blog to post to WordPress, so I don’t know much about standalone solutions. http://reddit.com/r/emacs , http://reddit.com/r/orgmode , and the Org Mode mailing list might be good places to check out, though. Good luck! =)

      • Sylver Stone

        Hi, Sachac, thanks for your reply.
        I’ve done some tries on the script but I cannot get the index (of blog post) frontpage created. I’ve posted for help here https://emacs.stackexchange.com/q/33429/11198 if someone were in the mood of helping. I’d appreciate it so much. Thank you anyway.