Function: global-kkp-mode
global-kkp-mode is an interactive and natively compiled function
defined in kkp.el.
Signature
(global-kkp-mode &optional ARG)
Documentation
Toggle KKP support in all terminal frames.
This is a global minor mode. If called interactively, toggle the
Global Kkp mode mode. If the prefix argument is positive, enable the
mode, and if it is zero or negative, disable the mode.
If called from Lisp, toggle the mode if ARG is toggle. Enable the
mode if ARG is nil, omitted, or is a positive number. Disable the mode
if ARG is a negative number.
To check whether the minor mode is enabled in the current buffer,
evaluate (default-value \=global-kkp-mode)'.
The mode's hook is called both when the mode is enabled and when it is disabled.
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
;;;###autoload
(define-minor-mode global-kkp-mode
"Toggle KKP support in all terminal frames."
:global t
:lighter nil
:group 'kkp
(cond
(global-kkp-mode
;; if terminal has KKP enabled, it supports symbol names as keys
(advice-add 'display-symbol-keys-p :around #'kkp--display-symbol-keys-p)
;; call setup for future terminals to be opened
(add-hook 'tty-setup-hook #'kkp-enable-in-terminal)
;; call teardown for terminals to be closed
(add-hook 'kill-emacs-hook #'kkp--disable-in-active-terminals)
;; we call this on each frame teardown, this has no effects if kkp is not enabled
(add-to-list 'delete-terminal-functions #'kkp--terminal-teardown)
(add-hook 'suspend-hook #'kkp--suspend-in-terminal)
(add-hook 'suspend-resume-hook #'kkp--resume-in-terminal)
(add-hook 'suspend-tty-functions #'kkp--suspend-in-terminal)
(add-hook 'resume-tty-functions #'kkp--resume-in-terminal)
(advice-add 'delete-frame :before #'kkp--pre-delete-frame)
;; opt-in: let C-g abort blocking call-process calls (see the defcustom)
(when kkp-restore-legacy-keys-around-subprocesses
(advice-add 'call-process :around #'kkp-restore-legacy-keys))
;; this is by far the most reliable method to enable kkp in all associated terminals
;; trying to switch to each terminal with `with-selected-frame' does not work very well
;; as input from `read-event' cannot be reliably read from the corresponding terminal
(add-function :after after-focus-change-function #'kkp-focus-change)
;; forget which terminals were enable-attempted, so focus re-enables them
(dolist (terminal (terminal-list))
(let ((state (kkp--terminal-state terminal)))
(when state
(setf (kkp--state-setup-visited state) nil))))
;; At startup, this global mode might be called before the 'tty-setup-hook'.
;; To avoid running 'kkp-enable-in-terminal' before, we only run it if
;; the 'tty-run-terminal-initialization' already ran.
(when (terminal-parameter (kkp--selected-terminal) 'terminal-initted)
(kkp-enable-in-terminal)))
(t
(advice-remove 'display-symbol-keys-p #'kkp--display-symbol-keys-p)
(kkp--disable-in-active-terminals)
(remove-hook 'tty-setup-hook #'kkp-enable-in-terminal)
(remove-hook 'kill-emacs-hook #'kkp--disable-in-active-terminals)
(remove-hook 'suspend-hook #'kkp--suspend-in-terminal)
(remove-hook 'suspend-resume-hook #'kkp--resume-in-terminal)
(remove-hook 'suspend-tty-functions #'kkp--suspend-in-terminal)
(remove-hook 'resume-tty-functions #'kkp--resume-in-terminal)
(advice-remove 'delete-frame #'kkp--pre-delete-frame)
(advice-remove 'call-process #'kkp-restore-legacy-keys)
(remove-function after-focus-change-function #'kkp-focus-change)
(setq delete-terminal-functions (delete #'kkp--terminal-teardown delete-terminal-functions)))))