bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#2061: 23.0.60; Add preference to force load of Elisp files when they


From: Kevin Rodgers
Subject: bug#2061: 23.0.60; Add preference to force load of Elisp files when they are newer than corresponding byte-compiled file
Date: Wed, 28 Jan 2009 01:29:37 -0700
User-agent: Thunderbird 2.0.0.19 (Macintosh/20081209)

Juanma Barranquero wrote:
On Tue, Jan 27, 2009 at 16:54, Brent Goodrick <bgoodr@gmail.com> wrote:
...
Add the following logic to the C `load' function:

 Before loading either the .el or .elc file, test for the condition
 where the .el file is newer than the .elc file. If it is, then do
 the following:

   See if the `load-hook-stale-byte-compile-handlers' hook variable
   is set to non-nil. When it is non-nil, run the hook variable with
   `run-hook-with-args-until-success'. Each function the user has
   added to that hook variable would do any logic s/he wishes,
   including in my case to popup a minibuffer prompt asking what to
   do. When the hook function thus called returns a 'prefer-el-file
   symbol, `load' then loads the .el file and ignores the .elc
   file. Likewise, when the hook function returns the
   'prefer-elc-file symbol, then load the .elc file but give no
   warning message and ignore the .el file. When nil is returned from
   the `run-hook-with-args-until-success' function, just load the
   .elc file and produce the stale file warning message as is done
   today (i.e., preserve existing behavior).

That would work, but it is IMHO too much (interface, not code)
complexity for little gain. In most cases, having a .elc older than
its corresponding .el is a bug (or, let's call it, a temporary
situation), so getting a warning to remind the user about fixing it
seems much more economical.

That said, sometimes I would've liked to have a hook that runs when a
file is loaded; or the ability to defadvice Fload (you can, except
that Fload is also called from C code, for example for autoloads).

Yes, before-load-hook and after-load-hook would be generally useful
if load-file-name were set to load's FILE argument when they're run.

--
Kevin Rodgers
Denver, Colorado, USA








reply via email to

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