Function: kkp-setup-function-keys

kkp-setup-function-keys is a natively compiled function defined in kkp.el.

Signature

(kkp-setup-function-keys TERMINAL)

Documentation

Activate alternative keypad mappings in TERMINAL.

This function updates the `local-function-key-map` of the first frame on TERMINAL’s display, reparenting it to `kkp-alternatives-map`. This remapping causes certain keys, such as [M-backspace], to be interpreted like ASCII characters (e.g., [?\x3FFFDCd]). Once set, the function-keys-set flag in the terminal's kkp--state is set to avoid repeated setup.

Source Code

;; Defined in /nix/store/0igl9q4k4n87vg4h2gnnrlha21kx9biv-emacs-packages-deps/share/emacs/site-lisp/elpa/kkp-20260706.858/kkp.el
;; NOTE this is a copy of the x-setup-function-keys function
(defun kkp-setup-function-keys (terminal)
  "Activate alternative keypad mappings in TERMINAL.
This function updates the `local-function-key-map` of the first frame on
TERMINAL’s display, reparenting it to `kkp-alternatives-map`. This remapping
causes certain keys, such as [M-backspace], to be interpreted like ASCII
characters (e.g., [?\M-\\d]). Once set, the `function-keys-set' flag in the
terminal's `kkp--state' is set to avoid repeated setup."
  (let ((frame (car (frames-on-display-list terminal)))
        (state (kkp--ensure-state terminal)))
    (unless (kkp--state-function-keys-set state)
      ;; Map certain keypad keys into ASCII characters that people usually expect.
      (with-selected-frame frame
        (set-keymap-parent kkp-alternatives-map (keymap-parent local-function-key-map))
        (set-keymap-parent local-function-key-map kkp-alternatives-map)))
    (setf (kkp--state-function-keys-set state) t)))