5

I have emacs 25.2 installed on my Mac. Yesterday I updated the OS to High Sierra and the command C-M-<SPC> to highlight s-expressions is not working any more. Can you help me?

Thanks

elena
  • 51
  • 2
  • Emacs 26.0, upgraded to High Sierra, C-M-spc works as expected (calls mark-sexp) – Juancho Nov 20 '17 at 13:04
  • UPDATE: I installed emacs 25.3. the binding still doesn't work but I found that mark-sexp is also bound to C-M-@ and that works – elena Nov 20 '17 at 15:18
  • 1
    I'm having the exact same problem with Emacs for MacOS, on HighSierra. The C-M-g combination works. C-SPC and M-SPC both work. But C-M-SPC seems to not send a signal to the emacs system. Very bizarre. Any ideas here? – Nutritioustim Apr 11 '18 at 00:33
  • Is it gui emacs or emacs -nw? – Maxim Kim Apr 11 '18 at 06:34
  • Esc C-SPC seems to work... – Andrew Swann Apr 12 '18 at 07:45
  • Have you checked whether there are any OS level shortcuts set up? I think you have to look under the keyboard settings and the accessibility section too. (Something keeps turning on a C-SPC shortcut on my Mac.) – Alan Third Apr 12 '18 at 12:59
  • Did you figure it out? – Rahul Apr 12 '18 at 16:23
  • @MaximKim It's Gui Emacs. MacOS 10.13.3 (Emacs 25.3). – Nutritioustim Apr 16 '18 at 04:41
  • @AlanThird I checked the OS level keyboard mappings. And the alt key is sending the correct (alt) modifier signal, as expected. And that works for M-SPC. But for some reason, when I do C-M-SPC, no signal is sent. – Nutritioustim Apr 16 '18 at 04:44
  • What happens when you 1. open emacs with emacs -Q and press C-h k C-M-SPC? – Maxim Kim Apr 16 '18 at 14:11
  • 10.15.7 High Sierra, I've tried all the workaround that previously existed but no matter what macOS still gobbles up C-M-SPC. On other apps it brings up the Character Viewer to insert emojis, but Apple really doesn't want you to unbind that keymapping for whatever reason. Even if you change shortcut key for All Applications->Emojis & Symbols (which bring sup the Character Viewer) it still will hog the C-M-SPC keybinding. – cmaceachern Aug 17 '21 at 17:25

1 Answers1

2

I always switched 'option' with 'command' for emacs in OS X.

(setq mac-command-modifier 'meta)
(setq mac-option-modifier 'super)

Given these key bindings in OS X (10.13.4) and Emacs (25.3, installed via homebrew), the C-M-<SPC> works as expected on my mac.

phye
  • 21
  • 3
  • That doesn't work for me. And I don't know why. I'm on MacOS 10.13.3 (Emacs 25.3). I previously had (setq mac-option-modifier 'meta), which worked. Using (setq mac-option-modifier 'super) stops the meta key from working altogether. And again, M-SPC works. But for some reason, when I do C-M-SPC, no signal is sent. Even when setting both mac-command-modifier and mac-option-modifier. – Nutritioustim Apr 16 '18 at 04:48
  • Can you check if emacs can catch your key inputs with c-h k followed by C-M-SPC? If not, it's the OS X that catch the key sequence, then you may need to check which one occupy that key bindings by checking system preferences -> keyboard -> shortcuts. If yes, Emacs is catching the key bindings, you will also know which function has been attached to the key bindings, you can change that keybindings by rebinding the keys via define-key .etc. – phye Apr 17 '18 at 04:24
  • @Nutritioustim, if your Emacs is built with Cocoa, the key modifiers should be ns-alternate-modifier and ns-command-modifier. As is revealed here, mac-modif... might be of interest, but it ought to be true by default. Check also your keyboard settings for the Ctrl-Opt-Space, may be assigned to some other OS command (this is my case, and disabling that command make the C-M- working when I check it with Emacs -Q). – Ian Apr 17 '18 at 12:59
  • @phye Yes, that was it. In system preferences -> keyboard -> shortcuts, C-M-Space was being captured by Input Sources > Select next source in input menu. Cheers. – Nutritioustim Apr 20 '18 at 00:52