pymacs! :-)

Steffen Ries steffen.ries at
Sun Sep 9 14:13:55 CEST 2001

pinard at (François Pinard) writes:

> I'm not utterly familiar with how `[SYMBOL]' works on the Emacs side to
> represent key-bindings, but I would guess Emacs developers made a few
> stunts for it to look good.  For what I guess these stunts are, I would
> write on the Python side:
>     lisp.global_set_key([lisp['M-f2']], lisp.redo)
> or even more tricky:
>     lisp.global_set_key([lisp.M_f2], lisp.redo)
> > >   (global-set-key "\C-xw" manglers-break-on-whitespace)
> > > [to become]
> > >   lisp.global_set_key('\x18w', lisp.manglers_break_on_whitespace)
> > IMHO this is a heavy burden to place on the person trying to write
> > python functions.
> Really?  We'll have to do something about it, then.

I think with emacs-20 the macro `kbd' was introduced to translate
strings like 'M-<f2>' or 'C-x w' to key bindings. I haven't followed the
emacs news groups for a while so I don't know if anybody besides me is
actually using it :-)

The example above could be written as:

(global-set-key (kbd "C-x w") manglers-break-on-whitespace)


lisp.global_set_key(lisp.kbd('C-x w'), lisp.manglers_break_on_whitespace)

steffen.ries at	<> Gravity is a myth -- the Earth sucks!

More information about the Python-list mailing list