If I type C-f paredit-forward-slurp-sexp, Emacs tells me the command is mapped to C-). Yet through C-h k I realized that both C-) and ) run evil-forward-sentence. If I do C-f evil-forward-sentence, Emacs tells me it is bound only to ).

If I evaluate (key-binding (kbd "C-)")) the result is paredit-forward-slurp-sexp. If I go through what describe-bindings prints, C-) is shown as associated with paredit-forward-slurp-sexp, There are other paredit associations in the listing, like M-<right arrow>, which works fine.

Why is this and how do I make the C-) behave the way I want.


Evil keymaps override the default global keymaps. To learn more, you may want to read:

If you want to override Evil keys, you'd need to do so to the Evil keymaps themselves:

(define-key evil-insert-state-map (kbd "C-)") #'paredit-forward-slurp-sexp)
(define-key evil-normal-state-map (kbd "C-)") #'paredit-forward-slurp-sexp)
(define-key evil-emacs-state-map (kbd "C-)") #'paredit-forward-slurp-sexp)
  • Evil does not define "C-)". It's that "C-)" gets interpreted the same way ")" does. I added more details to the question. – user7610 Mar 9 '15 at 12:26
  • @user7610 are you using Emacs in a terminal, or graphically? – PythonNut Mar 9 '15 at 16:57
  • You are right! C-) works in the GUI and not in terminal. Do you know why? – user7610 Mar 10 '15 at 9:51
  • 3
    @user7610 Yes. The short of it is that terminals have no way to express C-). They lack the escape codes necessary to convey those keys to Emacs. You'll find that this is true of quite a few keybindings. Most C-S-key combos don't work. (Take C-S-d, which is passed as C-d). Long term, I'd recommend running the GUI version if you possibly can. Vim is a terminal editor that has a graphical mode. Currently, Emacs is a graphical editor that can run in a terminal. – PythonNut Mar 11 '15 at 2:16

As @PythonNut says in the comments below his or her answer, terminals don't have an escape code for C-). It is necessary to either remap to something like M-) or use Emacs GUI.

It can be quickly checked by pressing C-v (outside of Emacs) which makes the terminal print the escape sequence for the shortcut that follows. C-v C-) and C-v ) both print the same escape sequence, which happens to be a literal ).


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.