unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#41998: case nil in load-path not handled in function read-library-name
@ 2020-06-22  5:01 Tobias Zawada
  2020-08-13 17:36 ` Stefan Kangas
  0 siblings, 1 reply; 2+ messages in thread
From: Tobias Zawada @ 2020-06-22  5:01 UTC (permalink / raw)
  To: 41998

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





^ permalink raw reply related	[flat|nested] 2+ messages in thread

* bug#41998: case nil in load-path not handled in function read-library-name
  2020-06-22  5:01 bug#41998: case nil in load-path not handled in function read-library-name Tobias Zawada
@ 2020-08-13 17:36 ` Stefan Kangas
  0 siblings, 0 replies; 2+ messages in thread
From: Stefan Kangas @ 2020-08-13 17:36 UTC (permalink / raw)
  To: Tobias Zawada; +Cc: 41998

close 41998 28.1
thanks

Tobias Zawada <i_inbox@tn-home.de> writes:

> 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'.

To reproduce:

0. cd ~/some-path-with-elisp-files/
1. emacs -Q
2. Evaluate:

   (progn
     (add-to-list 'load-path nil)
     (with-temp-buffer
       (insert "library")
       (read-library-name)))

And you will get an error.

> 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

Thanks for the bug fix.  I've added a commit message and ChangeLog entry
and pushed it to master branch in your name.

One small thing: it would be helpful if you could send your next patch
as formatted by `git format-patch' and with a ChangeLog entry as
described in the CONTRIBUTE file in emacs.git.

I'm closing this bug with this message.

Best regards,
Stefan Kangas





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-08-13 17:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-22  5:01 bug#41998: case nil in load-path not handled in function read-library-name Tobias Zawada
2020-08-13 17:36 ` Stefan Kangas

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).