unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* keybindings again...
@ 2017-06-30  2:42 Jean-Christophe Helary
  2017-06-30  2:51 ` Kaushal Modi
  0 siblings, 1 reply; 12+ messages in thread
From: Jean-Christophe Helary @ 2017-06-30  2:42 UTC (permalink / raw)
  To: Help Gnu Emacs mailing list; +Cc: Org-mode

I'm using emacs built from master, emacs -nw, after moving .emacs.el and .emacs.d away, on OSX 10.12.


I'm trying to assign M-S-RET to org-insert-todo-heading because for some reason it is not assigned by default: every time I hit ESC S-RET I get ESC RET only.

So, I tried things from
http://ergoemacs.org/emacs/keystroke_rep.html

First, this works fine:
(global-set-key (kbd "M-b") 'org-insert-todo-heading)

But this doesn't:
(global-set-key (kbd "M-<return>") 'org-insert-todo-heading)

What I get here is the old M-return = org-insert-heading.

What is the problem here ?

Jean-Christophe 




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

* Re: keybindings again...
  2017-06-30  2:42 keybindings again Jean-Christophe Helary
@ 2017-06-30  2:51 ` Kaushal Modi
  2017-06-30  5:10   ` Jean-Christophe Helary
  0 siblings, 1 reply; 12+ messages in thread
From: Kaushal Modi @ 2017-06-30  2:51 UTC (permalink / raw)
  To: Jean-Christophe Helary, Help Gnu Emacs mailing list; +Cc: Org-mode

On Thu, Jun 29, 2017 at 10:43 PM Jean-Christophe Helary <
jean.christophe.helary@gmail.com> wrote:

> I'm using emacs built from master, emacs -nw, after moving .emacs.el and
> .emacs.d away, on OSX 10.12.
>
>
> I'm trying to assign M-S-RET to org-insert-todo-heading because for some
> reason it is not assigned by default: every time I hit ESC S-RET I get ESC
> RET only.
>

It's the limitation of the terminal.

If you do C-h c Esc+Shift+Return, Emacs will detect only Esc+Return. So you
will see M-RET in the echo area.

You probably just need to use some other binding.
-- 

Kaushal Modi


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

* Re: keybindings again...
  2017-06-30  2:51 ` Kaushal Modi
@ 2017-06-30  5:10   ` Jean-Christophe Helary
  2017-06-30  5:27     ` Nicolas Goaziou
                       ` (4 more replies)
  0 siblings, 5 replies; 12+ messages in thread
From: Jean-Christophe Helary @ 2017-06-30  5:10 UTC (permalink / raw)
  To: Help Gnu Emacs mailing list, Org-mode


> On Jun 30, 2017, at 11:51, Kaushal Modi <kaushal.modi@gmail.com> wrote:
> 
> On Thu, Jun 29, 2017 at 10:43 PM Jean-Christophe Helary <jean.christophe.helary@gmail.com <mailto:jean.christophe.helary@gmail.com>> wrote:
> I'm using emacs built from master, emacs -nw, after moving .emacs.el and .emacs.d away, on OSX 10.12.
> 
> 
> I'm trying to assign M-S-RET to org-insert-todo-heading because for some reason it is not assigned by default: every time I hit ESC S-RET I get ESC RET only.
> 
> It's the limitation of the terminal.

Do you mean that Shift is not recognized as a modified key by the terminal ?

> If you do C-h c Esc+Shift+Return, Emacs will detect only Esc+Return. So you will see M-RET in the echo area.
> 
> You probably just need to use some other binding.

It would be nice if the org manual mentioned that too, and give alternative keybindings for use in the terminal because that's extremely confusing.

Jean-Christophe Helary 

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

* Re: keybindings again...
  2017-06-30  5:10   ` Jean-Christophe Helary
@ 2017-06-30  5:27     ` Nicolas Goaziou
  2017-06-30  7:23       ` Jean-Christophe Helary
  2017-06-30  5:33     ` Kaushal Modi
                       ` (3 subsequent siblings)
  4 siblings, 1 reply; 12+ messages in thread
From: Nicolas Goaziou @ 2017-06-30  5:27 UTC (permalink / raw)
  To: Jean-Christophe Helary; +Cc: Help Gnu Emacs mailing list, Org-mode

Hello,

Jean-Christophe Helary <jean.christophe.helary@gmail.com> writes:

> It would be nice if the org manual mentioned that too, and give
> alternative keybindings for use in the terminal because that's
> extremely confusing.

