Fix #4421: masquerade doom/escape as keyboard-quit

Or abort-recursive-edit, depending. Some other packages/commands listen
for these two (like undo-fu), and by remapping C-g we break those.
This commit is contained in:
Henrik Lissner 2020-12-12 22:54:48 -05:00
parent eea4709354
commit 5d3496575c
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -77,13 +77,15 @@ all hooks after it are ignored.")
(interactive) (interactive)
(cond ((minibuffer-window-active-p (minibuffer-window)) (cond ((minibuffer-window-active-p (minibuffer-window))
;; quit the minibuffer if open. ;; quit the minibuffer if open.
(setq this-command 'abort-recursive-edit)
(abort-recursive-edit)) (abort-recursive-edit))
;; Run all escape hooks. If any returns non-nil, then stop there. ;; Run all escape hooks. If any returns non-nil, then stop there.
((run-hook-with-args-until-success 'doom-escape-hook)) ((run-hook-with-args-until-success 'doom-escape-hook))
;; don't abort macros ;; don't abort macros
((or defining-kbd-macro executing-kbd-macro) nil) ((or defining-kbd-macro executing-kbd-macro) nil)
;; Back to the default ;; Back to the default
((keyboard-quit)))) ((setq this-command 'keyboard-quit)
(keyboard-quit))))
(global-set-key [remap keyboard-quit] #'doom/escape) (global-set-key [remap keyboard-quit] #'doom/escape)