From: Tim Cross <theophilusx@gmail.com>
To: emacs-devel@gnu.org
Subject: Re: PACKAGE-FEATURES, and hot update of Emacs packages
Date: Sun, 28 Nov 2021 12:04:53 +1100 [thread overview]
Message-ID: <87a6hpkrj5.fsf@gmail.com> (raw)
In-Reply-To: <b4da24dd1595da27f2557ba15bf4a636@webmail.orcon.net.nz>
Phil Sainty <psainty@orcon.net.nz> writes:
> On 2021-11-27 22:31, Qiantan Hong wrote:
>> Then to really update p, one just need to
>> (mapc (lambda (feature) (unload-feature feature t)) (package-features p))
>> (package-reinstall p)
>> (require p)
>
> Unloading a feature will trash the user's configuration, and so when
> you load the updated library only the default config will be set --
> unless the user used `eval-after-load' (which certainly can't be
> assumed). As such, I don't think that could work as a reliable "hot
> update" process.
>
> My approach to this general issue (in libraries I've written) has been
> to detect at load time if the user had an older version of the library
> loaded, and to perform any appropriate in-place upgrades. E.g.:
> https://git.savannah.gnu.org/cgit/emacs.git/tree/lisp/so-long.el?id=aebba085cba1#n2012
>
> This does require that the code knows both the previously-loaded and
> newly-loaded version numbers, which can be tricky if the previous
> version of the code wasn't storing its version; so I think it would be
> great if Emacs *automatically* tracked this information for packages
> (or any library that supplies a version) so that authors could write
> such update code without needing to have previously prepared for it.
>
> I don't think this currently happens. I can see the functions
> `package-get-version' and `package-desc-version' (which can be used
> with `package-alist'), but haven't spotted anything which is storing
> the version of a package that is/was loaded (and I don't think this
> information is as easily accessible when loading byte-compiled files,
> as version comments don't appear in the .elc file).
>
> I suppose (package-desc-version (package-load-descriptor DIR)) can be
> used for ELPA packages installed in the standard way, so maybe there's
> scope for using that; but I suspect that'd be too brittle an approach,
> as there are many non-standard ways of loading things.
>
>
While I like the idea of being able to use package version to help
manage this, the problem is there is no standardisation of package
version formats. This makes calculation of which version is before/after
another version unreliable.
Personally, I wish the package systems used a consistent semantic
versioning approach. In addition to determining which package version is
later than another version, it would also provide the ability to have
more fine grain control over applying updates i.e. could set the system
to automatically apply minor patch updates, but not major version
updates that may contain breaking changes.
next prev parent reply other threads:[~2021-11-28 1:04 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-27 9:31 PACKAGE-FEATURES, and hot update of Emacs packages Qiantan Hong
2021-11-27 10:09 ` Eli Zaretskii
2021-11-27 10:18 ` Qiantan Hong
2021-11-27 10:20 ` Qiantan Hong
2021-11-27 12:16 ` Phil Sainty
2021-11-27 13:30 ` Phil Sainty
2021-11-27 20:36 ` Qiantan Hong
2021-11-28 7:22 ` Phil Sainty
2021-11-28 7:51 ` Qiantan Hong
2021-11-28 1:04 ` Tim Cross [this message]
2021-11-28 4:23 ` Phil Sainty
2021-11-28 5:12 ` Stefan Monnier
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87a6hpkrj5.fsf@gmail.com \
--to=theophilusx@gmail.com \
--cc=emacs-devel@gnu.org \
/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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).