emacs-diffs
[Top][All Lists]
Advanced

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

master e781907 1/2: Only search for a variable when instructed


From: Lars Ingebrigtsen
Subject: master e781907 1/2: Only search for a variable when instructed
Date: Tue, 11 Aug 2020 09:40:58 -0400 (EDT)

branch: master
commit e7819074013ac3c2b84abbc05a6f4f6c413d981e
Author: Alexander Gramiak <agrambot@gmail.com>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    Only search for a variable when instructed
    
    * lisp/help-fns.el (find-lisp-object-file-name): Check for 'defvar
    argument before searching for an internal variable (Bug#24697).
    * test/lisp/help-fns-tests.el: New tests.
---
 lisp/help-fns.el            |  1 +
 test/lisp/help-fns-tests.el | 11 +++++++++++
 2 files changed, 12 insertions(+)

diff --git a/lisp/help-fns.el b/lisp/help-fns.el
index 5a99103..a137c50 100644
--- a/lisp/help-fns.el
+++ b/lisp/help-fns.el
@@ -364,6 +364,7 @@ suitable file is found, return nil."
          (help-C-file-name type 'subr)
        'C-source))
      ((and (not file-name) (symbolp object)
+           (eq type 'defvar)
           (integerp (get object 'variable-documentation)))
       ;; A variable defined in C.  The form is from `describe-variable'.
       (if (get-buffer " *DOC*")
diff --git a/test/lisp/help-fns-tests.el b/test/lisp/help-fns-tests.el
index d2dc3d2..da2b49e 100644
--- a/test/lisp/help-fns-tests.el
+++ b/test/lisp/help-fns-tests.el
@@ -160,4 +160,15 @@ Return first line of the output of (describe-function-1 
FUNC)."
   (with-current-buffer "*Help*"
     (should (looking-at "^help-fns-test--describe-keymap-foo is"))))
 
+;;; Tests for find-lisp-object-file-name
+(ert-deftest help-fns-test-bug24697-function-search ()
+  (should-not (find-lisp-object-file-name 'tab-width 1)))
+
+(ert-deftest help-fns-test-bug24697-non-internal-variable ()
+  (let ((help-fns--test-var (make-symbol "help-fns--test-var")))
+    ;; simulate an internal variable
+    (put help-fns--test-var 'variable-documentation 1)
+    (should-not (find-lisp-object-file-name help-fns--test-var 'defface))
+    (should-not (find-lisp-object-file-name help-fns--test-var 1))))
+
 ;;; help-fns-tests.el ends here



reply via email to

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