Emacs skeletons

Michael Hoffman cam.ac.uk at mh391.invalid
Tue Jul 26 20:52:50 CEST 2005

George Flaherty wrote:

> Since you are on this topic, do you (or anyone else) have any
 > type of "code-completion" mode for python in emacs?

I have this in my .emacs:

(global-set-key "\M-/" 'hippie-expand)

This means that M-/ will do dumb code completion based on stuff that is 
already in an open buffer, which can be helpful, and is certainly better 
than nothing. Try it; you'll probably like it.

I also have this in .emacs:

(setq abbrev-file-name "~/etc/emacs/abbrev_defs")

and this in ~/etc/emacs/abbrev_defs:

(define-abbrev-table 'python-mode-abbrev-table '(
     ("pdb" "import pdb; pdb.set_trace()" nil 0)

Together, those mean that if I type pdb, M-/, then I get
import pdb; pdb.set_trace(), which can save me a lot of time while 
debugging. To be honest, I usually use pdb from the commandline instead 
these days, with 'alias pdb="python -m pdb"' in my .bashrc.
Michael Hoffman

More information about the Python-list mailing list