aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilfred Hughes <me@wilfred.me.uk>2017-08-26 20:49:55 +0100
committerWilfred Hughes <me@wilfred.me.uk>2017-08-26 20:49:55 +0100
commit23f5d27619540bf7b8ffa09a1f81d387d7e4eef0 (patch)
tree759a0a880d670daf11c94f3f6f4f5db788e33650
parentca6ae0dfdbbde86cdcc7cafb228377adfed0ac29 (diff)
Don't offer nil or t as variables
-rw-r--r--helpful.el12
1 files changed, 8 insertions, 4 deletions
diff --git a/helpful.el b/helpful.el
index e96c0f6..ab48d6d 100644
--- a/helpful.el
+++ b/helpful.el
@@ -650,15 +650,19 @@ For example, \"(some-func FOO &optional BAR)\"."
(switch-to-buffer (helpful--buffer symbol t))
(helpful-update))
-;; ;; checking if something is a variable.
-;; (or (get vv 'variable-documentation)
-;; (and (boundp vv) (not (keywordp vv))))
+(defun helpful--variable-p (symbol)
+ "Return non-nil if SYMBOL is a variable."
+ (or (get symbol 'variable-documentation)
+ (and (boundp symbol)
+ (not (keywordp symbol))
+ (not (eq symbol nil))
+ (not (eq symbol t)))))
;;;###autoload
(defun helpful-variable (symbol)
"Show help for variable named SYMBOL."
(interactive
- (list (helpful--read-symbol "Variable:" #'boundp)))
+ (list (helpful--read-symbol "Variable:" #'helpful--variable-p)))
(switch-to-buffer (helpful--buffer symbol nil))
(helpful-update))