On my MacBook Pro running OS X Lion 10.7.4, there seems to be a keyboard issue. I first noticed this problem when I tried to use the default keybinding to execute mark-sexp
and query-replace-regexp
in emacs, which are bound respectively to C-M-@
and C-M-%
by default. As I use emacs a lot, I really miss these two powerful features a lot.
As I don't have experience dealing with terminal types etc, I did some simple debugging within emacs:
C-M-f
andC-M-b
work as expected. So control and option work well together.M-%
,M-<
andM->
work as expected. So option and shift work well together.C-S-backspace
does not work. (But I've never tried this command before; the first time I ran it was today when I found it in the emacs manual.) ButC-@
works as expected. So control and shift probably work well together.- If I am not mistaken, the command
digit-argument
is bound toC-9
,C-8
, etc. These keys do not work as well. I have made sure that in System Preferences.app I have turned off these keys for switching spaces.
In Terminal.app preferences, I have selected "use option as meta key" as it eases typing the emacs keybindings. I also tried to disable this option and use ESC but still to no avail. Any ideas?
P.S. I launched X11.app and in the xterm window I started emacs. Using ESC as meta, C-M-%
and C-M-@
work perfectly. In the Cocoa version of Emacs, these two work perfectly as well. So I guess it is a Terminal.app bug or probably there might be a setting or configuration switch I can tweak to make this work in Terminal.app?
And here is the output of stty -a
from emacs shell, hopefully it's useful...
bash-3.2$ stty -a
speed 9600 baud; 0 rows; 0 columns;
lflags: icanon isig iexten -echo echoe -echok echoke -echonl echoctl
-echoprt -altwerase -noflsh -tostop -flusho -pendin -nokerninfo
-extproc
iflags: -istrip icrnl -inlcr -igncr ixon -ixoff ixany imaxbel -iutf8
-ignbrk brkint -inpck -ignpar -parmrk
oflags: opost -onlcr -oxtabs -onocr -onlret
cflags: cread cs8 -parenb -parodd hupcl -clocal -cstopb -crtscts -dsrflow
-dtrflow -mdmbuf
cchars: discard = ^O; dsusp = ^Y; eof = ^D; eol = <undef>;
eol2 = <undef>; erase = <undef>; intr = ^C; kill = <undef>;
lnext = ^V; min = 1; quit = ^\; reprint = ^R; start = ^Q;
status = ^T; stop = ^S; susp = ^Z; time = 0; werase = ^W;
bash-3.2$
The same command directly from the shell:
$ stty -a
speed 9600 baud; 24 rows; 80 columns;
lflags: icanon isig iexten echo echoe -echok echoke -echonl echoctl
-echoprt -altwerase -noflsh -tostop -flusho pendin -nokerninfo
-extproc
iflags: -istrip icrnl -inlcr -igncr ixon -ixoff ixany imaxbel iutf8
-ignbrk brkint -inpck -ignpar -parmrk
oflags: opost onlcr -oxtabs -onocr -onlret
cflags: cread cs8 -parenb -parodd hupcl -clocal -cstopb -crtscts -dsrflow
-dtrflow -mdmbuf
cchars: discard = ^O; dsusp = ^Y; eof = ^D; eol = <undef>;
eol2 = <undef>; erase = ^?; intr = ^C; kill = ^U; lnext = ^V;
min = 1; quit = ^\; reprint = ^R; start = ^Q; status = ^T;
stop = ^S; susp = ^Z; time = 0; werase = ^W;
$
(Side-comment: It seems strange that the syntax for a code block is four preceding spaces. Are all StackExchange users expected to know how to use paste(1)
, sed(1)
or rectangle edits?)