unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Felix Crux <felixc@felixcrux.com>
To: Jambunathan K <kjambunathan@gmail.com>
Cc: help-gnu-emacs@gnu.org
Subject: Re: Difference between GUI/terminal when using "kbd" macro
Date: Mon, 18 Feb 2013 14:33:11 -0500	[thread overview]
Message-ID: <CAB-hsnCmOAYBvTkd+ndOPG0S6XtRQQrMjm2qJnF-AhFQqEfk2g@mail.gmail.com> (raw)
In-Reply-To: <87wqu5jv1l.fsf@gmail.com>

Thanks for the suggestion; it actually led to an interesting discovery:

With the keybinding set to (kbd "C-x <escape>"), running "C-x <escape> C-h"
(in a terminal session, since in a GUI one it quits Emacs) shows the following:

  Global Bindings Starting With C-x ESC:
  key             binding
  ---             -------
  C-x ESC ESC     repeat-complex-command

This got me thinking about the fact that the help system is calling it "ESC",
not "<escape>", and wondering about whether that is significant.

I then tried changing the binding to (kbd "C-x ESC"), which actually works in
both graphical and terminal sessions!

In conclusion, it looks as though there is a difference between "ESC" and
"<escape>", at least as far as the "kbd" macro is concerned. I don't know
enough about the topic to be sure, but I would speculate that "<escape>" is
some sort of special meta-character being sent by the X window system, while
"ESC" is the lower-level key value.

Very interesting stuff; and it now lets me use the more readable form, too!
I'm still quite curious about the discrepancy, but at least the original
problem is solved. Thank you!

Felix C.

On Mon, Feb 18, 2013 at 2:12 PM, Jambunathan K <kjambunathan@gmail.com> wrote:
>
> May be C-x ESC C-h will tell you what is behind the curtain.  Forgive
> me, if it doesn't help, for I know not what I am talking.  Just a
> suggestion.
>
>
> Felix Crux <felixc@felixcrux.com> writes:
>
>> Hello,
>>
>> I recently ran across a perplexing problem that I can't find the answer
>> to in the documentation.
>>
>> The following snippet in my init file works just as one would expect in
>> both graphical (GTK+) and terminal instances of Emacs:
>>
>>   (global-set-key [?\C-x ?\e] 'save-buffers-kill-emacs)
>>
>> However, this version, which I thought to be identical (but more readable),
>> only works in graphical sessions:
>>
>>   (global-set-key (kbd "C-x <escape>") 'save-buffers-kill-emacs)
>>
>> When attempting to use it in a terminal, the status line simply displays
>> "C-x ESC-", as though waiting for more input.
>>
>> Invoking emacs-version gives me "GNU Emacs 23.4.1 (x86_64-pc-linux-gnu,
>> GTK+ Version 2.24.10) of 2012-09-08 on trouble, modified by Debian".
>>
>> I'd be most grateful if someone would point me in the right direction to
>> understand this. Thank you,
>>
>> Felix C.
>>
>>
>
> --



  reply	other threads:[~2013-02-18 19:33 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-18 16:49 Difference between GUI/terminal when using "kbd" macro Felix Crux
2013-02-18 19:12 ` Jambunathan K
2013-02-18 19:33   ` Felix Crux [this message]
2013-02-19 15:58     ` Kevin Rodgers
2013-02-19 13:32 ` Stefan Monnier

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=CAB-hsnCmOAYBvTkd+ndOPG0S6XtRQQrMjm2qJnF-AhFQqEfk2g@mail.gmail.com \
    --to=felixc@felixcrux.com \
    --cc=help-gnu-emacs@gnu.org \
    --cc=kjambunathan@gmail.com \
    /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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).