unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* PACKAGE-FEATURES, and hot update of Emacs packages
@ 2021-11-27  9:31 Qiantan Hong
  2021-11-27 10:09 ` Eli Zaretskii
  2021-11-27 12:16 ` Phil Sainty
  0 siblings, 2 replies; 12+ messages in thread
From: Qiantan Hong @ 2021-11-27  9:31 UTC (permalink / raw)
  To: emacs-devel@gnu.org

package-reinstall seems to update the external UNIX file system only,
and don’t update the package loaded in the Elisp image properly.
I didn’t find a built-in way to do so, which sucks because one need
to restart Emacs (and lost the image state) to update packages.

It turns out that Emacs seems to have almost all the necessary facility
to make hot update happens, the only missing one
seems to be package-features (that finds out features loaded from the package).
Then to really update p, one just need to

(mapc (lambda (feature) (unload-feature feature t)) (package-features p))
(package-reinstall p)
(require p)

(assuming p is the same as the “entry” feature of the whole package)

Currently I use an adhoc version
(defun package-features (p)
  (cl-remove-if-not
   (lambda (feature)
     (s-prefix-p (symbol-name p) (symbol-name feature)))
   features))

It works pretty well, I’m able to update all of my everyday packages successfully,
which shows that hot update is very doable. Now for the rare case
that the default behavior result in inconsistent state, package maintainer
can always define feature-UNLOAD-FUNCTION to make it work nicely.

Now back to the only missing pieces, how much effort it’d take to have
a proper PACKAGE-FEATURES? Is it good to have it in core? 
(I suppose it’d be a minor change to package.el).

Best,
Qiantan




^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2021-11-28  7:51 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2021-11-28  4:23     ` Phil Sainty
2021-11-28  5:12     ` Stefan Monnier

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).