]> git.eshelyaron.com Git - emacs.git/commitdiff
Avoid duplicate load-path entry when generating package autoloads
authorRobert Pluim <rpluim@gmail.com>
Mon, 22 May 2023 13:44:21 +0000 (15:44 +0200)
committerRobert Pluim <rpluim@gmail.com>
Tue, 23 May 2023 12:12:21 +0000 (14:12 +0200)
'file-name-directory' produces a path ending in '/', so that needs to be
run through 'directory-file-name' to avoid duplicate entries in
'load-path'.  (Bug#63625)

* lisp/emacs-lisp/package.el (package-generate-autoloads): Call
'directory-file-name' on the directory of 'load-file-name'.

lisp/emacs-lisp/package.el

index 293c1c39ca19e181ae2ca0e584229d52704792b8..0d90e4a4059e6f2c191aa99d70e0224c8aa1dc04 100644 (file)
@@ -1110,8 +1110,12 @@ untar into a directory named DIR; otherwise, signal an error."
         ;; 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.
-        (or (and load-file-name (file-name-directory load-file-name))
-            (car load-path)))))
+        ;; `loaddefs-generate' has code to do this for us, but it's
+        ;; not currently exposed.  (Bug#63625)
+        (or (and load-file-name
+                 (directory-file-name
+                  (file-name-directory load-file-name)))
+             (car load-path)))))
     (let ((buf (find-buffer-visiting output-file)))
       (when buf (kill-buffer buf)))
     auto-name))