unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Terminal and event-apply-control-modifier
@ 2018-06-26 13:16 Michael Brand
  2018-06-30 13:48 ` Stefan Monnier
  0 siblings, 1 reply; 2+ messages in thread
From: Michael Brand @ 2018-06-26 13:16 UTC (permalink / raw)
  To: help-gnu-emacs

Hi all

I have an understanding problem with ~event-apply-*-modifier~. Are the
following differences ~<C-return>~ vs. ~C-RET~ and ~<S-return>~ vs.
~RET~ between GUI and terminal intentional?

~C-h c C-x @ c <RET>~ in a GUI shows
#+begin_example
<C-return> (translated from C-x @ c) runs the command
org-insert-heading-respect-content
#+end_example
but in a terminal (-nw) it shows
#+begin_example
C-RET (translated from C-x @ c) is undefined
#+end_example
where I expect the same result.

~C-h c C-x @ S <RET>~ in a GUI shows
#+begin_example
<S-return> (translated from C-x @ S) runs the command org-table-copy-down
#+end_example
but in a terminal it shows
#+begin_example
RET (translated from C-x @ S) runs the command org-return
#+end_example
where I expect the same result.

I tried Emacs 26.1 and 25.2 in Gnome Terminal and iTerm2 on GNU/Linux and macOS.

Michael



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Terminal and event-apply-control-modifier
  2018-06-26 13:16 Terminal and event-apply-control-modifier Michael Brand
@ 2018-06-30 13:48 ` Stefan Monnier
  0 siblings, 0 replies; 2+ messages in thread
From: Stefan Monnier @ 2018-06-30 13:48 UTC (permalink / raw)
  To: help-gnu-emacs

> I have an understanding problem with ~event-apply-*-modifier~. Are the
> following differences ~<C-return>~ vs. ~C-RET~ and ~<S-return>~ vs.
> ~RET~ between GUI and terminal intentional?

For the RET key, terminals send the ascii code 13 (which Emacs prints as
"RET" in the context of key bindings), which is also the code for
"control m" (for historical reasons) and hence is also the same as what
the terminal sends when you hit C-m.

In GUI frames, Emacs can tell the difference between "return" and
"control m" on the other hand, and since it can be useful, we
intentionally don't treat those two as one and the same there.
More specifically, on GUI frames, the "return" key sends the
`return` event.

Combining "shift" with an ASCII control char like C-m is tricky
(actually, the shift modifier in general is tricky because we sometimes
want to treat it as a modifier and sometimes we want to simply make it
appear like we hit a different key, as in the difference between `A`
and `S-a`).  The way we do it is probably not completely consistent, but
there's a good chance that "fixing" one case will break another, so we
tend to try and leave that mess alone.


        Stefan




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-06-30 13:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-06-26 13:16 Terminal and event-apply-control-modifier Michael Brand
2018-06-30 13:48 ` Stefan Monnier

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).