From edaf9d966e32b97885b77909277ffcb2a398e792 Mon Sep 17 00:00:00 2001 From: David Florness Date: Sat, 18 Jul 2026 13:50:28 -0400 Subject: [PATCH] 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 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 --- lisp/dev.el | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lisp/dev.el b/lisp/dev.el index 74657cd..7e48de1 100644 --- a/lisp/dev.el +++ b/lisp/dev.el @@ -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 (projectile-known-projects)) -- 2.38.4