mirror of
https://github.com/doomemacs/doomemacs
synced 2025-08-01 12:17:25 -05: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:
@ -102,6 +102,24 @@ selection of all minor-modes, active or not."
|
|||||||
(funcall (or (command-remapping fn) fn)
|
(funcall (or (command-remapping fn) fn)
|
||||||
symbol)))
|
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
|
;;; Documentation commands
|
||||||
|
@ -369,7 +369,7 @@ Continues comments if executed from a commented line."
|
|||||||
;; universal.
|
;; universal.
|
||||||
(define-key! help-map
|
(define-key! help-map
|
||||||
;; new keybinds
|
;; new keybinds
|
||||||
"'" #'describe-char
|
"'" #'doom/describe-char
|
||||||
"u" #'doom/help-autodefs
|
"u" #'doom/help-autodefs
|
||||||
"E" #'doom/sandbox
|
"E" #'doom/sandbox
|
||||||
"M" #'doom/describe-active-minor-mode
|
"M" #'doom/describe-active-minor-mode
|
||||||
|
Reference in New Issue
Block a user