mirror of
https://github.com/doomemacs/doomemacs
synced 2025-08-01 12:17:25 -05:00
fix: TAB & RET keybinds in daemon sessions
`input-decode-map`s bindings are terminal-local and are memoized at an
indeterminable time by `read-key-sequence`, rendering that
`display-graphic-p` check stale by the first client frame and these
TAB/RET fixes unavailable to daemon users.
Amend: 538ddf5e66
Fix: #8269
Close: #8303
This commit is contained in:
committed by
Henrik Lissner
parent
960b537cf6
commit
0e5768064c
@ -57,6 +57,7 @@ and Emacs states, and for non-evil users.")
|
||||
;; "<tab>" and "<return>"), which are only triggered in GUI frames, so here, I
|
||||
;; create one for C-i. Won't work in TTY frames, though. Doom's :os tty module
|
||||
;; has a workaround for that though.
|
||||
(defun doom-init-input-decode-map-h ()
|
||||
(pcase-dolist (`(,key ,fallback . ,events)
|
||||
'(([C-i] [?\C-i] tab kp-tab)
|
||||
([C-m] [?\C-m] return kp-return)))
|
||||
@ -67,12 +68,18 @@ and Emacs states, and for non-evil users.")
|
||||
(not (cl-loop for event in events
|
||||
if (cl-position event keys)
|
||||
return t))
|
||||
;; Use FALLBACK if nothing is bound to KEY, otherwise we've
|
||||
;; broken all pre-existing FALLBACK keybinds.
|
||||
;; Use FALLBACK if nothing is bound to KEY, otherwise
|
||||
;; we've broken all pre-existing FALLBACK keybinds.
|
||||
(key-binding
|
||||
(vconcat (if (= 0 (length keys)) [] (cl-subseq keys 0 -1))
|
||||
key) nil t)))
|
||||
key fallback))))
|
||||
key fallback)))))
|
||||
|
||||
;; `input-decode-map' bindings are resolved on first invokation, and are
|
||||
;; frame-local, so they must be rebound on every new frame.
|
||||
(if (daemonp)
|
||||
(add-hook 'server-after-make-frame-hook #'doom-init-input-decode-map-h)
|
||||
(doom-init-input-decode-map-h))
|
||||
|
||||
|
||||
;;
|
||||
|
Reference in New Issue
Block a user