Bind {C-h, SPC h} V to doom/help-custom-variable
For looking up custom variables (i.e. variables intended to be customized; defined with defcustom).
This commit is contained in:
parent
da177d58c4
commit
b89929f3f8
2 changed files with 24 additions and 1 deletions
|
@ -379,6 +379,29 @@ current file is in, or d) the module associated with the current major mode (see
|
|||
(doom-project-browse (file-name-directory path)))
|
||||
((user-error "Aborted module lookup")))))
|
||||
|
||||
;;;###autoload
|
||||
(defun doom/help-custom-variable (var)
|
||||
"Look up documentation for a custom variable.
|
||||
|
||||
Unlike `helpful-variable', which casts a wider net that includes internal
|
||||
variables, this only lists variables that exist to be customized (defined with
|
||||
`defcustom')."
|
||||
(interactive
|
||||
(list (helpful--read-symbol
|
||||
"Custom variable: "
|
||||
(helpful--variable-at-point)
|
||||
(lambda (sym)
|
||||
(and (helpful--variable-p sym)
|
||||
(or (get sym 'custom-type)
|
||||
(get sym 'custom-package-version)
|
||||
(get sym 'custom-set))
|
||||
;; Exclude minor mode state variables, which aren't meant to be
|
||||
;; modified directly, but through their associated function.
|
||||
(not (or (and (string-suffix-p "-mode" (symbol-name sym))
|
||||
(fboundp sym))
|
||||
(eq (get sym 'custom-set) 'custom-set-minor-mode))))))))
|
||||
(helpful-variable var))
|
||||
|
||||
|
||||
;;
|
||||
;;; `doom/help-packages'
|
||||
|
|
|
@ -310,7 +310,7 @@ Continues comments if executed from a commented line. Consults
|
|||
"M" #'doom/describe-active-minor-mode
|
||||
"O" #'+lookup/online
|
||||
"T" #'doom/toggle-profiler
|
||||
"V" #'set-variable
|
||||
"V" #'doom/help-custom-variable
|
||||
"W" #'+default/man-or-woman
|
||||
"C-k" #'describe-key-briefly
|
||||
"C-l" #'describe-language-environment
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue