Function: kkp-enable-in-terminal
kkp-enable-in-terminal is an interactive and natively compiled
function defined in kkp.el.
Signature
(kkp-enable-in-terminal &optional (TERMINAL (kkp--selected-terminal)))
Documentation
Try to enable KKP support in Emacs running in the TERMINAL.
Key Bindings
This command is not in any keymaps.
Source Code
;; Defined in /nix/store/0igl9q4k4n87vg4h2gnnrlha21kx9biv-emacs-packages-deps/share/emacs/site-lisp/elpa/kkp-20260706.858/kkp.el
(cl-defun kkp-enable-in-terminal (&optional (terminal (kkp--selected-terminal)))
"Try to enable KKP support in Emacs running in the TERMINAL."
(interactive)
(when
(and
(terminal-live-p terminal)
(not (display-graphic-p terminal)))
(let ((state (kkp--ensure-state terminal)))
(setf (kkp--state-setup-visited state) t)
(cond
((kkp--state-setup-started state)
(kkp--verbose "skipping enable: setup already in progress"))
((kkp--state-enhancements state)
(kkp--verbose "skipping enable: KKP already active in this terminal"))
(t
(kkp--verbose "enabling KKP in terminal...")
;; NOTE: to avoid race conditions, we set the setup-started flag
;; here to not send the query multiple times to the terminal
(setf (kkp--state-setup-started state) t)
;; https://sw.kovidgoyal.net/kitty/keyboard-protocol/#detection-of-support-for-this-protocol
;; query for the current progressive enhancements together with the primary device attributes
(kkp--query-terminal-async "?u\e[c"
'(("\e[?" . kkp--terminal-setup)) terminal))))))