It does: (info "(org) TTY keys").

See also `org-replace-disputed-keys'.

Regards,

-- 
Nicolas Goaziou



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

* Re: keybindings again...
  2017-06-30  5:10   ` Jean-Christophe Helary
  2017-06-30  5:27     ` Nicolas Goaziou
@ 2017-06-30  5:33     ` Kaushal Modi
  2017-06-30  6:17     ` Eli Zaretskii
                       ` (2 subsequent siblings)
  4 siblings, 0 replies; 12+ messages in thread
From: Kaushal Modi @ 2017-06-30  5:33 UTC (permalink / raw)
  To: Jean-Christophe Helary, Help Gnu Emacs mailing list, Org-mode

On Fri, Jun 30, 2017 at 1:12 AM Jean-Christophe Helary <
jean.christophe.helary@gmail.com> wrote:

>
> Do you mean that Shift is not recognized as a modified key by the terminal
> ?
>

That's my understanding. Also, I rarely use emacs with -nw (as I would
otherwise miss PNG and PDF support), so I am not an expert on this subject.
But based on some reading, it has to do with the type of terminal emulator
you are using. This[1] might help.


> > If you do C-h c Esc+Shift+Return, Emacs will detect only Esc+Return. So
> you will see M-RET in the echo area.
> >
> > You probably just need to use some other binding.
>
> It would be nice if the org manual mentioned that too, and give
> alternative keybindings for use in the terminal because that's extremely
> confusing.
>

I cannot comment on that as this probably has to do with the terminal
emulator and not emacs. In any case, it might be better to submit an emacs
bug report (M-x report-emacs-bug) requesting this mention in the manual.

This node already mentions something on this topic:

    (elisp) Other Char Bits

but just not using the "Ctrl + Shift + .." example.


[1]: https://emacs.stackexchange.com/a/13957/115
-- 

Kaushal Modi


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

* Re: keybindings again...
  2017-06-30  5:10   ` Jean-Christophe Helary
  2017-06-30  5:27     ` Nicolas Goaziou
  2017-06-30  5:33     ` Kaushal Modi
@ 2017-06-30  6:17     ` Eli Zaretskii
  2017-06-30  7:28       ` Jean-Christophe Helary
  2017-06-30  6:22     ` Yuri Khan
  2017-06-30 21:55     ` Emanuel Berg
  4 siblings, 1 reply; 12+ messages in thread
From: Eli Zaretskii @ 2017-06-30  6:17 UTC (permalink / raw)
  To: help-gnu-emacs, emacs-orgmode

> From: Jean-Christophe Helary <jean.christophe.helary@gmail.com>
> Date: Fri, 30 Jun 2017 14:10:50 +0900
> 
> Do you mean that Shift is not recognized as a modified key by the terminal ?

No, that's not it.  The problem is that on a TTY, the way Emacs reads
keyboard input returns only characters, it doesn't return function
keys.  So Shift-a returns 'A', because the keyboard driver generates
an upper-case A when you type that.  But there's no up-cased RET
character, so you get just RET.

Keys like F1 work on a TTY by emitting a sequence of characters,
usually starting with ESC, and Emacs binds that sequence in special
keymaps in a way that produces the symbol F1.  But Shift-RET doesn't
produce any such sequence, so there's nothing Emacs can do in that
case.



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

* Re: keybindings again...
  2017-06-30  5:10   ` Jean-Christophe Helary
                       ` (2 preceding siblings ...)
  2017-06-30  6:17     ` Eli Zaretskii
@ 2017-06-30  6:22     ` Yuri Khan
  2017-06-30 21:55     ` Emanuel Berg
  4 siblings, 0 replies; 12+ messages in thread
From: Yuri Khan @ 2017-06-30  6:22 UTC (permalink / raw)
  To: Jean-Christophe Helary; +Cc: Help Gnu Emacs mailing list, Org-mode

On Fri, Jun 30, 2017 at 12:10 PM, Jean-Christophe Helary
<jean.christophe.helary@gmail.com> wrote:

>> I'm trying to assign M-S-RET to org-insert-todo-heading because for some reason it is not assigned by default: every time I hit ESC S-RET I get ESC RET only.
>>
>> It's the limitation of the terminal.
>
> Do you mean that Shift is not recognized as a modified key by the terminal ?

A brief recap of terminal limitations, from a guy who has never used a
real hardware terminal.

