emacs-devel
[Top][All Lists]
Advanced

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

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


From: Drew Adams
Subject: Cannot use "\C-!" in a string in Emacs 22?
Date: Mon, 26 Sep 2005 11:56:59 -0700

I'm interested in a key-binding syntax that works with Emacs 20 through 22
(for those bindings that are acceptable to all of those versions). The (kbd
...) syntax, for instance, doesn't work with earlier Emacsen, so that choice
is out, for me.

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".  Based on the
error message, which speaks of strings, not key bindings, I tried (setq foo
"\C-!"), which gives the same error - so I guess it's a string-syntax
problem, not a key-binding syntax problem.

Is it normal that this was broken in moving to Emacs 22 (or 21)? Where is
the explanation of this in the Elisp manual (I looked in section Strings and
Characters and in the keybinding discussions).

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 admit that I'm confused about the various key-binding syntaxes. I've
consulted the manual, but, except for (kbd...), I don't see a universal
syntax to use for all key sequences, and (kbd...) is not usable with Emacs
20. I somehow seem to always end up with collections of "\modifier-key",
[(modifier fn-key)], and [modifier-key]. I'm probably just not reading the
doc correctly, but I'd appreciate some light on the question.





reply via email to

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