Function: hui:global-bind-key
hui:global-bind-key is an interactive and byte-compiled function
defined in hui.el.
Signature
(hui:global-bind-key CMD &optional NEW-KEY)
Documentation
Remove existing global key binding for CMD, rebind it to optional NEW-KEY.
If NEW-KEY is not provided, prompt for it. Display a message confirming the binding.
Key Bindings
Source Code
;; Defined in ~/.emacs.d/elpa/hyperbole-20260414.325/hui.el
;;; ************************************************************************
;;; Public functions
;;; ************************************************************************
(defun hui:global-bind-key (cmd &optional new-key)
"Remove existing global key binding for CMD, rebind it to optional NEW-KEY.
If NEW-KEY is not provided, prompt for it. Display a message confirming
the binding."
(interactive "CCommand to change key binding of: \nKNew key to bind: ")
(if (not (functionp cmd))
(error "(hui:global-bind-key): Invalid command, `%s'" cmd))
(let* ((old-key (where-is-internal cmd (current-global-map) t))
;; Force multi-character key sequences to echo in the minibuffer
(echo-keystrokes 1)
old-key-text
new-key-text)
(when old-key (setq old-key-text (key-description old-key)))
(when (null new-key)
(setq new-key
(with-selected-window (minibuffer-window)
(read-key-sequence
(if old-key
(format "{%s} runs `%s'; change it to key: " old-key-text cmd)
(format "New key to run `%s': " cmd))))))
(cond ((equal new-key (kbd "\C-g"))
(keyboard-quit))
(new-key (global-set-key new-key cmd)
(setq new-key-text (key-description new-key))))
(if old-key
(progn (global-unset-key old-key)
(message "{%s} now runs `%s'; prior global {%s} binding removed" new-key-text cmd old-key-text))
(message "{%s} now runs `%s'" new-key-text cmd))))