Search code examples
emacskeyboard-shortcutshaskell-mode

Some shortcuts don't work on emacs beginning with C-c


In Haskell-mode, the shortcut C-c C-= is defined to do something.

Trying this shortcut, I realized that emacs do not recognize the shortcut C-c C-=.

Indeed, when I try the shortcut on emacs, the buffer write C-c = is not defined although I pressed C- C-=. I have the same problem with some other symbols like '.' or '§'. But shortcuts like C-c C-l or C-c C-c work.

I try to remove my .emacs but I have the same problem.

a friend have the same problem as me.

Both we are on ArchLinux (64 bits) and we use emacs in console. The keyboard is an azerty.

The problem come from emacs ? Arch Linux ?


Solution

  • Your terminal can't send Emacs C-= so you can't use that key sequence. (Emacs would recognise it if it received it, but that won't happen.)

    Your options are:

    • Run GUI Emacs.
    • Use M-x name-of-command RET (for whatever command is bound to the key sequence you're not able to use). Use C-hm to see the major mode's bindings, or C-hb to see all current bindings, in order to learn what those command names are.
    • Create new custom keybindings for the commands in question (i.e. bindings which your terminal can send to Emacs).
    • Find a different terminal emulator with enhanced key sequence abilities. The vast majority of them will be no better than what you have, because they're all adhering to the limitations of the terminals they're emulating. The most capable one I know of is http://invisible-island.net/xterm/xterm.html but you may need to compile it yourself, and then expect to spend lots of time configuring it. (It's not a trivial solution, though, and xterm requires a GUI environment, so running GUI Emacs is much simpler.)
    • Use C-x@c<key> instead of C-<key>.

    With that last option, you can use a sequence your terminal can send to fake a sequence that it can't send.
    C-cC-= would become C-cC-x@c=

    If you really wanted to use that last option, you can set a custom binding to simplify the sequence (may be necessary in some instances to avoid conflicting with existing sequences). See the end of https://stackoverflow.com/a/24804434/324105 for more information.