emacs-devel
[Top][All Lists]
Advanced

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

Re: feature/package-vc has been merged


From: Philip Kaludercic
Subject: Re: feature/package-vc has been merged
Date: Wed, 09 Nov 2022 18:00:37 +0000

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>> diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
>> index 0881626e92..67ce30a93c 100644
>> --- a/lisp/emacs-lisp/package.el
>> +++ b/lisp/emacs-lisp/package.el
>> @@ -1103,8 +1103,17 @@ package-generate-autoloads
>>       (package-lisp-dir pkg-desc)
>>       output-file nil
>>       (prin1-to-string
>> -      `(add-to-list 'load-path
>> -                    ,(package-lisp-dir pkg-desc))))
>> +      `(add-to-list
>> +        'load-path
>> +        (file-name-concat
>> +         ;; 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))
>> +         ;; In case the package specification indicates that the lisp
>> +         ;; files are found in a subdirectory, append that path.
>> +         ,(alist-get :lisp-dir (package-desc-extras pkg-desc))))))
>>      (let ((buf (find-buffer-visiting output-file)))
>>        (when buf (kill-buffer buf)))
>>      auto-name))
>
> I don't understand why we have code relating to `package-vc` in
> `package.el`.

I have made :lisp-dir a general property of a package description.  This
might be set in package-vc when generating the <PKG>-pkg.el, but in
principle any (non-vc) package could make use of this to indicate a
subdirectory where lisp files are stored.  For now this is something
that will probably only interest package-vc.

> Please be careful to try to correctly preserve the *exact* name added to
> `load-path` (most importantly whether it ends in a slash or not),
> because some other code relies on it (e.g. to try and avoid having both
> `/foo/bar` and `/foo/bar/` or to remove entries).

Good point, I'll make sure to check that.



reply via email to

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