aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorJuri Linkov2020-03-06 02:27:32 +0200
committerJuri Linkov2020-03-06 02:27:32 +0200
commit7e8b8da9e30c8b3dcb2f7740406358e00a1a42f8 (patch)
treef39e2ef2ec1d401888183199fc00dc57255e66d4 /lisp
parent32261ed15bc4fb7b9d2cf955286aa21562d2fc8e (diff)
downloademacs-7e8b8da9e30c8b3dcb2f7740406358e00a1a42f8.tar.gz
emacs-7e8b8da9e30c8b3dcb2f7740406358e00a1a42f8.zip
Fix handling of empty input in describe-variable and describe-symbol
* lisp/help-fns.el (describe-variable): Use 'user-error' like in 'describe-function'. (describe-symbol): Use empty string for arg SYMBOL when input is empty and there is no default value. This allows to signal the error "You didn't specify a function or variable" instead of displaying help about the symbol 'nil' on empty input. OTOH, still allows to see help about 'nil' when the input is "nil".
Diffstat (limited to 'lisp')
-rw-r--r--lisp/help-fns.el4
1 files changed, 2 insertions, 2 deletions
diff --git a/lisp/help-fns.el b/lisp/help-fns.el
index 59eedb5331d..cc00c722ccc 100644
--- a/lisp/help-fns.el
+++ b/lisp/help-fns.el
@@ -944,7 +944,7 @@ it is displayed along with the global value."
944 (unless (buffer-live-p buffer) (setq buffer (current-buffer))) 944 (unless (buffer-live-p buffer) (setq buffer (current-buffer)))
945 (unless (frame-live-p frame) (setq frame (selected-frame))) 945 (unless (frame-live-p frame) (setq frame (selected-frame)))
946 (if (not (symbolp variable)) 946 (if (not (symbolp variable))
947 (message "You did not specify a variable") 947 (user-error "You didn't specify a variable")
948 (save-excursion 948 (save-excursion
949 (let ((valvoid (not (with-current-buffer buffer (boundp variable)))) 949 (let ((valvoid (not (with-current-buffer buffer (boundp variable))))
950 val val-start-pos locus) 950 val val-start-pos locus)
@@ -1435,7 +1435,7 @@ current buffer and the selected frame, respectively."
1435 t nil nil 1435 t nil nil
1436 (if found (symbol-name v-or-f))))) 1436 (if found (symbol-name v-or-f)))))
1437 (list (if (equal val "") 1437 (list (if (equal val "")
1438 v-or-f (intern val))))) 1438 (or v-or-f "") (intern val)))))
1439 (if (not (symbolp symbol)) 1439 (if (not (symbolp symbol))
1440 (user-error "You didn't specify a function or variable")) 1440 (user-error "You didn't specify a function or variable"))
1441 (unless (buffer-live-p buffer) (setq buffer (current-buffer))) 1441 (unless (buffer-live-p buffer) (setq buffer (current-buffer)))