~edwargix/emacs.d

edaf9d966e32b97885b77909277ffcb2a398e792 — David Florness 2 months ago 0c8e88c
projectile: unbind ESC in command map so C-p C-p works under KKP

With the Kitty Keyboard Protocol enabled (commit 16a7459), terminal
frames send a second C-p as the escape sequence ESC[112;5u rather than a
raw control byte. projectile-command-map binds ESC to
projectile-project-buffers-other-buffer, so `C-p ESC' matched a complete
command and fired before input-decode-map could translate the sequence
back into C-p. The result: `C-p C-p' (projectile-switch-project) never
ran in emacsclient -t frames, and the leftover `[112;5u' spilled into
the buffer / evil ex line.

Escape-sequence keys can serve as continuation keys (that's how C-x <up>
works in a terminal) only when nothing along the way short-circuits on a
complete binding. Dropping the ESC binding removes that short-circuit,
letting the sequence decode normally so `C-p C-p' resolves as it does in
GUI frames. `C-p p' already worked and is unaffected.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 files changed, 7 insertions(+), 0 deletions(-)

M lisp/dev.el
M lisp/dev.el => lisp/dev.el +7 -0
@@ 55,6 55,13 @@
        ("C-p C-p" . projectile-switch-project))
  :config
  (projectile-mode)
  ;; In terminal frames with the Kitty Keyboard Protocol active, a second C-p
  ;; arrives as the escape sequence ESC[112;5u.  projectile binds ESC in this
  ;; map (projectile-project-buffers-other-buffer), so `C-p ESC' matches a
  ;; complete command and fires before `input-decode-map' can translate the
  ;; sequence back into C-p -- breaking `C-p C-p' and spilling the rest into
  ;; the buffer.  Drop the ESC binding so the sequence decodes normally.
  (define-key projectile-command-map (kbd "ESC") nil)
  ;; Alternative to <https://github.com/ericdanan/counsel-projectile/pull/190>
  (projectile-known-projects))