Note that the code requires Emacs 24.