mirror of
https://github.com/doomemacs/doomemacs.git
synced 2025-12-15 23:00:52 -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)
|
(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
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue