++Python - Emacs functions to expand shorthand

Barry A. Warsaw bwarsaw at cnri.reston.va.us
Wed Jul 7 11:17:58 EDT 1999


>>>>> "PL" == Preston Landers <mithy at my-deja.com> writes:

    PL> py-shorthand-line-expand -- bound to C-z -- works only on the
    PL> current line.

    PL> py-shorthand-buffer-expand -- bound to C-c C-z -- works on the
    PL> whole buffer.

    PL> These keys expand shorthand expressions.  A couple of
    PL> examples:

    | foo += bar  --->  foo = foo + bar
    | ++foo.bar   --->  foo.bar = foo.bar + 1

Here's a thought:

Why not make `+', `-', and `=' electric and do the expansion
automatically when you type those characters?  You'd have to use

    foo.bar++  instead of ++foo.bar

but that doesn't seem too bad.  I think those expansions would be
pretty easy to do, and if they work out well and a lot of people like
them, I might consider adding them to python-mode.

-Barry




More information about the Python-list mailing list