From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Drew Adams" Newsgroups: gmane.emacs.devel Subject: Cannot use "\C-!" in a string in Emacs 22? Date: Mon, 26 Sep 2005 11:56:59 -0700 Message-ID: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1127761471 3404 80.91.229.2 (26 Sep 2005 19:04:31 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 26 Sep 2005 19:04:31 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Sep 26 21:04:21 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1EJyFG-0004qL-20 for ged-emacs-devel@m.gmane.org; Mon, 26 Sep 2005 21:02:34 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EJyFF-0006uQ-8y for ged-emacs-devel@m.gmane.org; Mon, 26 Sep 2005 15:02:33 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EJyDR-0005Q5-4Q for emacs-devel@gnu.org; Mon, 26 Sep 2005 15:00:41 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EJyDN-0005Mo-Rm for emacs-devel@gnu.org; Mon, 26 Sep 2005 15:00:40 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EJyDL-0004zu-4B for emacs-devel@gnu.org; Mon, 26 Sep 2005 15:00:35 -0400 Original-Received: from [148.87.122.31] (helo=rgminet02.oracle.com) by monty-python.gnu.org with esmtp (TLS-1.0:DHE_RSA_3DES_EDE_CBC_SHA:24) (Exim 4.34) id 1EJy9w-0003ml-BK for emacs-devel@gnu.org; Mon, 26 Sep 2005 14:57:04 -0400 Original-Received: from rgmsgw300.us.oracle.com (rgmsgw300.us.oracle.com [138.1.186.49]) by rgminet02.oracle.com (Switch-3.1.6/Switch-3.1.7) with ESMTP id j8QIv13Q001107 for ; Mon, 26 Sep 2005 12:57:01 -0600 Original-Received: from rgmsgw300.us.oracle.com (localhost [127.0.0.1]) by rgmsgw300.us.oracle.com (Switch-3.1.7/Switch-3.1.7) with ESMTP id j8QIv0mg004937 for ; Mon, 26 Sep 2005 12:57:00 -0600 Original-Received: from dradamslap (dradams-lap.us.oracle.com [130.35.177.126]) by rgmsgw300.us.oracle.com (Switch-3.1.7/Switch-3.1.7) with SMTP id j8QIv0Wi004930 (version=TLSv1/SSLv3 cipher=RC4-MD5 bits=128 verify=NO) for ; Mon, 26 Sep 2005 12:57:00 -0600 Original-To: "Emacs-Devel" X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.6604 (9.0.2911.0) Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1506 X-Brightmail-Tracker: AAAAAQAAAAI= X-Whitelist: TRUE X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:43263 Archived-At: 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.