As I mentioned in my post Emacs: The Ultimate Editor?, one of the things I love about Emacs is Org mode, which provides excellent facilities for working with plain text and exporting it to a variety of other formats. Recently I’ve used Org mode to prepare a number of tables within documents that I then export to and compile to PDF. Key here is Org’s ability to easily add or remove rows and columns, sort rows, and even transpose a table (see below). This blog is written in Org mode and exported to WordPress using org2blog.
A couple of months ago, version 8 of Org was released. It has many improvements over earlier versions but also some changes in syntax. In particular, the export engine has been rewritten. These changes are quite likely to break older Org files. Indeed the release notes say Org 8.0 is the most disruptive major version of Org.
Here is a list of problems I’ve experienced and the fixes. I’m currently using Org 8.0.3.
- Export to Beamer didn’t work until I added
(require 'ox-beamer)
to my .emacs.
- org2blog was broken in Org 8. A new branch for Org 8 was released at https://github.com/ptrv/org2blog/tree/org-8-support. In my tests
org2blog/wp-post-subtree
did not work properly: the title was being copied as a section heading. This was quickly fixed by author Peter Vasil earlier this week and org2blog is now working fine for me with Org 8. - The syntax for
table alignments has changed. In Org <8:
#+ATTR_LaTeX: align = |l|...
In Org 8:
#+ATTR_LaTeX: :align |l|...
Finally, here are a couple of useful, but easy to miss, features of Org.
Table Transpose
A new command org-table-transpose-table-at-point
in Org 8 provides the array transpose function. With the cursor in the table
a11 | a12 | a13 | a14 |
a21 | a22 | a23 | a24 |
a31 | a32 | a33 | a34 |
M-x org-table-transpose-table-at-point
produces
a11 | a21 | a31 |
a12 | a22 | a32 |
a13 | a23 | a33 |
a14 | a24 | a34 |
This could be particularly useful in a file, provided
orgtbl-mode
is being used, as there is no easy way to transpose a table.
Shortcuts
I’m not sure if this is new to ORG 8, but in any case it’s new to me. Type <s
followed by tab
and an empty source block magically appears:
#+BEGIN_SRC #+END_SRC
Very useful! The following table shows all the available expansions:
|----------+------------------| | Sequence | Expands to | |----------+------------------| | <s | #+BEGIN_SRC | | <e | #+BEGIN_EXAMPLE | | <q | #+BEGIN_QUOTE | | <v | #+BEGIN_VERSE | | <V | #+BEGIN_VERBATIM | | <c | #+BEGIN_CENTER | | <l | #+BEGIN_LaTeX | | <L | #+LaTeX | | <h | #+BEGIN_HTML | | <H | #+HTML | | <a | #+BEGIN_ASCII | | <A | #+ASCII: | | <i | #+INDEX: | | <I | #+INCLUDE: | |----------+------------------|
There is a nasty bug in Org-mode which causes it to stop working if it is updated via ELPA in an Emacs session which has at least one Org function already loaded. I wrote the following note to myself after spending sometime debugging Lisp, only to find out later about the bug. Feel free to include it in your post.
* Update =Org-mode= from ELPA without breaking it
You must make sure there are no =Org-mode= functions loaded while
the update is done. For that, exit Emacs and then run Emacs without
loading your =.emacs= (=Emacs -Q=). Remove the old =Org-mode=
#+BEGIN_SRC sh
rm -rf ~/.emacs.d/elpa/org-“Tab”
#+END_SRC
where =Tab= means press =Tab= to see and auto complete the old
=Org-mode= directory you want to remove. Finally, update =Org-mode=
(=M-x package-install RET org RET=) and restart Emacs as usual.
Thanks. I updated to Org 8 manually and keep it in Dropbox. This seems the best approach for me: I use Emacs on three different machines and have all gather their .emacs and elisp files from Dropbox.
I updated to Org 8.1 last week and it has broken org2blog. So I’ve gone back to Org 8.0.5,
(M-x org-version shows the Org version.)
I’ve just checked and I’m using org-mode 8.2.4 which came from elpa on 30-12-13, and, so far, I haven’t come across any org2blog problems. Just to let you know that its safe to upgrade atm! đŸ™‚