Skip to content

Commit

Permalink
Support describing faces using helpful-symbol.
Browse files Browse the repository at this point in the history
Uses the native `describe-face`, possible to switch to a `helpful-face`
command if implemented in the future.
  • Loading branch information
yuhan0 authored and Wilfred committed Aug 8, 2023
1 parent acb3e33 commit 69f2bc0
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions helpful.el
Original file line number Diff line number Diff line change
Expand Up @@ -2735,12 +2735,13 @@ See also `helpful-macro', `helpful-function' and `helpful-command'."
(not (eq symbol t)))))

(defun helpful--bound-p (symbol)
"Return non-nil if SYMBOL is a variable or callable.
"Return non-nil if SYMBOL is a variable, callable, or face.
This differs from `boundp' because we do not consider nil, t
or :foo."
(or (fboundp symbol)
(helpful--variable-p symbol)))
(helpful--variable-p symbol)
(facep symbol)))

(defun helpful--bookmark-jump (bookmark)
"Create and switch to helpful bookmark BOOKMARK."
Expand Down Expand Up @@ -2799,7 +2800,7 @@ calls (helpful-variable SYM) when the key `v' is pressed in the prompt."

;;;###autoload
(defun helpful-symbol (symbol)
"Show help for SYMBOL, a variable, function or macro.
"Show help for SYMBOL, a variable, function, macro, or face.
See also `helpful-callable' and `helpful-variable'."
(interactive
Expand All @@ -2820,6 +2821,12 @@ See also `helpful-callable' and `helpful-variable'."
(push (list #'helpful-callable "[c]allable" ?c) choices))
(when (boundp symbol)
(push (list #'helpful-variable "[v]ariable" ?v) choices))
(when (facep symbol)
(push (list (lambda (face)
(describe-face face)
(funcall helpful-switch-buffer-function (help-buffer)))
"[f]ace" ?f)
choices))
(cond
((null choices)
(user-error "Not bound: %S" symbol))
Expand Down

0 comments on commit 69f2bc0

Please sign in to comment.