diff --git a/core/autoload/help.el b/core/autoload/help.el index 96b918c53..3497d46b6 100644 --- a/core/autoload/help.el +++ b/core/autoload/help.el @@ -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' diff --git a/modules/config/default/config.el b/modules/config/default/config.el index f8e38b9c9..2f29f5940 100644 --- a/modules/config/default/config.el +++ b/modules/config/default/config.el @@ -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