Function: hui:bind-key

hui:bind-key is an interactive and byte-compiled function defined in hui.el.

Signature

(hui:bind-key CMD &optional NEW-KEY)

Documentation

Remove existing Hyperbole 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
(defun hui:bind-key (cmd &optional new-key)
  "Remove existing Hyperbole 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:bind-key): Invalid command, `%s'" cmd))
  (let* ((old-key (where-is-internal cmd hyperbole-mode-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 (define-key hyperbole-mode-map new-key cmd)
		   (setq new-key-text (key-description new-key))))
    (if old-key
	(progn (define-key hyperbole-mode-map old-key nil)
	       (message "{%s} now runs `%s'; prior Hyperbole {%s} binding removed" new-key-text cmd old-key-text))
      (message "{%s} now runs `%s'" new-key-text cmd))))