emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Cannot use "\C-!" in a string in Emacs 22?


From: Stefan Monnier
Subject: Re: Cannot use "\C-!" in a string in Emacs 22?
Date: Mon, 26 Sep 2005 15:44:36 -0400
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

> I tried (define-key my-map "\C-!" 'my-cmd), which works in Emacs 20, but
> gives this error in Emacs 22: "Invalid modifier in string".

It worked under Emacs-20, but returned the same as "\C-a", i.e. probably not
what you intended.  In Emacs-21 this was fixed to return an error rather
than silently turning it into somwething else.

> Anyway, for the key binding, I settled on (define-key my-map [C-!] 'my-cmd),
> after some experimentation - it seems to work for key bindings in both
> versions.

I'd expect it doesn't really work.  It won't signal an error, but it won't
cause my-cmd to be run when you hit control and !.  You probably meant to
use (define-key my-map [?\C-!] 'my-cmd) which should work.  I'd recommend

    (define-key my-map [(control ?!)] 'my-cmd)

which will also work under XEmacs.


        Stefan




reply via email to

[Prev in Thread] Current Thread [Next in Thread]