Your favorite Python-related (X)Emacs thingamajiks?

Peter Milliken peterm at
Tue Mar 2 22:45:09 CET 2004

If you're interested in code abbreviations (aka skeletons) then you might
want to look at ELSE - it has a (reasonably) complete set of definitions for
the entire Python language. It's well documented (40+ page users manual) and
you don't need any funny unreadable hieroglyphics to create a new construct
like you do with skeleton.el :-) e.g. the following is the definition of a
Python def statement in ELSE's template language:

    /LANGUAGE="Python" -
    /SEPARATOR="" -

    "def {identifier} ([defparameter]...):"
    "  [document_string]"
    "  {statement}..."


ELSE provides commands to navigate backwards and forwards between
placeholders (the text enclosed by {}'s and []'s - which are [obviously]
persistent BTW, you don't "lose" them between edit sessions or by expanding
a new abbreviation like you do with skeleton.el) and when you start typing
into one of them it gets deleted automatically and replaced by the
characters being typed.

It can be viewed and downloaded at


"Edvard Majakari" <edvard+news at> wrote in message
news:87llmjn5mh.fsf at
> I just thought to share mine:
> (define-skeleton esm-skel-python-def
>   "Inserts a new python function definition at point."
>   "method name: "
>   "def " str
>   "("
>   ("argument, %s: "
>    str & ", ") & -2 & "):" | -1 & "():"
>    \n
>    >"\"\"\"" ("comment: " str) ".\"\"\"" \n)
> (define-abbrev python-mode-abbrev-table "def" "" 'esm-skel-python-def)
> It's not very neat, but it does create a simple, consistent Python def
> whenever you type 'def ' and prompts for a name, list of arguments and
> comment for the method. Some day I'll try to make it more intelligent and
> automatically add 'self' as the first parameter, if I'm inside a class.
> --
> # Edvard Majakari Software Engineer
> # PGP PUBLIC KEY available    Soli Deo Gloria!
> $_ = '456476617264204d616a616b6172692c20612043687269737469616e20'; print
> join('',map{chr hex}(split/(\w{2})/)),uc

More information about the Python-list mailing list