From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Ben Bacarisse Newsgroups: gmane.emacs.help Subject: Re: Fwd: C-[ is undefined Date: Fri, 27 Jul 2018 17:19:15 +0100 Organization: A noiseless patient Spider Message-ID: <87muuc3b3w.fsf@bsb.me.uk> References: <8736w65fz2.fsf@bsb.me.uk> <87y3dx31ki.fsf@bsb.me.uk> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1532708320 20326 195.159.176.226 (27 Jul 2018 16:18:40 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 27 Jul 2018 16:18:40 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Jul 27 18:18:36 2018 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fj5Rs-00058G-5f for geh-help-gnu-emacs@m.gmane.org; Fri, 27 Jul 2018 18:18:36 +0200 Original-Received: from localhost ([::1]:42219 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fj5Tw-0003aI-RO for geh-help-gnu-emacs@m.gmane.org; Fri, 27 Jul 2018 12:20:44 -0400 X-Received: by 2002:a1c:7dc7:: with SMTP id y190-v6mr732656wmc.32.1532708357216; Fri, 27 Jul 2018 09:19:17 -0700 (PDT) Original-Path: usenet.stanford.edu!w25-v6no1206540wmc.0!news-out.google.com!s23-v6ni10365wmc.0!nntp.google.com!feeder1-2.proxad.net!proxad.net!feeder1-1.proxad.net!ecngs!feeder2.ecngs.de!feeder.erje.net!1.eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 48 Original-Injection-Info: reader02.eternal-september.org; posting-host="054865feb4dae337a1609ac01e09ac3c"; logging-data="12437"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+7YCtmAG102ClUpM8unH/UH4oKx0hSM8o=" Cancel-Lock: sha1:LPTAjjGVfQrjTu7i3U/WmYkoCOA= sha1:usyHVsJXl1Ky7C0MaNIBF9puBkM= X-BSB-Auth: 1.0f016e248fa10ed1aeae.20180727171915BST.87muuc3b3w.fsf@bsb.me.uk Original-Xref: usenet.stanford.edu gnu.emacs.help:223478 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.org gmane.emacs.help:117603 Archived-At: John Shahid writes: > Ben Bacarisse writes: > > > [...] > >>>>> Short story: ~C-x @ c [~ results in "C-[ is undefined" but I expected >>>>> it to be the Meta prefix like in for example ~C-[ t~ for ~M-t~. >>>> >>>> I would expect C-x @ c [ to be the same as C-[ >>> >>> Did you try? For me it is not the same which is what I wanted to say >>> in the first place. >> >> Yes, I tried it, but my interpretation of the result ("C-[" is >> undefined) was that C-x @ c [ was a way to generate a "key" that could >> not otherwise be typed. >> >> That's kind of what happens. For example, you can bind C-[ this way and >> still use C-[ to get the ESC- prefix. >> >> However, that seems like an unlikely explanation! It is probably >> something to do with translated key sequences. ESC and C-[ are not >> exactly the same, but I am not expert enough to explain the way in which >> they differ. > > I think there is an implicit assumption in this thread that Emacs is > receiving key press events for both the 'Control' and '[' keys. I tried > this on my system using 'xev' and it receives a KeyPress event for > 'Control' but as soon as I hit '[' the window receives a KeyPress event > for Escape (i.e. '0x1b'). My conclusion is that Emacs doesn't even know > that you pressed 'C-['. Not here. xev shows Control_L down, [ down, [ up, Control_l up. Odd difference. > You can probably achieve the same result by translating 'C-[' to > 'Escape' in the 'key-translation-map'. This map is used after > 'local-function-key-map' where the 'event-apply-control-modifier' > applies the control modifier. Another idea is to add an advice to > 'event-apply-control-modifier'. I thought it might be an interaction between translation maps and others. -- Ben.