refactor!: move helpful from :core to :lang emacs-lisp
BREAKING CHANGE: This moves helpful.el out of core into :lang emacs-lisp. Since most (all) people have this module enabled, this shouldn't make a difference for most people, but if you're one of the few that don't have :lang emacs-lisp enabled, Doom will revert to using Emacs' built-in help.el and describe-* commands. Others can also disable helpful with (package! helpful :disable t) if they prefer Emacs' built-in help system, which wasn't possible before, because it was a core package. This was done as part of an ongoing effort to slim down Doom's core in preparation for v3.
This commit is contained in:
parent
bf9e619533
commit
6671adc687
13 changed files with 127 additions and 116 deletions
|
@ -97,10 +97,10 @@ selection of all minor-modes, active or not."
|
|||
(let ((symbol
|
||||
(cond ((stringp mode) (intern mode))
|
||||
((symbolp mode) mode)
|
||||
((error "Expected a symbol/string, got a %s" (type-of mode))))))
|
||||
(if (fboundp symbol)
|
||||
(helpful-function symbol)
|
||||
(helpful-variable symbol))))
|
||||
((error "Expected a symbol/string, got a %s" (type-of mode)))))
|
||||
(fn (if (fboundp symbol) #'describe-function #'describe-variable)))
|
||||
(funcall (or (command-remapping fn) fn)
|
||||
symbol)))
|
||||
|
||||
|
||||
;;
|
||||
|
@ -414,26 +414,44 @@ 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")))))
|
||||
|
||||
(defun doom--help-variable-p (sym)
|
||||
"TODO"
|
||||
(or (get sym 'variable-documentation)
|
||||
(and (boundp sym)
|
||||
(not (keywordp sym))
|
||||
(not (memq sym '(t nil))))))
|
||||
|
||||
;;;###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')."
|
||||
Unlike `describe-variable' or `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)
|
||||
(custom-variable-p sym)
|
||||
;; 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))
|
||||
(list
|
||||
(intern (completing-read
|
||||
"Custom variable: " obarray
|
||||
(lambda (sym)
|
||||
(and (doom--help-variable-p sym)
|
||||
(custom-variable-p sym)
|
||||
;; 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)))))
|
||||
t nil nil (let ((var (variable-at-point)))
|
||||
;; `variable-at-point' uses 0 rather than nil to
|
||||
;; signify no symbol at point (presumably because 'nil
|
||||
;; is a symbol).
|
||||
(unless (symbolp var)
|
||||
(setq var nil))
|
||||
(when (doom--help-variable-p var)
|
||||
var))))))
|
||||
(funcall (or (command-remapping #'describe-variable)
|
||||
#'describe-variable)
|
||||
var))
|
||||
|
||||
|
||||
;;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue