How does one send S-RET to Emacs in a terminal?
Asked Answered
C

5

15

In org-mode, pressing M-S-RET (meta-shift-return) will create a new TODO on a new line. This key sequence sends M-RET to emacs through my terminal. I've checked this with C-h c ESC-S-RET, which returns M-RET is undefined in the mini-buffer.

I'm using Snow Leopard with Emacs 23.2.1 running in Terminal.app. There is no option to define a RET sequence in the terminal keyboard preferences.

Any idea what's causing the missing SHIFT? Workarounds?

Casiecasilda answered 20/8, 2010 at 6:43 Comment(0)
A
7

You can get Emacs to pretend that it got S-RET with C-x @ S RET (note uppercase S).

This also works for adding control, meta, alt, hyper or super modifiers; type C-x @ C-h for the list of bindings. The Modifier Keys section in the Emacs manual mentions this as well.

Avignon answered 9/8, 2012 at 16:35 Comment(1)
This answer provides a hack: map the terminal's (iTerm's, more specifically) M/S-RET to what Emacs would process as as M/S-RET emacs.stackexchange.com/a/62538/29629Fader
S
5

In general, lots of keystrokes are simply impossible to send via a terminal, since terminals emulate an old protocol that only allowed 256 separate keys (or maybe only 128).

Chances are, when you press S-RET, Terminal.app does exactly the same thing as if you'd pressed RET. Thus Emacs has no way to distinguish those two cases.

Santasantacruz answered 20/8, 2010 at 15:10 Comment(1)
I was afraid this might be the case. I'll leave the question open for a bit to see if anyone out there knows which terminal I should emulate to get S-RET. It may not be possible. Currently, terminal reports itself as xterm-color, but I can change this in the config options. Don't know if it would solve anything though.Casiecasilda
F
3

Cross-linking to other Q&As:

If you are using an xterm, then the modifyOtherKeys option may facilitate that binding. See the following for details:

Send "C-(" to Emacs in VT100/xterm terminal (Mac OS X's Terminal)?

I suspect Emacs recognises those codes by default, but if not then also see input-decode-map as described here: Binding M-<up> / M-<down> in Emacs 23.1.1

Fussy answered 9/10, 2011 at 19:50 Comment(0)
C
2

See explanation and alternative shortcuts for TTY here.

Some of these have worked for me in a terminal in Ubuntu Linux (both locally and over SSH), but not all of them seem to work. For example, the alternative provided for S-RET (which I expected to run org-table-copy-down) instead seems to run org-clone-subtree-with-time-shift for some reason. However, I have found the list of alternatives useful, particularly those with the M- prefix. For example ESC UP for M-UP to move text around in tables.

Ceram answered 9/10, 2011 at 12:30 Comment(0)
P
0

Though it's a lot of extra key presses, it turns out that org-mode has an alternative:

C-c C-x <shift> m

i.e. C-c C-x M

https://orgmode.org/manual/TTY-Keys.html#TTY-keys

Plasm answered 6/4, 2023 at 1:49 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.