I am using emacs on many machines, and always use C-/ for undo. However, I started working on a Raspberry Pi with Arch Linux recently, using a local text terminal - X is not installed. Here, C-/ has the same effect as Backspace, instead of 'undo. How can I get an 'undo when I press C-/? I'm using emacs-nox-26.2.

Note, this question was also asked on SuperUser, but without a (to me) satisfactory answer. I'd like to reconfigure emacs, not my spinal cord ;-)

1 Answer 1


Ctrl+/ has the same effect as BackSpace because your terminal tells Emacs that you pressed Backspace: it sends DEL for Ctrl+/. There's no character for C-/ and most terminals don't have a control sequence for it, so there's no chance that Emacs would see C-/. You need to reconfigure the terminal to either send a different escape sequence that you bind to undo in Emacs, or send C-_ when you press Ctrl+/. The second approach is a lot easier, but I'll also show the first approach in case you want redo as well.

Follow the steps described in the Arch Wiki to create a custom keymap for the Linux console. (Well, not to the letter — I guess you won't run vim.) Check which keymap is the current one by locating the line KEYMAP=… in /etc/vconsole.conf. Open the file /usr/share/kbd/keymaps/KEYMAP.map.gz where KEYMAP is the keymap name. Save it as /usr/local/share/kbd/keymaps/astrofloyd.map. In /etc/vconsole.conf, replace the line KEYMAP=… by KEYMAP=astrofloyd.

The next time you reboot, you'll be using your own keymap. You can load it immediately with loadkeys astrofloyd. You need to run this command whenever you change the .map file.

In astrofloyd.map, locate the line for the slash key. It's keycode 53, sending slash question … or U+002f U+003f … depending on how the information is presented. If you see

keycode 53 = U+002f U+003f U+0323 U+002e Delete Delete …

then the columns to the right of the equal sign are, respectively: bare key, Shift, AltGr, AltGr+Shift, Ctrl, Ctrl+Shift, Ctrl+AltGr, Ctrl+AltGr+Shift, Meta, etc. So change Delete in the 5th and 6th column after the equal sign to Control_underscore.

If you see a line with

control keycode  53 = Delete

then change Delete to Control_underscore there.

If you want Ctrl+Shift+/ to do redo, you'll need to bind it to a different escape sequence. The Linux console has limited support for escape sequences. You need to use a known keysym name, and the only ones that don't have a conventional meaning are F25, F26, etc. So pick one, e.g.

keycode 53 = U+002f U+003f U+0323 U+002e Control_underscore F25 …
string F23 = "\033[27;6;63~"

and let Emacs know about the control sequence that it sends.

(define-key input-decode-map "\e[27;6;63~" [?\C-\?])
(global-set-key [?\C-\?] 'redo)
  • Thank you very much for your time, and for your explanation that this is not an emacs issue, but a terminal one, as well as describing the solution(s). Perhaps someone ought to move this to SuperUser. I'll try your solution tomorrow, when I have access to the RPi, and then accept (if it works ;-)). However, I fear that with the edited title, people like me who discover that C-/ doesn't work in emacs will not find this solution, unless they already know what the actual issue is...
    – AstroFloyd
    Commented Aug 4, 2019 at 9:52
  • @AstroFloyd On this site, “in Emacs” in the title is redundant and not useful for search engines (having “Emacs” in the site name is good enough for them). I'm happy to move the question to Unix & Linux if it gets close votes here, but I don't think it's off-topic here: you had a problem with Emacs, even though the cause of the problem was outside Emacs. Commented Aug 4, 2019 at 22:03
  • I'm having the same issue, and I'm wondering if it's an issue with the current keyboard configuration? I don't have the issue when connected to the pi over ssh/mosh, but I wonder if the keyboard configuration is the culprit. Commented Sep 20, 2020 at 15:24
  • @charliesneath It's the terminal's keyboard configuration. Also possibly the Emacs configuration, but if Emacs is running in a terminal that doesn't transmit some key combinations or conflates key combinations, Emacs can't do anything about it. Commented Sep 20, 2020 at 17:31
  • On a different (Arch Linux) machine, a missing /etc/vconsole.conf did not default to KEYMAP=us. Creating that file with this content (or running loadkeys us) solved my problem directly.
    – AstroFloyd
    Commented Apr 14, 2021 at 16:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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