mirror of
https://github.com/doomemacs/doomemacs.git
synced 2025-12-06 02:30:33 -08:00
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:
parent
1681bfbaf0
commit
303dd28db8
2 changed files with 19 additions and 1 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue