From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Kevin Rodgers Newsgroups: gmane.emacs.devel Subject: Re: Rant: key sequences aren't specified in the elisp manual. Date: Thu, 17 Nov 2005 16:19:39 -0700 Message-ID: References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1132269985 28560 80.91.229.2 (17 Nov 2005 23:26:25 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 17 Nov 2005 23:26:25 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Nov 18 00:26:18 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1Ect5x-0003Ks-MO for ged-emacs-devel@m.gmane.org; Fri, 18 Nov 2005 00:23:10 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ect5w-0008If-So for ged-emacs-devel@m.gmane.org; Thu, 17 Nov 2005 18:23:08 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Ect5m-0008IB-11 for emacs-devel@gnu.org; Thu, 17 Nov 2005 18:22:58 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Ect5l-0008Ha-EF for emacs-devel@gnu.org; Thu, 17 Nov 2005 18:22:57 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ect5l-0008HP-BD for emacs-devel@gnu.org; Thu, 17 Nov 2005 18:22:57 -0500 Original-Received: from [80.91.229.2] (helo=ciao.gmane.org) by monty-python.gnu.org with esmtp (TLS-1.0:RSA_AES_128_CBC_SHA:16) (Exim 4.34) id 1Ect5l-0000R4-3m for emacs-devel@gnu.org; Thu, 17 Nov 2005 18:22:57 -0500 Original-Received: from list by ciao.gmane.org with local (Exim 4.43) id 1Ect3W-0002Ly-G0 for emacs-devel@gnu.org; Fri, 18 Nov 2005 00:20:38 +0100 Original-Received: from 207.167.42.60 ([207.167.42.60]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 18 Nov 2005 00:20:38 +0100 Original-Received: from ihs_4664 by 207.167.42.60 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 18 Nov 2005 00:20:38 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-To: emacs-devel@gnu.org Original-Lines: 76 Original-X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: 207.167.42.60 User-Agent: Mozilla Thunderbird 0.9 (X11/20041105) X-Accept-Language: en-us, en In-Reply-To: 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:46188 Archived-At: Alan Mackenzie wrote: > I've just spent ~ 2 hours trying to figure out from the elisp manual the > various ways of binding the key sequence "control-C control-backspace". > > This is written in such an abstruse and unclear way in the elisp manual > (page "Changing Key Bindings") that it's probably easier to try every > vaguely plausible combination than to try to figure it out from the > manual. I think you would have had more luck if you'd started with the Emacs manual. The "Init Rebinding" node (aka Rebinding Keys in Your Init File) says: | The simplest method for doing this works for ASCII characters and | Meta-modified ASCII characters only. This method uses a string to | represent the key sequence you want to rebind. For example, here's how | to bind `C-z' to `shell': | | (global-set-key "\C-z" 'shell) and | When the key sequence includes function keys or mouse button events, | or non-ASCII characters such as `C-=' or `H-a', you must use the more | general method of rebinding, which uses a vector to specify the key | sequence. | | The way to write a vector in Emacs Lisp is with square brackets | around the vector elements. Use spaces to separate the elements. If an | element is a symbol, simply write the symbol's name--no other | delimiters or punctuation are needed. If a vector element is a | character, write it as a Lisp character constant: `?' followed by the | character as it would appear in a string. followed by several examples. > In fact, I figured out "[?\C-c \C-backspace]" by just such > experimentation. Trouble is, this is rejected by XEmacs, and I want the > specification to be portable. So I would like a list of all the ways > Emacs can do it, so that I can try them one by one in XEmacs. The "Changing Key Bindings" node of the Emacs Lisp manual says: | The key definition and lookup functions accept an alternate syntax | for event types in a key sequence that is a vector: you can use a list | containing modifier names plus one base event (a character or function | key name). For example, `(control ?a)' is equivalent to `?\C-a' and | `(hyper control left)' is equivalent to `C-H-left'. One advantage of | such lists is that the precise numeric codes for the modifier bits | don't appear in compiled files. I don't know why that isn't included in or referenced from the Emacs manual, or why it doesn't mention that another advantage of the list syntax is that it's portable to XEmacs. For your problem, I think the equivalent of "[?\C-c \C-backspace]" is ((control ?c) (control ?\b)) ... > Where is the list of symbols like `home' that one can use in vectors? > Would it be too much to expect them either to be listed, or to have an > @xref to the page where they are listed? I am confused as to whether > "backspace" is called "backspace", "del", "BS", "delete", and whether it > has to be in lower case, upper case, or it doesn't matter. See the "Function Keys" node (aka Rebinding Function Keys) in the Emacs manual. > Again, what I would like to see is a "@section Specifying Key Sequences", > whose meat would look like something like this: FWIW, I agree. -- Kevin Rodgers