bug-gnu-emacs
[Top][All Lists]
Advanced

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

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


From: Stefan Kangas
Subject: bug#41998: case nil in load-path not handled in function read-library-name
Date: Thu, 13 Aug 2020 10:36:52 -0700
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

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





reply via email to

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