summaryrefslogtreecommitdiff
path: root/.config/emacs
diff options
context:
space:
mode:
authorThomas Voss <mail@thomasvoss.com> 2024-10-19 17:06:25 +0200
committerThomas Voss <mail@thomasvoss.com> 2024-10-19 17:06:25 +0200
commitb069e5523ea03ca9c33040681d9844932b5d4da8 (patch)
tree7753299ef5cda5e1d68b3546b4c240392ebca301 /.config/emacs
parentb3bd08a2c380e146a2742571147796b0cfec8bea (diff)
emacs: Support Hyper from QMK
Diffstat (limited to '.config/emacs')
-rw-r--r--.config/emacs/modules/mm-keybindings.el13
1 files changed, 13 insertions, 0 deletions
diff --git a/.config/emacs/modules/mm-keybindings.el b/.config/emacs/modules/mm-keybindings.el
index e3df839..dc49261 100644
--- a/.config/emacs/modules/mm-keybindings.el
+++ b/.config/emacs/modules/mm-keybindings.el
@@ -43,6 +43,19 @@ the first command is remapped to the second command."
#',to))))
+;;; Support QMK Hyper
+
+(defun mm-qmk-hyper-as-hyper (args)
+ (let ((chord (cadr args)))
+ (when (string-prefix-p "H-" chord)
+ (setf (cadr args) (concat "C-M-s" (substring chord 1)))))
+ args)
+
+;; Both ‘keymap-global-set’ and ‘keymap-local-set’ call ‘keymap-set’
+;; internally, so this advice covers all cases
+(advice-add #'keymap-set :filter-args #'mm-qmk-hyper-as-hyper)
+
+
;;; Disable ESC as Meta
(keymap-global-set "<escape>" #'ignore)