special editor support for indentation needed.

Eric S. Johansson esj at harvee.org
Mon Nov 17 17:23:57 EST 2008


John Yeung wrote:
> On Nov 15, 8:50 pm, "Eric S. Johansson" <e... at harvee.org> wrote:
>> well, therein lies the rub.  I don't know lisp,
>> I don't know Emacs internals let alone python mode.
> 
> Unfortunately, neither do I.  Actually, I haven't touched Emacs since
> my college days, and barely remember any of it.  I figured from your
> preference for Emacs that you already did some customization for
> yourself.

Like the vast majority of Emacs users, I cut, paste, and swear.
> 
> Is vr-mode a "major" mode?  If so, I suppose it can't be active at the
> same time as python-mode, which is also a major mode.  I grabbed a
> copy of the code for python-mode (revision 4.75) and while I frankly
> don't understand it, it looks like it has provisions for things like
> finding the beginning of a class or def, which might be usable in
> building the types of commands you want.
> 
> Perhaps you should try asking for help from the Emacs community.  To
> someone versed in Emacs Lisp, what you want might be fairly easy.
> 
> Another possibility, that I mention mainly because I find it
> interesting, and not so much because I expect it to be the best path
> for you, is Pymacs.  It purports to let you customize Emacs using
> Python instead of Emacs Lisp.
> 
> Good luck!  I'm sorry I can't be of more help.

no biggie.  Maybe the real answer is changing the conversation to look for
editors that can run on Windows but edit remotely  like emacs + tramp.

Anyway, here's the speech macros I've worked out so far.

# minimal python and commands

New class    = '{ctrl+a}class
{ctrl+@}(object):{ctrl+j}{tab}"""{ctrl+j}{tab}"""{enter}{ctrl+x}{ctrl+x}';

new method   = '{ctrl+a}    def
{ctrl+@}(self):{ctrl+j}"""{ctrl+j}"""{ctrl+j}{ctrl+x}{ctrl+x}';

new constructor = '{ctrl+a}    def __init__(self):{ctrl+j}"""{ctrl+j}"""{ctrl+j}';

end colon = '{ctrl+e}:';

between single quotes = "''"{ctrl+b};
between double quotes = '""'{ctrl+b};
between triple quotes = "''''''"{ctrl+b}{ctrl+b}{ctrl+b};
between hex quotes    = '""""""'{ctrl+b}{ctrl+b}{ctrl+b};

(ad|add) index   = '[]{ctrl+b}';
next index       = '{ctrl+s}[{ctrl+f}';
last index       = '{ctrl+r}]{ctrl+b}{ctrl+r}[{ctrl+f}';
delete index     = '{ctrl+r}[{ctrl+f}{ctrl+s}]{ctrl+b}{ctrl+w}';

go to Line [Number] <digit> = {esc}xgoto-line{enter}$1{Enter};
go to Line [Number] <digit> <digit> = {esc}xgoto-line{enter}$1$2{Enter};
go to Line [Number] <digit> <digit> <digit> = {esc}xgoto-line{enter}$1$2$3{Enter};
go to Line [Number] <digit> <digit> <digit> <digit> =
{esc}xgoto-line{enter}$1$2$3$4{Enter};

go to (end={ctrl+e} | beginning={ctrl+a} | start={esc}m) of line = $1;





More information about the Python-list mailing list