1

In some cases operating system shortcuts takes precedence and in other cases emacs shortcuts takes precedence. what's the reason for this kind of behaviour?

Eg:

(Mojave shortcut) Command + shift + 5, screenshot utility take precedence over (Emacs shortcut) M-% (Command + shift + 5, query replace) when using emacs

(Emacs shortcut) C-M-f forward-sexp takes precedence over (Mojave shortcut) Control + Shift + F full screen when using emacs

Expected behaviour : Emacs shortcuts precedes when using emacs (could you provide solution for this)

Emacs version: 26.1 on macOS Mojave

  • 2
    As long as you use emacs under an operating system, you'll find out that the OS has precedence over application key bindings. I have not yet upgraded to Mohave, but I doubt Control-Shift-F is an OS level shortcut in Mohave, it certainly is not in High Sierra. Each application needs to define its fullscreen shortcut in Mac OSX. A common solution to your first problem is: (defalias 'qrr 'query-replace-regexp) – Heikki Oct 7 '18 at 9:27
  • thanks, the qrr trick is helpful. just curious.. is there a way to know whether keybinding is os level or applicaiton level? – junnu Oct 7 '18 at 16:09
  • Only trial and error – Heikki Oct 8 '18 at 4:29
  • Note you can use ESC prefix instead of the command/meta key in such combinations, so M-% is also ESC %. On mac I rebind the caps lock (that I never use as such) to Escape, see the mac's `System Preferences > Keyboard > Keyboard" which has a "modifier keys" button at the bottom right that brings up a menu you can use to make this change. – Andrew Swann Oct 8 '18 at 6:47
3

I know very little about OSX, so I can't help specifically, but speaking generally...

You solve such conflicts by making changes outside of Emacs so that those key sequences are not captured before Emacs sees them.

How you do that varies from system to system. Often it's the window manager which is responsible, and so the solution can vary according to the particular window manager being used.

In any case, if a key sequence is being captured before Emacs sees it, then there's nothing you can configure in Emacs to change that, so this isn't really an Emacs question as such. (That said, some common problems and solutions may be quite Emacs-centric, so I think the question is ok to ask here.)

0

An alternative way to solve this problem:

In System preference - Keyboard - Shortcuts - Screenshots, modify the shortcut of the screenshot. For example, I bind the screenshot to Command+Shift+6.

  • 1
    This is really just a comment on phils answer. – Andrew Swann Nov 19 '18 at 14:50

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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