问题
I'm using emacs23
on Ubuntu 32-bit 10.04/10.10 with GNOME and Compiz.
Pressing M-RET in an org-mode
plain list in Emacs (GUI) inserts a new item. Pressing M-Up moves the item up in the list.
These keys don't work as expected in emacs -nw
under Terminator and gnome-terminal
. The M-Up key does nothing, whereas the M-RET key simply moves the cursor down one line and indents the position. The keys also don't "work" in xterm
, which inserts \215
instead. Pressing ESC-RET or ESC-Up instead produces the expected functionality. The same problems exist if I run emacs -nw
on a headless server accessed via ssh
under Terminator, gnome-terminal
and xterm
.
I've searched both generally and on the org-mode
Gmane list for an answer to this, but have not found anything. Is this a known issue with org-mode
or is it related to the terminal emulator and/or the Window Manager?
回答1:
In addition to the keys in my question, S-TAB, S-Left, S-Right, S-Up and S-Down were not working over ssh and PuTTY. Using certain keys on a TTY connection (ssh, screen, PuTTY) is a known issue. Alternative keys are included in org-mode as detailed here.
回答2:
The menubar of terminal emulator is not letting the M
key that is meant for Emacs be passed down to Emacs. For Emacs to receive the M
key as it is supposed to, you could either use the Esc
or disable the menubar and use M
key in Emacs as usual.
ADDED:
For the xterm, if you do CTRL+Mouse Button 1, you will see "Meta sends Escape". You need to make sure that option is checked/enabled to make M
work as it should in Emacs.
回答3:
Alternative key combinations exist
for equivalent to M-RET
M C-m
"<return>
" is the Return ↩ key while emacs runs in a graphical user interface.
"RET" is the Return ↩ key while emacs runs in a terminal.
"RET" is also equivalent to "C-m" (【Ctrl+m】). (http://ergoemacs.org/emacs/emacs_key_notation_return_vs_RET.html)
as equivalents for M-<up/down>
you can use
ESC-<up>
ESC-<down>
来源:https://stackoverflow.com/questions/5556678/m-ret-and-m-up-down-not-working-in-emacs-org-mode-in-console-terminal