Aah, good news. There’s a plugin that lets me post to my wordpress blog using Emacs org mode. The github repository is here. The mainpage documentation creates an unecessarily complicated picture of what has to be done to get this puppy running. On emacs 24.5.1 all I had to do was:
- installed org2blog using emacs package manager.
- install the following two lines to my .emacs:
:default-title "Hello World"
:default-categories ("org2blog" "emacs")
- login with
- M-x org2blog/wp-login.
- post to drafts
And hey presto, I’m up and running. I can write my posts in a first class editing evironment, using a first class markup language, and just export it with a keystroke (there are default keybindings, but I’m not using them yet). More’s possible, but for the moment I’m satisfied with that. For example, there are instructions on the github page explaining how to create a post template, and how customize your authentication, but so far I haven’t felt the need.
Now, let’s see if this leads to more posts on my part.
Since I started using org-mode some years ago, I’ve wound up using other document and prensenation tools (like LaTeX, Word, PowerPoint…) less and less. I find it the most convenient way of generating virtually any kind of document or presentation.
Now I’m working a great deal in Unicode. Org-mode itself has no difficult with unicode, but exporting to PDF goes through the LaTeX engine, and one has to do a little extra work to make sure that works seamlessly.
The simplest means I have found to getting LaTeX to interact correctly with Unicode is to use Xetex. One needs to:
- Install XeTeX (use your system’s package management).
- Tell org-mode to use XeTeX when generating the PDF’s from the latex files — see the elisp snippet below.
fontspec from the list of default packages that org includes when exporting LaTeX.
So I added the following to my .emacs
;; fontify code in code blocks
(setq org-src-fontify-natively t)
;; Delete inputenc and fontenc from the default packages.
(setq org-latex-default-packages-alist (delete ‘("AUTO" "inputenc" t)
(setq org-latex-default-packages-alist (delete ‘("T1" "fontenc" t)
;; Add minted to the defaults packages to include when exporting.
;; alternatively you can add these by customizing org-latex-packages-alist.
(add-to-list ‘org-latex-packages-alist ‘("" "minted") ("" "fontspec")
;; Tell the latex export to use the minted package for source
;; code coloration.
(setq org-latex-listings ‘minted)
;; Let the exporter use the -shell-escape option to let latex
;; execute external programs.
;; This obviously and can be dangerous to activate!
‘("xelatex -shell-escape -interaction nonstopmode -output-directory %o %f"))
You can find my emacs configuration on github.