emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 7e8b8da: Fix handling of empty input in describe-variable and des


From: Juri Linkov
Subject: master 7e8b8da: Fix handling of empty input in describe-variable and describe-symbol
Date: Thu, 5 Mar 2020 19:27:39 -0500 (EST)

branch: master
commit 7e8b8da9e30c8b3dcb2f7740406358e00a1a42f8
Author: Juri Linkov <address@hidden>
Commit: Juri Linkov <address@hidden>

    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".
---
 lisp/help-fns.el | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lisp/help-fns.el b/lisp/help-fns.el
index 59eedb5..cc00c72 100644
--- a/lisp/help-fns.el
+++ b/lisp/help-fns.el
@@ -944,7 +944,7 @@ it is displayed along with the global value."
     (unless (buffer-live-p buffer) (setq buffer (current-buffer)))
     (unless (frame-live-p frame) (setq frame (selected-frame)))
     (if (not (symbolp variable))
-       (message "You did not specify a variable")
+       (user-error "You didn't specify a variable")
       (save-excursion
        (let ((valvoid (not (with-current-buffer buffer (boundp variable))))
              val val-start-pos locus)
@@ -1435,7 +1435,7 @@ current buffer and the selected frame, respectively."
                                t nil nil
                                (if found (symbol-name v-or-f)))))
      (list (if (equal val "")
-              v-or-f (intern val)))))
+              (or v-or-f "") (intern val)))))
   (if (not (symbolp symbol))
       (user-error "You didn't specify a function or variable"))
   (unless (buffer-live-p buffer) (setq buffer (current-buffer)))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]