all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: Emacs-Devel <emacs-devel@gnu.org>
Subject: Re: Cannot use "\C-!" in a string in Emacs 22?
Date: Mon, 26 Sep 2005 15:44:36 -0400	[thread overview]
Message-ID: <jwv7jd3k4aj.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <MEEKKIABFKKDFJMPIOEBEEOCCMAA.drew.adams@oracle.com> (Drew Adams's message of "Mon, 26 Sep 2005 11:56:59 -0700")

> 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	other threads:[~2005-09-26 19:44 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-09-26 18:56 Cannot use "\C-!" in a string in Emacs 22? Drew Adams
2005-09-26 19:44 ` Stefan Monnier [this message]
2005-09-26 20:28   ` Drew Adams
2005-09-26 20:50 ` Edward O'Connor

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwv7jd3k4aj.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.