Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

I'm trying to run Emacs in a terminal. I've turned on the "use option as meta" in terminal preferences and so it's about 95% working right.

The key sequence ctrl-/ (or in Emacs notation C-/) is "undo". This key sequence just causes the terminal to ring a bell. How do I fix this?

share|improve this question
FWIW, this works in iTerm2 - iterm2.com — but I think I will just retrain myself to use ^_ everywhere, to be more portable. –  Steven R. Loomis Nov 12 '13 at 20:20
@StevenR.Loomis portable? neither control-/ nor control-_ work under Android... –  Michael Feb 20 at 16:58
@Michael I said portable because it is representable in ASCII (see accepted answer) and thus can transit network connections without trouble. Plus, it seems to be usable on most physical keyboards I have seen. I did not try pairing a keyboard to the android device, are you referring to a soft or hard keyboard? –  Steven R. Loomis Feb 21 at 17:33
@StevenR.Loomis software... the control part seems to get ignored resulting in attempts to undo inserting a slash or underscore. –  Michael Feb 21 at 19:06
add comment

1 Answer

up vote 12 down vote accepted

Control-/ is not a part of the set of standard control codes. It is not directly representable as a keystroke in many terminal emulations. Such a keystroke is only properly detectable in certain platform-specific “scancode modes” or “GUI mode” (where the API tells you exactly which keys and modifiers are being used). Your terminal emulator is beeping because it is effectively an invalid keystroke.

The standard control codes only cover “Control” versions of

  • @ AZ [\]^_ (ASCII 0 - 31), and
  • ? (ASCII 127)

In most terminal emulator programs running with most US key layouts you may need to press Shift to generate some of the “Control codes”:

  • C-@ is ControlShift2 (since @ is Shift2)
  • C-^ is ControlShift6 (since ^ is Shift6)
  • C-_ is ControlShift- (since _ is Shift-)
  • However, C-? may not always be ControlShift/ (since ? is Shift/); C-? is usually generated by either Backspace (on Apple keyboards, the key labeled just “delete” without the additional symbol ⌦) or Delete (the one with ⌦ on Apple keyboards).

In tty-based Emacs, you can usually use C-_ for undo instead of C-/.

share|improve this answer
Thanks for the thorough answer. I'm going to try playing with different terminal types to see if I can get it to work. –  Kevin Peterson Sep 7 '11 at 21:36
"Different terminal types"? Do you mean different terminal emulator programs, or are you referring to the $TERM value, which in Terminal is set via Terminal > Preferences > Settings > [profile] > Advanced > Declare terminal as? (All that preference does is set the value of $TERM. It doesn't change the operation of the terminal emulation.) Control-/ is a feature of X11 and is not supported by Cocoa or Terminal. –  Chris Page Sep 8 '11 at 12:00
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.