feat(lib): introduce doom/describe-char

A version of describe-char that, when given a prefix arg, will prompt
the user to click where to execute the command (so you can read
text-properties/overlay information for otherwise unselectable text, in
the minibuffer or special UIs).
This commit is contained in:
Henrik Lissner
2025-04-24 04:04:49 -04:00
parent 1681bfbaf0
commit 303dd28db8
2 changed files with 19 additions and 1 deletions

View File

@ -102,6 +102,24 @@ selection of all minor-modes, active or not."
(funcall (or (command-remapping fn) fn)
symbol)))
(defun doom/describe-char (event)
"Like `describe-char', but will operate at mouse point if given prefix arg."
(interactive
(list (if current-prefix-arg
(save-window-excursion
(message "Click what to describe...")
(or (when-let ((evt (read--potential-mouse-event)))
;; Discard mouse release event
(read--potential-mouse-event)
(cadr evt))
(user-error "Aborted")))
(point))))
(if (integerp event)
(describe-char event)
(when event
(with-selected-window (posn-window event)
(describe-char (posn-point event))))))
;;
;;; Documentation commands

View File

@ -369,7 +369,7 @@ Continues comments if executed from a commented line."
;; universal.
(define-key! help-map
;; new keybinds
"'" #'describe-char
"'" #'doom/describe-char
"u" #'doom/help-autodefs
"E" #'doom/sandbox
"M" #'doom/describe-active-minor-mode