The protocol by which a terminal passes keystrokes to an application
is that of an ASCII character stream, with only minor extensions
(these days it’s a UTF-8-encoded character stream). It predates the
notion of keyboard as an interactive input device.

In that protocol, there are 32 control characters with codes 0 through
31 (decimal). They are associated with Ctrl+@, Ctrl+A, …, Ctrl+Z,
Ctrl+[, Ctrl+\, Ctrl+], Ctrl+^ and Ctrl+_, and terminals pass these
character codes when these key combinations are pressed, with or
without Shift. Also, there is the control character 127, sometimes
written as Ctrl+?.

Additionally, the most frequent of these control characters have been
given single keys. These are RET = Ctrl+M, TAB = Ctrl+I, ESC = Ctrl+[,
sometimes BS = Ctrl+H, and sometimes DEL = Ctrl+?.

It follows that many terminals emit identical character codes for C-m,
C-M, RET and S-RET; C-i, C-I, TAB and S-TAB; C-[, C-{, ESC and S-ESC;
and C-?, DEL and S-DEL; the application running on the other side
cannot distinguish them.


GUI systems, on the other hand, were developed after keyboards had
been available for many years. Thus, most of they do allow
applications to distinguish any keys with any modifiers.

Some GUI terminal emulators have taken advantage of their GUI nature,
and started passing distinct escape sequences for some key
combinations. For example, Xterm emits ESC [ Z when I press Shift+Tab.

Some GUI terminal emulators also let the user customize which
character sequences they send on which keys.



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

* Re: keybindings again...
  2017-06-30  5:27     ` Nicolas Goaziou
@ 2017-06-30  7:23       ` Jean-Christophe Helary
  2017-06-30 22:08         ` Emanuel Berg
  0 siblings, 1 reply; 12+ messages in thread
From: Jean-Christophe Helary @ 2017-06-30  7:23 UTC (permalink / raw)
  To: Org-mode, Help Gnu Emacs mailing list


> On Jun 30, 2017, at 14:27, Nicolas Goaziou <mail@nicolasgoaziou.fr> wrote:

>> It would be nice if the org manual mentioned that too, and give
>> alternative keybindings for use in the terminal because that's
>> extremely confusing.
> 
> It does: (info "(org) TTY keys").

Thank you for the pointer. Although I don't think I ever used a teletypewriter in my life :) Maybe sometimes in the 21st century we'll have to think about a change in terminology...

I use the compact manual as a reference for my uses and I find it extremely useful for beginners. Would it be possible to insert a few line on that subject in there too? Something like "People who use org-mode in a tty terminal should refer to section 15.9 of the manual for alternative key bindings."

> See also `org-replace-disputed-keys'.

Thank you.

Jean-Christophe


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

* Re: keybindings again...
  2017-06-30  6:17     ` Eli Zaretskii
@ 2017-06-30  7:28       ` Jean-Christophe Helary
  0 siblings, 0 replies; 12+ messages in thread
From: Jean-Christophe Helary @ 2017-06-30  7:28 UTC (permalink / raw)
  To: Help Gnu Emacs mailing list, Org-mode

Eli and Yuri,

Thank you *so much* for the thorough explanations. Now I know.
After having finally understood how git was working I was going back to my list of things to do for/with emacs and got frustrated by that shortcut that kept not working...

Jean-Christophe 

> On Jun 30, 2017, at 15:17, Eli Zaretskii <eliz@gnu.org> wrote:
> 
>> From: Jean-Christophe Helary <jean.christophe.helary@gmail.com>
>> Do you mean that Shift is not recognized as a modified key by the terminal ?
> 
> No, that's not it.



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

* Re: keybindings again...
  2017-06-30  5:10   ` Jean-Christophe Helary
                       ` (3 preceding siblings ...)
  2017-06-30  6:22     ` Yuri Khan
@ 2017-06-30 21:55     ` Emanuel Berg
  2017-07-01  0:00       ` Emanuel Berg
  4 siblings, 1 reply; 12+ messages in thread
From: Emanuel Berg @ 2017-06-30 21:55 UTC (permalink / raw)
  To: help-gnu-emacs; +Cc: emacs-orgmode

Jean-Christophe Helary wrote:

> Do you mean that Shift is not recognized as
> a modified key by the terminal ?

Of course it is...

M-S-RET can be done with the old workaround.
Full tutorial here [1].

But in essence, in

    /etc/console-setup/remap.inc

put

    # make M-S-RET work
    alt shift keycode 28 = U+1000

Then invoke this function:

    # first do 'sudo chmod +s /bin/loadkeys'
    lkeys () {
        loadkeys -q -c -s /etc/console-setup/remap.inc
    }

Then in an Emacs init file:

    ;; M-S-RET
    (define-key input-decode-map [?\u1000] [M-S-RET-a])
    (global-set-key [M-S-RET-a] (lambda () (interactive) (message "M-S-RET")))

(You can't call it [M-S-RET] because then Emacs
 tells you it doesn't work :))

> It would be nice if the org manual mentioned
> that too, and give alternative keybindings
> for use in the terminal because that's
> extremely confusing.

People typically don't use the terminal.
Only the bravest do it. So it is not an area
where people put their educational brains to
work. Actually it is the opposite. When they
propose making the ttys better they put the
suggestions down because they don't want people
to use it. It should only be there as a safe
bet when everything else fail.

But to the brave it doesn't matter because you
can put tmux on top of it (or screen, no
personal experience with that tho),
problem solved.

But there are use cases even for people who
aren't that brave as to use it every day, for
example when they ssh to some remote machine to
do edits there...

-- 
underground experts united
http://user.it.uu.se/~embe8573




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

* Re: keybindings again...
  2017-06-30  7:23       ` Jean-Christophe Helary
@ 2017-06-30 22:08         ` Emanuel Berg
  0 siblings, 0 replies; 12+ messages in thread
From: Emanuel Berg @ 2017-06-30 22:08 UTC (permalink / raw)
  To: help-gnu-emacs; +Cc: emacs-orgmode

Jean-Christophe Helary wrote:

> Thank you for the pointer. Although I don't
> think I ever used a teletypewriter in my life
> :) Maybe sometimes in the 21st century we'll
> have to think about a change in
> terminology...

In computers, but also in just any brand of
engineering (and other areas as well), there
are tons of cases when terminology is either
outdated or just plain wrong. When there is
a correct term, as in "chainwheel" or
"sprocket" as opposed to "cog" (which is
incorrect, as it isn't a cod), it is good to
know about the correct terms and use them
whenever, but it is equally necessary to know
about the incorrect term. You will find
respectable books when they refer to a sprocket
as a "cog" without blinking! And know what,
that book is healthy for you to
read nonetheless!

So in most cases it is better to use the
correct term in parallel and if the technically
incorrect one dies, good, if it survives, so
be it.

Another example: There were once a newsreader
called GNUS. When a new newsreader came, and
they thought of calling it "ding" as in "ding
is not GNUS". Clever, but it didn't take.
So now it is Gnus who isn't GNUS. But it is -
only better :)

As for the ttys they are also called "the
console" or "the Linux virtual terminals" (the
Linux VTs). All those are designations are fine
and at least "tty" and "console" are also part
of technology by now: e.g., I just mentioned
the file /etc/console-setup/remap.inc in
another post; as for "tty", do

    $ ls /dev/ | grep tty

> I use the compact manual [...]

Bigger always better :)

-- 
underground experts united
http://user.it.uu.se/~embe8573




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

* Re: keybindings again...
  2017-06-30 21:55     ` Emanuel Berg
@ 2017-07-01  0:00       ` Emanuel Berg
  0 siblings, 0 replies; 12+ messages in thread
From: Emanuel Berg @ 2017-07-01  0:00 UTC (permalink / raw)
  To: help-gnu-emacs; +Cc: emacs-orgmode

Emanuel Berg wrote:

> M-S-RET can be done with the old workaround.
> Full tutorial here [1].

[1] http://user.it.uu.se/~embe8573/tty-emacs-keys.txt

-- 
underground experts united
http://user.it.uu.se/~embe8573




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

end of thread, other threads:[~2017-07-01  0:00 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-30  2:42 keybindings again Jean-Christophe Helary
2017-06-30  2:51 ` Kaushal Modi
2017-06-30  5:10   ` Jean-Christophe Helary
2017-06-30  5:27     ` Nicolas Goaziou
2017-06-30  7:23       ` Jean-Christophe Helary
2017-06-30 22:08         ` Emanuel Berg
2017-06-30  5:33     ` Kaushal Modi
2017-06-30  6:17     ` Eli Zaretskii
2017-06-30  7:28       ` Jean-Christophe Helary
2017-06-30  6:22     ` Yuri Khan
2017-06-30 21:55     ` Emanuel Berg
2017-07-01  0:00       ` Emanuel Berg

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