Part of pida.utils.emacs
This work was made possible thanks to the Emacs patches written by Timo Savola for his own embedding of Emacs with his Encode project (http://encode.sourceforge.net/).