From: Adam Porter <adam@alphapapa.net>
To: Philip Kaludercic <philipk@posteo.net>
Cc: Joseph Turner <joseph@breatheoutbreathe.in>,
Emacs Devel Mailing List <emacs-devel@gnu.org>
Subject: Re: [package-vc] Consider cleaning up files from install process
Date: Sat, 7 Oct 2023 02:52:34 -0500 [thread overview]
Message-ID: <560eeace-6c97-40e2-988b-3b1019f24677@alphapapa.net> (raw)
In-Reply-To: <87ttrp8doq.fsf@posteo.net>
Hi Philip,
On 9/20/23 03:13, Philip Kaludercic wrote:
>> IMHO that seems like a sort of user-error, to leave uncommitted
>> changes in a repo that's under the control of a system that doesn't
>> take such changes into account when operating on the repo. IOW, if I
>> install a package with command package-FOO, I expect the files it
>> makes to be under its purview, not mine; they are not my personal data
>> files, but belong to Emacs and its package.el library, the same as if
>> I used "M-x package-install".
>
> I don't believe in these kinds of distinctions. I can change what I
> want, the only question I have to keep in mind is what the chances of
> loosing these changes is going to be.
I think I understand what you mean. However, that seems to conflict
with the idea of loading packages directly from git worktrees,
regardless of their status. That is, when I install a package into my
Emacs configuration, I intend for the version I installed to be
available when I start Emacs, not whatever state I might have left the
repository in when I last touched it. If I had last checked out an
in-progress feature branch and then shut down my computer, I wouldn't
want Emacs to attempt to load that next time.
>> To put it another way, it seems like a bit of an anti-pattern to
>> develop a package that's stored in "~/.emacs.d/elpa"--that directory
>> is supposed to be for installed packages' files, and it should be safe
>> to wipe that directory out at any time and reinstall packages from
>> their sources--after all,
>
> Is that documented anywhere? I know it can be done, if your
> configuration is written accordingly, but if you see installed packages
> as not being part of your domain, then transgressing layers of
> abstraction and accessing, then deleting the "internal" representation
> of package.el would seem to also be wrong?
I don't know if that idea is documented anywhere, but it seems implicit
to me by reason of users not necessarily needing to be aware of what
files and directories get created when installing a package. If a user
only used the package-install and package-delete commands, and didn't
look at the filesystem or messages output, he wouldn't know nor care
where the packages' files were. (I regularly advocate committing one's
"elpa/" directory to git along with one's "init.el", and in so doing
I've learned how many users aren't aware of how it all works.)
>>> Can you describe the interface you are imagining. From what I
>>> understand, it should be possible to reproduce what you need by
>>> combining `package-vc-checkout' and `package-install-file'?
>>
>> Well, I would expect it to act similarly to Quelpa:
>>
>> 1. Clone the git repo (shallowly, at least by default) to a directory
>> (perhaps a temporary one, but at least one stored in the appropriate
>> XDG cache directory, outside of user-emacs-directory).
>>
>> 2. Call package-install-file on that worktree.
>>
>> 3. The package ends up installed into package-user-dir as if it were
>> installed with package-install from ELPA.
>
> How does this look like:
>
> --8<---------------cut here---------------start------------->8---
> (defun package-vc-install-copy (pkg-desc)
> "Fetch the package sources of PKG-DESC and install a copy."
> (interactive (list (package-vc--read-package-desc "Fetch package source: ")))
> (let* ((copy (copy-package-desc pkg-desc))
> (package-dir (expand-file-name
> (symbol-name (package-desc-name pkg-desc))
> (make-temp-file "package-vc-" t)))
> (package-vc-register-as-project nil))
> (setf (package-desc-dir copy) package-dir)
> (save-window-excursion
> (package-vc-checkout pkg-desc package-dir)
> (package-install-from-buffer))))
> --8<---------------cut here---------------end--------------->8---
>
> I'd ideally pass :last-release to package-vc-checkout, but I have
> detected a bug with this setup that should be fixed.
I tested that command in a clean Emacs 29.1, and it seems to work well.
Thanks.
The only suggestion I have would be for an optional persistent directory
used for keeping the git repositories around as a cache (i.e. outside of
user-emacs-directory, likely in $XDG_CACHE_HOME), so that when upgrading
the package, the whole repo wouldn't need to be cloned again, e.g.
Quelpa configures this in the `quelpa-dir' option.
> The main question I have is what advantage or disadvantage this would
> provide over Quelpa? The functionality you describe misses the point of
> what I see to be the point of package-vc, as it wasn't written to be a
> replacement of Straight or Quelpa (I have never used either of the two),
> but just as a tool to streamline fetching and preparing packages
> directly from source code repositories.
The advantage over Quelpa would simply be to not require Quelpa. :)
I'd like for this functionality to be built-in to Emacs. I thought
that's what package-vc was basically intended to do (i.e. give a user a
git repo URL and he can install the package into his Emacs with a single
command, as if he had cloned it manually and ran package-install on it),
but maybe I misunderstood.
Thanks for your help,
Adam
next prev parent reply other threads:[~2023-10-07 7:52 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-19 7:24 [package-vc] Consider cleaning up files from install process Joseph Turner
2023-09-19 9:03 ` Philip Kaludercic
2023-09-19 12:19 ` Adam Porter
2023-09-19 13:50 ` Philip Kaludercic
2023-09-19 14:34 ` Adam Porter
2023-09-20 8:13 ` Philip Kaludercic
2023-10-07 7:52 ` Adam Porter [this message]
2023-10-07 13:31 ` Philip Kaludercic
2023-09-20 12:13 ` Stefan Monnier via Emacs development discussions.
2023-09-20 12:08 ` Stefan Monnier via Emacs development discussions.
2023-09-20 12:03 ` Stefan Monnier via Emacs development discussions.
-- strict thread matches above, loose matches on Subject: below --
2023-10-04 8:11 Joseph Turner
2023-10-04 8:22 Joseph Turner
2023-10-04 8:31 Joseph Turner
2023-10-04 15:23 ` Philip Kaludercic
2023-10-04 18:54 ` Joseph Turner
2023-10-06 9:00 ` Philip Kaludercic
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=560eeace-6c97-40e2-988b-3b1019f24677@alphapapa.net \
--to=adam@alphapapa.net \
--cc=emacs-devel@gnu.org \
--cc=joseph@breatheoutbreathe.in \
--cc=philipk@posteo.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.