1

I am using emacs26.3 with the major mode "Javascript-IDE" activated. When I type M-x comment-line the desired effects happen in the editor. However, when I type the shortcut C-x C-; I have this output:

Comment column set to 2

And the line is not commented/uncommented. C-h b shows that is the key binding is correct. Here is my emacs configuration: https://github.com/Amine27/dotfiles/blob/master/emacs.el

Drew
  • 29,895
  • 7
  • 74
  • 104
Amine27
  • 83
  • 1
  • 7
  • According to your output you are pressing key only for the 'x' and forgetting to press it again for the ';' – Pedro Ferreira Dec 23 '20 at 14:36
  • From here: https://www.gnu.org/software/emacs/manual/html_node/emacs/Comment-Commands.html you can see that: C-x ; is Set comment column (comment-set-column). – Pedro Ferreira Dec 23 '20 at 14:37
  • @PedroFerreira I am sure that I am pressing two times! Interestly, `C-x ;` and `C-x C-;` give me the same output (the result of comment-set-column). – Amine27 Dec 23 '20 at 15:50
  • Can it be a keyboard issue? Try using left or right keys to see if it changes anything. – Pedro Ferreira Dec 23 '20 at 16:30
  • I dont think so, I can press `C-x C-f` for example without problem. – Amine27 Dec 23 '20 at 19:54

1 Answers1

2

Are you using emacs in a terminal? A terminal cannot transmit all combinations of keys and modifiers you could press. I can reproduce this behavior when I run emacs in my terminal (pressing C-; just produces an ordinary ;), but when run in my OS's windowing system emacs registers the C-; chord as desired.

amalloy
  • 89,153
  • 8
  • 140
  • 205
  • Yes, I am using emacs in a terminal. However, I can press all command (`C-x C-f` for example) without problem, only `C-x C-;` gives a weird behavior! – Amine27 Dec 23 '20 at 19:55
  • Yes, as I said a terminal cannot handle all combinations of keys. ASCII has room for control key sequences for letters, but not every punctuation mark. You will have similar problems if you try to send, say, `C-C` instead of `C-c` - the protocol terminals use just doesn't have a way to describe that key combo. – amalloy Dec 23 '20 at 20:37
  • You are right, I changed the key binding, and now it works just fine. – Amine27 Dec 23 '20 at 21:12