1

I work in emacs 27.1, Ubuntu 22, Terminal.

I need to comment out a block. I press Ctrl+XCtrl+;. However, the ; button is not accepted properly. It only makes an underlined e appear (only on screen, not the actual buffer).

enter image description here

Typing Ctrl+hkCtrl+XCtrl+; gives the following information:

enter image description here

Opening nano and typing Ctrl+; I get an underline e:

enter image description here

I removed the iBus key binding using ibus-setup as explained in Ctrl+Shift+e key conflict in Fedora

After selecting lines and pressing Ctrl+XCtrl+;, now I get a different message Comment column set to 0:

enter image description here

enter image description here

From the output of Ctrl+hkCtrl+XCtrl+; it appears that the third Ctrl is not picked up:

enter image description here

What is wrong?

9
  • Please tell us what happens (ie., what message you see) when you type :Ctrl + h k Ctrl +x Ctrl+ ;
    – Tyler
    May 26, 2023 at 15:54
  • Is this terminal Emacs or GUI Emacs?
    – NickD
    May 26, 2023 at 17:24
  • 1
    That means Emacs isn't receiving the key C-;, it's getting instead. I suspect your operating system is automatically translating C-;. Can you tell us what OS you are using, and if you are running emacs in a terminal, what terminal program?
    – Tyler
    May 26, 2023 at 18:15
  • 1
  • 1
    Does this answer your question? Problems with keybindings when using terminal
    – phils
    Oct 30, 2023 at 23:17

1 Answer 1

2

When a keypress/key combo doesn't do what you expect, the first thing to check is if the keys you pressed are actually the keys that Emacs received.

To do this, try:

  • C-h k, to start searching help (C-h) for keys (k)
  • C-x C-; to find the help for this particular key combo.

What we expect to see is:

C-x C-; runs the command comment-line (found in global-map), which is an interactive native-compiled Lisp function in ‘newcomment.el’.

Things to check:

  • are the keys listed (C-x C-;) the ones you pressed? If not, something at the operating system level, or in your terminal program if you're running Emacs in terminal mode, is translating the key presses into something else, and you'll have to fix that outside of Emacs
  • is the listed command (comment-line) the command you expect? If not, there's a problem with your keybindings, or maybe you aren't in the major- or minor-mode you thought you were
  • is the command not doing what you thought it would? In that case, check the help for the command, or the package, to see if you misunderstood it, or if there's a bug.
7
  • It seems that the second Ctrl is not picked up. See updated question.
    – Viesturs
    Jun 2, 2023 at 13:04
  • 1
    I think this might be an issue with the terminal. C-; is not a recognized ASCII, which means the terminal only recognizes it as ;. This isn't an issue with GUI Emacs. I'm not sure if this can be fixed in Terminal, or how.
    – Tyler
    Jun 2, 2023 at 13:27
  • 1
    unix.stackexchange.com/q/161719/6096
    – Tyler
    Jun 2, 2023 at 13:28
  • From unix.stackexchange.com/q/161719/6096 if understand that using C+; is hopeless. Can I assign another keybinding to commenting out a block?
    – Viesturs
    Jun 2, 2023 at 14:06

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.