Ever Wanted to Unbind macOS Keybindings in Emacs?
Here's all the keys that get bound in
Emacs.app/Contents/Resources/lisp/term/ns-win.el.gz
I've changed it to be unsetting these keys, because I find them
annoying when I accidentally press them. This gives you more keys to
allow for customization on macOS. You may want to wrap this in a
when
stanza to undefine it only on macOS, but that's up to you.
;;; unset macOS keybindings
(global-unset-key [?\s-,])
(global-unset-key [?\s-'])
(global-unset-key [?\s-`])
(global-unset-key [?\s-~])
(global-unset-key [?\s--])
(global-unset-key [?\s-:])
(global-unset-key [?\s-?])
(global-unset-key [?\s-^])
(global-unset-key [?\s-&])
(global-unset-key [?\s-C])
(global-unset-key [?\s-D])
(global-unset-key [?\s-E])
(global-unset-key [?\s-L])
(global-unset-key [?\s-M])
(global-unset-key [?\s-S])
(global-unset-key [?\s-a])
(global-unset-key [?\s-c])
(global-unset-key [?\s-d])
(global-unset-key [?\s-e])
(global-unset-key [?\s-f])
(global-unset-key [?\s-F])
(global-unset-key [?\s-g])
(global-unset-key [?\s-h])
(global-unset-key [?\s-H])
(global-unset-key [?\M-\s-h])
(global-unset-key [?\s-j])
(global-unset-key [?\s-k])
(global-unset-key [?\s-l])
(global-unset-key [?\s-m])
(global-unset-key [?\s-n])
(global-unset-key [?\s-o])
(global-unset-key [?\s-p])
(global-unset-key [?\s-q])
(global-unset-key [?\s-s])
(global-unset-key [?\s-t])
(global-unset-key [?\s-u])
(global-unset-key [?\s-v])
(global-unset-key [?\s-w])
(global-unset-key [?\s-x])
(global-unset-key [?\s-y])
(global-unset-key [?\s-z])
(global-unset-key [?\s-+])
(global-unset-key [?\s-=])
(global-unset-key [?\s-0])
(global-unset-key [?\s-|])
(global-unset-key [s-kp-bar])
(global-unset-key [?\C-\s- ])
(global-unset-key [s-right])
(global-unset-key [s-left])
(global-unset-key [home])
(global-unset-key [end])
(global-unset-key [kp-home])
(global-unset-key [kp-end])
(global-unset-key [kp-prior])
(global-unset-key [kp-next])
;; Allow shift-clicks to work similarly to under Nextstep.
(global-unset-key [S-down-mouse-1])
;; Special Nextstep-generated events are converted to function keys. Here
;; are the bindings for them. Note, these keys are actually declared in
;; x-setup-function-keys in common-win.
(global-unset-key [ns-power-off])
(global-unset-key [ns-open-file])
(global-unset-key [ns-open-temp-file])
(global-unset-key [ns-open-file-line])
(global-unset-key [ns-spi-service-call])
(global-unset-key [ns-new-frame])
(global-unset-key [ns-toggle-toolbar])
(global-unset-key [ns-show-prefs])