1

I have been comfortably using Emacs in MacOS 13.4.1 (M1 architecture) for a while. However, a few days ago, using the default keybinding of C-SPC for set-mark-command simply stopped working. Same for C-M-SPC which is associated to mark-sexp. Interestingly, other commands such as M-h for mark-paragraph still work as expected.

This is my Emacs init file and as shown in the git log, the file has been stable for a few months. As you see, I have packages that help display which keybinding is associated with each command:

enter image description here

According to Ivy's buffer, C-SPC has not been changed. Thus, I really do not know why this keybinding stopped working.

I can still use the command. But, to do it, I need to invoke M-x and then type the command name which reduces my productivity.

Here are the steps I have tried as part of my debugging effort, but unfortunately, they did not work:

  1. Re-starting Emacs
  2. Re-starting the computer
  3. Tried opening default Emacs (without loading my init file with ➜ emacs -q )
  4. Tried using the native Macbook keyboard (instead of my keychron 2)
  5. Tried using Emacs without Karabiner Elements running in the background. I am a heavy user of Karabiner and it could affect keybindings.
  6. I tried invoking C-h k. After executing the command, the mini-buffer asks for Press key:". Even though I press C-SPC`, Emacs does not acknowledge it. It behaves as if it was waiting for me to press or finish pressing something.

The problem seems to be related to commands that use the SPC (space) key.

As a side note, the problem seems to have appeared after I added "US" as another input source on my MacOS keyboard settings. I already had "Brazilian ABNT 2" as one. Not 100% sure on the chronology of the events.

Since it was just an experiment, I added the US input source and, right after, I removed it, restoring the settings to the previous state (only Brazilian input). Not sure if this permanently affected something. This is what I have now:

enter image description here

Any suggestion on how to debug and/or solve this?

5
  • 1
    You always have to debug these things by using C-h k to ask Emacs what is bound to the key sequence of interest. Can you add the output to your question?
    – db48x
    Jun 23, 2023 at 15:34
  • 1
    Thanks, @db48x. I actually tried that. I just forgot to mention. Now, it is included. Jun 23, 2023 at 16:04
  • 1
    DO NOT provide an entire .emacs file unless it's short enough. Why not cut out the code snippets that are obviously irrelevant?
    – shynur
    Jun 23, 2023 at 16:06
  • Well, to be honest @shynur I posted the emacs file for reproducibility standards. But, the problem does not seem to be related considering that (i) the problem persists even without the config file and (ii) I did not use to have a problem until very recently and the config file has been the same for several months. Jun 23, 2023 at 16:10
  • 1
    Your desktop environment is intercepting C-SPC and it never gets to Emacs.Check the keyboard shortcuts section of the desktop settings (however you do that on MacOS).
    – NickD
    Jun 23, 2023 at 17:28

2 Answers 2

2

Even though I press C-SPC, Emacs does not acknowledge it. It behaves as if it was waiting for me to press or finish pressing something.

This is the key. Your OS is treating this key sequence in some special way, either to activate a feature like an IME or as a keyboard shortcut of some kind. Either way, it never sends the key to Emacs. This isn’t an Emacs problem at all; you need to consult the documentation for your OS.

2

@NickD and @db48x helped me realize that the problem was outside of Emacs. The problem was in macOS.

My suspicion is that after tweaking the input source (by removing "Brazilian ABNT" and then re-introducing it), the keyboard shortcut settings were restored to default.

So, it was necessary to go there and turn off the following options:

enter image description here

Thank you.

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.