From b069e5523ea03ca9c33040681d9844932b5d4da8 Mon Sep 17 00:00:00 2001 From: Thomas Voss Date: Sat, 19 Oct 2024 17:06:25 +0200 Subject: emacs: Support Hyper from QMK --- .config/emacs/modules/mm-keybindings.el | 13 +++++++++++++ 1 file changed, 13 insertions(+) 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 @@ -42,6 +42,19 @@ the first command is remapped to the second command." ,(concat " <" (symbol-name from) ">") #',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 -- cgit v1.2.3