I'm on Prelude, and there is no way I can type a \. I was thinking maybe I should create a keybinding but I don't know how to create it to output a character such as \. Any help welcome! Thank you!

  • 1
    What does C-h k \ tell you?
    – phils
    May 5 '20 at 13:31
  • 1
    What is Prelude? Why is there no way to type a `\`? Do not expect other people to know what you are talking about just because you can see it: please explain.
    – NickD
    May 5 '20 at 13:49
  • Do you see the same thing when you start Emacs using emacs -Q (no init file)? If not, bisect your init file to find the culprit.
    – Drew
    May 5 '20 at 18:20

Emacs by default doesn't associate \ with any command… You should be able to directly type it without any trouble. If you cannot, then you should have a module enabled, which takes it.

If you need further help, please answer the following questions:

  • are you using emacs in terminal (in a TTY?) or in graphical mode?
  • where do you want to type a backslash? In a document body, in the minibuffer, elsewhere?
  • as @phils asks, what does C-h k \ give you?
  • what is your keyboard layout?
  • To be more precise, most keys are bound to self-insert-command, which is the command that inserts the key you pressed into the buffer.
    – db48x
    May 5 '20 at 23:00
  • Apologies. I managed to find the keyboard binding for that \. Apparently I needed the RIGHT Alt key, not the left one (even though in the Mac Kayboard layout both are giving the backslash). When I type C-h k \ I get "\ runs the command org-self-insert-command (found in org-mode-map), which is an interactive compiled Lisp function in ‘org-9.3.6/org.el’. It is bound to SPC..~, ..\377. (org-self-insert-command N). " May 6 '20 at 18:22

As a work-around you can try C-q \. Try Étienne Deparis answer for a permanent resolution.

  • I did not get how to get \ if I can type it :P May 6 '20 at 18:21
  • Do you not have a \ key on your keyboard then? May 6 '20 at 22:59
  • I resolved this issue. My keyboard produces it outside Emacs when pressing SHIFT+ALT(left or right)+7. I always use ALT(left). Since it did not work in Emacs, I thought something was wrong. Apparently some other keybinding is associated with that combo, but using ALT(right) works. May 8 '20 at 3:30
  • I've never encountered such a keyboard. May 8 '20 at 20:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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