This article describes my experiences trying out various emacs module for managing your blog.
My requirements for a great blogging solution for emacs should support the following:
Here are the various blogging solutions I tried out:
org-mode is great for dealing with tabular data. I use it all the time for time series data, like keeping track of my weight, my score in Vem vet mest? and my work hours. It's also not bad for writing todo lists of all kinds. The org-mode syntax does not appear to be Markdown, but something close enough.
My information about org2blog comes from an old blog post written by Irreal.
Apparently, blogger uses the Atom API, so what I need is something called Org2BlogAtom.
The first problem is how to get org-mode to export to html with syntax highlighting. I'm often inserting code snippets in my posts, so getting that to work correctly is definitely a must. Two things are needed for that to happen:
(setq org-src-fontify-natively t org-export-htmlize-output-type 'css)
Then just press
C-c C-e h to generate an html file of your org
buffer. That's the first step, the next is to get the generated html
file published online on my blog.
There are two different versions of org2blog, a fact that struck me after some googling. One for posting to Wordpress blogs and a different module for Blogger ones. Since I'm currently with the latter, what I need is org2blog/atom which is found at the sparsely documented git repo.
It depends on g-client, which has its own EmacsWiki page, but no obvious way to download the module. Checking out and building the Subversion reposity seem to have worked:
svn co http://emacspeak.googlecode.com/svn/trunk/lisp/g-client/ cd g-client make cp g-cus-load.el* g.el* gcal.* g-utils.el* g-app.el* gblogger.el* \ ~/.site-lisp/
~/.site-lisp/ is on load-path ofcourse).
org2blog/atom itself has an installation procedure that depends on
"elinstall" which seem to be a custom installation module created by
same author. But copying all elisp files from the
./common to my
~/.site-lisp directory sems to work.
Next error "Requires a different version of org-mode. See README.org". The one shipped with emacs 24.3 isn't enough? But I think it should be since emacs 24.3 was released after the last commit was made to the org2blog repository. Let's check the code.
(unless (boundp 'org-html-cvt-link-fn) (error "Requires a different version of org-mode. See README.org"))
Aha! So where does
org-html-cvt-link-fn come from? After some heavy
googling, I think the answer is that it was defined in a file called
org-html.el that is no longer part of org-mode. Additionally, there
mailing list thread
which seem to imply that the function is used for converting links
when exporting to HTML. Commenting out the references to it in
main.el in org2blog helps – I should be able to do without that
File error: Cannot open load file, org2blog/common/l2r
This time the missing dependency is
tinydb/persist. Installation is quick:
git clone http://repo.or.cz/r/tinydb.git cd tinydb cp *.el ~/.site-lisp
Hopefully, I should be able to do without that feature. And finally! I'm able to load org2blog using this configuration:
(load-library "asynq") (load-library "persist") (load-library "l2r") (load-library "g") (load-library "main") (require 'org2blog/atom/main)
M-x org2blog/atom:post emits yet another problem:
Symbol's function definition is void: org-mode-p
Googling for it produces a
pull request with a patch
for a different project that I think I can adapt. Easily fixed by
commenting out these two superfluous lines in
main.el in org2blog:
(unless (org-mode-p) (error "Only useful in an org-mode buffer"))
Then I get to the next error:
org-export-as-html: Wrong type argument: stringp, t
At this point, someone wiser than me would probably give up. Conclude
that org2blog/atom isn't salvagable and that there's better uses for
ones time. But.. I'm not that person. What's required is another
simple change in
(org-export-as-html nil nil)) ;; (org-export-as-html nil nil nil t nil))
The next error message is encouraging, because it seem to complain about a missing configuration variable which makes me think the final is near:
let*: Symbol's function definition is void: gblogger-blog->posting-url
The symbol is a function that is called with the return value of a
function call to
gblogger-ensure-blog. There are no search results
for the symbol name. I'm done with org2blog/atom, at least for
now. org2blog/atom probably needs to be rewritten anyway because it
needs to be updated to org-mode's and Bloggers latest API
changes. g-client could probably be salvaged though.