From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Kevin Rodgers Newsgroups: gmane.emacs.help Subject: Re: Specifying Control-= as a string? Date: Fri, 21 Jul 2006 09:30:05 -0600 Organization: IHS Message-ID: References: <2cd46e7f0607191006j4b8a2fat3bda91b1e941ae1b@mail.gmail.com> <2cd46e7f0607191015n2c975d39j631c0a6a9e3c94f2@mail.gmail.com> 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 1153495957 13307 80.91.229.2 (21 Jul 2006 15:32:37 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 21 Jul 2006 15:32:37 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Jul 21 17:32:36 2006 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1G3wz6-0001a6-4K for geh-help-gnu-emacs@m.gmane.org; Fri, 21 Jul 2006 17:32:12 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1G3wz5-0001jM-JC for geh-help-gnu-emacs@m.gmane.org; Fri, 21 Jul 2006 11:32:11 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1G3wyv-0001jB-OH for help-gnu-emacs@gnu.org; Fri, 21 Jul 2006 11:32:01 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1G3wyt-0001in-Nq for help-gnu-emacs@gnu.org; Fri, 21 Jul 2006 11:32:00 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1G3wyt-0001ig-HW for help-gnu-emacs@gnu.org; Fri, 21 Jul 2006 11:31:59 -0400 Original-Received: from [80.91.229.2] (helo=ciao.gmane.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA:32) (Exim 4.52) id 1G3wzK-0000k1-DJ for help-gnu-emacs@gnu.org; Fri, 21 Jul 2006 11:32:26 -0400 Original-Received: from list by ciao.gmane.org with local (Exim 4.43) id 1G3wyT-0001QT-BW for help-gnu-emacs@gnu.org; Fri, 21 Jul 2006 17:31:33 +0200 Original-Received: from 207.167.42.206 ([207.167.42.206]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 21 Jul 2006 17:31:33 +0200 Original-Received: from ihs_4664 by 207.167.42.206 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 21 Jul 2006 17:31:33 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-To: help-gnu-emacs@gnu.org Original-Lines: 60 Original-X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: 207.167.42.206 User-Agent: Thunderbird 1.5.0.4 (Windows/20060516) In-Reply-To: <2cd46e7f0607191015n2c975d39j631c0a6a9e3c94f2@mail.gmail.com> X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:36146 Archived-At: Ken Manheimer wrote: > is there any way to specify the one-character key sequence: > > [(control =)] > > as a lisp string? > > the strings "\C-=" and "\^=" complain about "Invalid modifier in string". > > this question is mostly academic, at this point. i was thinking about > using it key as a binding in a keymap, but eventually realized that > regular (non-window-system) ttys won't pass it as input. though i've > given up on that, i'd like to better understand the story here, and am > curious about whether there's any way to express it as a string, or > whether it's just a bad idea in principle (BIiP). It is explained in the Init Rebinding node of the Emacs manual: | If you have a set of key bindings that you like to use all the time, | you can specify them in your `.emacs' file by using their Lisp syntax. | (*Note Init File::.) | | 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) ... | 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. | | Here are examples of using vectors to rebind `C-=' (a control | character not in ASCII), `C-M-=' (not in ASCII because `C-=' is not), | `H-a' (a Hyper character; ASCII doesn't have Hyper at all), (a | function key), and `C-Mouse-1' (a keyboard-modified mouse button): | | (global-set-key [?\C-=] 'make-symbolic-link) | (global-set-key [?\M-\C-=] 'make-symbolic-link) | (global-set-key [?\H-a] 'make-symbolic-link) | (global-set-key [f7] 'make-symbolic-link) | (global-set-key [C-mouse-1] 'make-symbolic-link) The issue of whether a terminal can send a different key code for control-= than for = depends on the particular terminal. But if it can be configured to send an escape sequence (like for function keys), you can get Emacs to recognize that by frobbing function-key-map (see the Translating Input Events node of the Emacs Lisp manual). -- Kevin