From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Juanma Barranquero Newsgroups: gmane.emacs.bugs 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 03:06:13 +0100 Message-ID: References: <18813.7599.138907.415045@hungover.brentg.com> <18815.11809.968195.804775@hungover.brentg.com> Reply-To: Juanma Barranquero , 2061@emacsbugs.donarmstrong.com NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1233109431 21478 80.91.229.12 (28 Jan 2009 02:23:51 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 28 Jan 2009 02:23:51 +0000 (UTC) Cc: 2061@emacsbugs.donarmstrong.com To: Brent Goodrick Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Jan 28 03:25:04 2009 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1LS06u-0004xU-4D for geb-bug-gnu-emacs@m.gmane.org; Wed, 28 Jan 2009 03:25:01 +0100 Original-Received: from localhost ([127.0.0.1]:59513 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LS05b-0005Bw-V5 for geb-bug-gnu-emacs@m.gmane.org; Tue, 27 Jan 2009 21:23:39 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LS05W-0005BP-9U for bug-gnu-emacs@gnu.org; Tue, 27 Jan 2009 21:23:34 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LS05U-0005An-LG for bug-gnu-emacs@gnu.org; Tue, 27 Jan 2009 21:23:34 -0500 Original-Received: from [199.232.76.173] (port=48626 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LS05U-0005Ae-EB for bug-gnu-emacs@gnu.org; Tue, 27 Jan 2009 21:23:32 -0500 Original-Received: from rzlab.ucr.edu ([138.23.92.77]:58953) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LS05U-00008o-1Q for bug-gnu-emacs@gnu.org; Tue, 27 Jan 2009 21:23:32 -0500 Original-Received: from rzlab.ucr.edu (rzlab.ucr.edu [127.0.0.1]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id n0S2NToh023360; Tue, 27 Jan 2009 18:23:30 -0800 Original-Received: (from debbugs@localhost) by rzlab.ucr.edu (8.13.8/8.13.8/Submit) id n0S2F3Kl021040; Tue, 27 Jan 2009 18:15:03 -0800 X-Loop: owner@emacsbugs.donarmstrong.com Resent-From: Juanma Barranquero Resent-To: bug-submit-list@donarmstrong.com Resent-CC: Emacs Bugs Resent-Date: Wed, 28 Jan 2009 02:15:03 +0000 Resent-Message-ID: Resent-Sender: owner@emacsbugs.donarmstrong.com X-Emacs-PR-Message: followup 2061 X-Emacs-PR-Package: emacs X-Emacs-PR-Keywords: Original-Received: via spool by 2061-submit@emacsbugs.donarmstrong.com id=B2061.123310838319696 (code B ref 2061); Wed, 28 Jan 2009 02:15:03 +0000 Original-Received: (at 2061) by emacsbugs.donarmstrong.com; 28 Jan 2009 02:06:23 +0000 X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. Original-Received: from mail-ew0-f10.google.com (mail-ew0-f10.google.com [209.85.219.10]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id n0S26Jjx019690 for <2061@emacsbugs.donarmstrong.com>; Tue, 27 Jan 2009 18:06:21 -0800 Original-Received: by ewy3 with SMTP id 3so9395101ewy.1 for <2061@emacsbugs.donarmstrong.com>; Tue, 27 Jan 2009 18:06:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=+NJfCsEKBV0QhAC6pZLuwvqVVSTmq6zOWi/0Rxp4RRc=; b=WIj0QNuUwubPCbea18sojBVn+roYn7nnv4amsXgqUbA2mpACpzejPF+oV/F1gjbPHF 7/PeAmSytREbizSUoNIBh4UeCtzM+wjr2kHz6CQnj0j7kNOlxmaVn5nZUPjnfFWuSUvj /rqCayI+CNn5Qh3yXf4sMie1UgNe/c9Nf7Zps= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=XrrfQG/6YlOZMLl6Mk4tylw5xXqL17XyHaUriQOe0bxcWnLxTmeaq8RvpF2ub1tpLM qbhYXoZu628CLWwx/aDKl4lVmGeuICnryqBwQTfpvx0st3ANmB07h3lJ63zWkRPt+0Gb 5Lwv8z0thdKm/WqY49oSICNgqKbaV7iPg4xyw= Original-Received: by 10.210.45.17 with SMTP id s17mr7090231ebs.93.1233108373929; Tue, 27 Jan 2009 18:06:13 -0800 (PST) In-Reply-To: <18815.11809.968195.804775@hungover.brentg.com> X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) Resent-Date: Tue, 27 Jan 2009 21:23:34 -0500 X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:24653 Archived-At: On Tue, Jan 27, 2009 at 16:54, Brent Goodrick wrote: > The problem relates to when and how to notify the user that the stale > .elc file is the one being loaded. During development, I just > `eval-buffer' repeatedly on a .el file, always unaware that there is a > stale .elc file lying in wait to confuse me the next time I reload the > entire Emacs process/session. If you're going to modify/test the package with eval-buffer, you should make sure there's no .elc sitting around. > At init time, I only get a warning, > among a ton of other benign warnings and messages, and that one > critical warning is therefore not seen (of course, it is impractical > to ask the user to read all of those messages). As you know, that's trivially fixed: (add-hook 'emacs-startup-hook (lambda () (with-current-buffer (get-buffer "*Messages*") (goto-char (point-min)) (while (re-search-forward "[Ss]ource file .*? newer" nil t) (warn "%s" (buffer-substring (line-beginning-position) (line-end-position))))))) > 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). > I have tried doing that, but found it unworkable in practice, as > byte-compiling upon each save ended up chewing up too much time during > development (the byte-compile-upon-every-save penalty). Consider that > I save frequently. :) I didn't mean to byte-compile on saving, I meant to byte-compile on eval-buffer (or whatever method you use to test your code). > But that is a hack, so I am now trying to get the root problem > addressed in the C code where it exists. I agree that greater control over the loading process could sometimes be useful; but I don't think this is a compelling use case. Juanma