Subject: Re: bug#63625: 29.0.90; package-install inserts package directory into load-path twice.

From: Robert Pluim <[email-masked]>
Date: Mon, 22 May 2023 14:46:37 +0200

>>>>> On Mon, 22 May 2023 14:25:02 +0300, Eli Zaretskii <[email-masked]> said:

    >> Cc: todd smith <[email-masked]>
    >> From: Robert Pluim <[email-masked]>
    >> Date: Mon, 22 May 2023 10:55:13 +0200
    >> 
    >> This is because we didnʼt respect DRY. package.el should use the
    >> package support of `loaddefs-generate', but that doesnʼt expose the
    >> requisite feature of `loaddefs-generate--rubric' (maybe on master it does).
    >> 
    >> diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
    >> index 78017b77677..31e5e0809a8 100644
    >> --- a/lisp/emacs-lisp/package.el
    >> +++ b/lisp/emacs-lisp/package.el
    >> @@ -1107,8 +1107,9 @@ package-generate-autoloads
    >> ;; Add the directory that will contain the autoload file to
    >> ;; the load path.  We don't hard-code `pkg-dir', to avoid
    >> ;; issues if the package directory is moved around.
    >> +        (directory-file-name
    >> (or (and load-file-name (file-name-directory load-file-name))
    >> -            (car load-path)))))
    >> +            (car load-path))))))
    >> (let ((buf (find-buffer-visiting output-file)))
    >> (when buf (kill-buffer buf)))
    >> auto-name))

    Eli> Thanks.

    Eli> Philip, Stefan: any comments or suggestions?

Two other things:

1. Can `load-file-name' ever be nil here?
2. Should we just use $# instead of `load-file-nameʼ'?

(I also have a sneaking suspicion that this adding to `load-path' is
being done twice, but Iʼll look at that when this issue is fixed)

Robert
--