aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilfred Hughes <me@wilfred.me.uk>2017-09-02 21:50:11 +0100
committerWilfred Hughes <me@wilfred.me.uk>2017-09-02 21:50:11 +0100
commit0998bf11e258914eb12e7082ae0b6f7a03c88864 (patch)
tree927da5eb61877eb8215c25e12442d0703c6dcf35
parent993d540b508aa64b394d70820b954e26b434ffec (diff)
Adding a helpful-callable command
We already have helpful-function, helpful-macro and helpful-command, which are specific. However, describe-function offers both macros and functions, which is useful when reading new code. Provide a clearly named command with this ability. Closes #13
-rw-r--r--CHANGELOG.md4
-rw-r--r--helpful.el10
2 files changed, 14 insertions, 0 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index d9766ea..0d10af5 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -9,6 +9,10 @@ equivalent defun forms.
We now show the value of variables too.
+Added a command `helpful-callable`, which offers both macros and
+functions. This should be a drop-in replacement for
+`describe-function`.
+
# v0.1
First release.
diff --git a/helpful.el b/helpful.el
index fcc1eaa..11e5387 100644
--- a/helpful.el
+++ b/helpful.el
@@ -32,6 +32,7 @@
;; * helpful-function
;; * helpful-command
;; * helpful-macro
+;; * helpful-callable
;; * helpful-variable
;; * helpful-at-point
;;
@@ -707,6 +708,15 @@ For example, \"(some-func FOO &optional BAR)\"."
(switch-to-buffer (helpful--buffer symbol t))
(helpful-update))
+(defun helpful-callable (symbol)
+ "Show help for function or macro named SYMBOL.
+
+See also `helpful-macro' and `helpful-function'."
+ (interactive
+ (list (helpful--read-symbol "Function/macro: " #'fboundp)))
+ (switch-to-buffer (helpful--buffer symbol t))
+ (helpful-update))
+
(defun helpful--variable-p (symbol)
"Return non-nil if SYMBOL is a variable."
(or (get symbol 'variable-documentation)