I wonder how the "Pass Command/Control To System" options (mac-pass-command/control-to-system) are supposed to work? In my case I would like to have Ctrl-space and Cmd-space bound in the macOS system keyboard settings (the macOS default bindings to switch keyboards and for spotlight search) but have them overridden in Emacs (among others, to be able to use the default Emacs bindings [C-space] for set-mark).

Even if I have the above two options set to nil (I have mac-command-modifier set to control, so I am actually hitting Cmd-space) a [C-SPC] keyboard event seems to be passed directly to macOS triggering a spotligt search instead of Emacs set-mark. (Unless I unbind the key in the macOS system settings, in which case it works.)

Is this a bug or some intended behavior? I vaguely recall that I had this working in previous version of Mac Emacs.

I am running a modified version of Emacs known as "Emacs Mac Port":   GNU Emacs 26.1 (build 1, x86_64-apple-darwin13.4.0, Carbon Version 157 AppKit 1265.21) of 2018-05-30". Here is a link to the source code: https://github.com/fgeller/emacs-mac-port

mac-pass-command-to-system is defined in macterm.c and its doc-string is:  "Non-nil if command key presses are passed on to the Mac Toolbox."

mac-pass-control-to-system is defined in macterm.c and its doc-string is: "Non-nil if control key presses are passed on to the Mac Toolbox."

  • Although I don't use Emacs Mac Port, I have updated the question above with a link to the source code and information from the doc-strings for both variables. The O.P. can type C-h v aka M-x describe-variable to read the doc-strings; whereas, I had grep the source code that I downloaded from Github to extract that information. – lawlist Jul 4 '18 at 17:34
  • Yes, I have both the above variables set to nil but I still get the behavior described above. – tgerdin Jul 5 '18 at 20:00
  • @lawlist The code at the link you gave is rather old. I think the original code that is maintained at least until 2018 is that one of Yamamoto Mitsuharu on bitbucket. Nevertheless at ycombinator there is a news saying that one should actually use brew tap railwaycat/emacsmacport && brew install emacs-mac. – Tobias Jul 5 '18 at 23:36

I contacted the author of the Mac Carbon port (Mitsuharu YAMAMOTO) and he concluded that for the two keybindings in question it is not possible for Emacs to override these regardless of the value of the above options. Too bad.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.