emacs-devel
[Top][All Lists]
Advanced

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

Re: feature/package+vc 04c4c578c7 3/4: Allow for packages to be installe


From: Philip Kaludercic
Subject: Re: feature/package+vc 04c4c578c7 3/4: Allow for packages to be installed directly from VCS
Date: Thu, 17 Feb 2022 09:21:08 +0000

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

>>>>> I'm sorry, I don't understand what you're saying here.  Who&how does
>>>>> "just clone a project into elpa/devel" and what do you mean by 
>>>>> "elpa/devel"?
>>>>
>>>> What I meant was that all directories in ~/.emacs.d/elpa/devel could be
>>>> automatically detected and loaded.
>>>
>>> That's already the case if `~/.emacs.d/elpa/devel` is in
>>> `package-directory-list`, so I don't understand how that relates to what
>>> we're discussing.
>>
>> Unless I am mistaken, `package--make-autoloads-and-stuff' is currently
>> only invoked by `package-unpack', that in turn is only called by the
>> `package-install-from-*' functions.  Am I missing something, or how
>> would the autoload file be generated if I just place a repository into
>> ~/.emacs.d/elpa/devel?
>
> I don't think we should spend too much time trying to support the case
> where a user only does `git clone` and expects Emacs to notice the new
> package and set it up magically.  Instead, I'd expect
> `package-activate-all` to warn the user about a missing `<pkg>-pkg.el`
> when collecting the available packages and about a missing
> `<pkg>-autoloads.el` file when trying to activate a given package.
>
> Then the user can use some `package-<foo>-refresh` or somesuch to
> (re)create those files (and (re)compile the `.el` files along the way
> and (re)generate the docs, ...).

This seems reasonable, I will try to implement it in the next few days.

>> Say a repository consists of only an init.el, and a few submoduled git
>> repositories under /elpa/devel/.  These wouldn't include the -pkg.el or
>> -autoload.el files, so they should be generated as soon as necessary.
>
> Let those users write specific code for that if they so wish.
> Generating the `<pkg>-pkg.el` file as well as the `<pkg>-autoloads.el`
> cannot be done fully automatically in all cases.  More specifically it
> may require the package's spec to find the `:main-file` and other such
> things.  I don't think we should aim for that level of automation yet.

My init.el begins with this blob that does the job well enough (it was
also the basis for the site-lisp.el patch I proposed last year):

--8<---------------cut here---------------start------------->8---
(eval-and-compile                       ;for flymake
  (require 'autoload)
  (let* ((backup-inhibited t)
         (dir (locate-user-emacs-file "site-lisp"))
         (load (expand-file-name "autoload.el" dir)))
    (dolist (dir (directory-files dir t "^[^.]"))
      (when (file-directory-p dir)
        (add-to-list 'load-path dir)
        (make-directory-autoloads dir load)
        (byte-recompile-directory dir)))
    (add-to-list 'load-path dir)
    (load load nil t)
    (kill-buffer (find-buffer-visiting load))))
--8<---------------cut here---------------end--------------->8---

So if I want to try some package out from source, all I need to do is
clone the repository into ~/.emacs.d/site-lisp and everything else is
done automatically when Emacs is restarted (or the snippet is
evaluated).

-- 
        Philip Kaludercic



reply via email to

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