all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: help-gnu-emacs@gnu.org
Subject: Re: Updating Elisp files while Emacs is running
Date: Tue, 15 Mar 2016 09:01:05 -0400	[thread overview]
Message-ID: <jwv7fh39apn.fsf-monnier+gmane.emacs.help@gnu.org> (raw)
In-Reply-To: CAArVCkTgUv-OzQLfa+QDzABsR6ZXUNauUvHObd6xBeh=RSizZg@mail.gmail.com

> OS-level package managers such as Debian's dpkg generally replace files
> unconditionally when upgrading.

I think we'd be better off discussing it with concrete cases at hand.
Let's try a few cases:
- You have Emacs-24.5 running and upgrade to Emacs-25.1.  In this case,
  making your Emacs process load files from the 25.1 version is risky,
  because there can be (and there are) incompatibilities.  You might
  still want to do it, since the incompatibilities won't always bite
  you, and it can be better than failing right away.

  Note that the files have to be elsewhere, because Debian lets you have
  both Emacs-24.5 and Emacs-25.1 installed at the same time.

- You have Emacs-24.4 running and upgrade to Emacs-24.5.  In this case,
  there should be very few incompatibilities, so it might make sense to
  try and redirect the running process to use the new 24.5 files.

  One possible solution here is for the Debian package to use
  directory names like /usr/share/emacs/24/... instead of
  /usr/share/emacs/24.4/... since Debian doesn't let you have both 24.4
  and 24.5 installed at the same time (contrary to the default Emacs
  build's presumption).

- You have ELPA package sm-c-mode-3.4 installed (and an Emacs is
  running with its load-path pointing to it) and upgrade it to
  sm-c-mode-4.0.  This can happen if you upgrade from a separate process.
  Here, there are 2 subcases:
  - you've already used sm-c-mode in this process, so most/all the files
    are already loaded.  In that case you should be fine and there's
    most likely nothing to do.
  - you haven't used sm-c-mode yet in this process, so it would be both
    desirable and likely safe to reload the new sm-c-mode-autoloads.el
    so as to redirect future uses of sm-c-mode to load from the new
    4.0 version.

I'm not sure how best to handle this, but maybe one way to accommodate
this is to add some hook to `load' to handle the situation of
a directory having gone missing.

E.g. one easy/safe hook could be a load-file-not-found-hook called when
load fails to find the file, so you could add ad-hoc code to it that
tries to detect the above situations, updates the load-path accordingly,
and tries again.

A slightly more intrusive attempt might be
a load-path-directory-not-found-hook called when a dir in load-path
doesn't exist.  This would try to solve the main problem I see with the
previous hook: when /usr/share/emacs/24.4 is missing, Emacs may
erroneously find some old/unrelated file with the same name further down
the load-path and would hence fail to run load-file-not-found-hook.
But the problem with load-path-directory-not-found-hook would then be
that it's currently considered perfectly normal for load-path to contain
non-existing directories, so it could break some setups if not done
carefully enough.


        Stefan




  parent reply	other threads:[~2016-03-15 13:01 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-14 13:41 Updating Elisp files while Emacs is running Philipp Stephani
2016-03-14 14:48 ` Phillip Lord
2016-03-14 17:21   ` Philipp Stephani
2016-03-14 18:13     ` Phillip Lord
2016-03-14 18:41       ` Philipp Stephani
2016-03-14 19:58     ` Bob Proulx
2016-03-14 16:48 ` Eli Zaretskii
2016-03-14 17:22   ` Philipp Stephani
2016-03-14 18:04     ` Eli Zaretskii
2016-03-14 18:44       ` Philipp Stephani
2016-03-14 18:55         ` Eli Zaretskii
     [not found] ` <mailman.7507.1457966906.843.help-gnu-emacs@gnu.org>
2016-03-15  7:39   ` Joost Kremers
2016-03-15 13:01 ` Stefan Monnier [this message]
2016-03-15 21:51   ` Bob Proulx

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=jwv7fh39apn.fsf-monnier+gmane.emacs.help@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=help-gnu-emacs@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 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.