bug#41998: case nil in load-path not handled in function read-library-name

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

bug#41998: case nil in load-path not handled in function read-library-name

Tobias Zawada
Version: 28.0.50, commit 2c4509179110459f42119ce328d72fea65689288

Variable `load-path' admits nil as entry standing for `default-directory'.
This case is not handled in function `read-library-name' of library `lisp/emacs-lisp/find-func.el'.

Diff that fixes this problem:

diff --git a/lisp/emacs-lisp/find-func.el b/lisp/emacs-lisp/find-func.el
index e35db56550..4498a50f90 100644
--- a/lisp/emacs-lisp/find-func.el
+++ b/lisp/emacs-lisp/find-func.el
@@ -292,12 +292,13 @@ read-library-name
                          (find-library-suffixes)
                          "\\|"))
          (table (cl-loop for dir in (or find-function-source-path load-path)
-                         when (file-readable-p dir)
+ for dir-or-default = (or dir default-directory)
+                         when (file-readable-p dir-or-default)
                          append (mapcar
                                  (lambda (file)
                                    (replace-regexp-in-string suffix-regexp
                                                              "" file))
-                                 (directory-files dir nil
+                                 (directory-files dir-or-default nil
                                                   suffix-regexp))))
          (def (if (eq (function-called-at-point) 'require)
                   ;; `function-called-at-point' may return 'require