Function: keymap-global-lookup

keymap-global-lookup is an interactive and byte-compiled function defined in keymap.el.gz.

Signature

(keymap-global-lookup KEYS &optional ACCEPT-DEFAULT MESSAGE)

Documentation

Return the binding for command KEYS in current global keymap only.

KEY is a string that satisfies key-valid-p.

The binding is probably a symbol with a function definition. This function's return values are the same as those of keymap-lookup
(which see).

If optional argument ACCEPT-DEFAULT is non-nil, recognize default bindings; see the description of keymap-lookup for more details about this.

If MESSAGE (and interactively), message the result.

View in manual

Probably introduced at or before Emacs version 29.1.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/keymap.el.gz
(defun keymap-global-lookup (keys &optional accept-default message)
  "Return the binding for command KEYS in current global keymap only.
KEY is a string that satisfies `key-valid-p'.

The binding is probably a symbol with a function definition.
This function's return values are the same as those of `keymap-lookup'
\(which see).

If optional argument ACCEPT-DEFAULT is non-nil, recognize default
bindings; see the description of `keymap-lookup' for more details
about this.

If MESSAGE (and interactively), message the result."
  (declare (compiler-macro (lambda (form) (keymap--compile-check keys) form)))
  (interactive
   (list (key-description (read-key-sequence "Look up key in global keymap: "))
         nil t))
  (let ((def (keymap-lookup (current-global-map) keys accept-default)))
    (when message
      (message "%s is bound to %s globally" keys def))
    def))