From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Brent Goodrick 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: Mon, 2 Feb 2009 08:07:02 -0800 Message-ID: References: <18813.7599.138907.415045@hungover.brentg.com> <18815.11809.968195.804775@hungover.brentg.com> Reply-To: Brent Goodrick , 2061@emacsbugs.donarmstrong.com NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1233593574 20359 80.91.229.12 (2 Feb 2009 16:52:54 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 2 Feb 2009 16:52:54 +0000 (UTC) Cc: 2061@emacsbugs.donarmstrong.com To: Juanma Barranquero Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Feb 02 17:54:08 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 1LU23c-00035Y-P5 for geb-bug-gnu-emacs@m.gmane.org; Mon, 02 Feb 2009 17:54:01 +0100 Original-Received: from localhost ([127.0.0.1]:40366 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LU22K-0002yh-0U for geb-bug-gnu-emacs@m.gmane.org; Mon, 02 Feb 2009 11:52:40 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LU1aG-0003gT-Aq for bug-gnu-emacs@gnu.org; Mon, 02 Feb 2009 11:23:40 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LU1aB-0003eU-EN for bug-gnu-emacs@gnu.org; Mon, 02 Feb 2009 11:23:38 -0500 Original-Received: from [199.232.76.173] (port=39989 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LU1aA-0003dn-RZ for bug-gnu-emacs@gnu.org; Mon, 02 Feb 2009 11:23:35 -0500 Original-Received: from rzlab.ucr.edu ([138.23.92.77]:39205) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LU1aA-0002kr-6S for bug-gnu-emacs@gnu.org; Mon, 02 Feb 2009 11:23:34 -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 n12GNVtn022880; Mon, 2 Feb 2009 08:23:31 -0800 Original-Received: (from debbugs@localhost) by rzlab.ucr.edu (8.13.8/8.13.8/Submit) id n12GF2hW020552; Mon, 2 Feb 2009 08:15:02 -0800 X-Loop: owner@emacsbugs.donarmstrong.com Resent-From: Brent Goodrick Resent-To: bug-submit-list@donarmstrong.com Resent-CC: Emacs Bugs Resent-Date: Mon, 02 Feb 2009 16:15:02 +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.123359083219229 (code B ref 2061); Mon, 02 Feb 2009 16:15:02 +0000 Original-Received: (at 2061) by emacsbugs.donarmstrong.com; 2 Feb 2009 16:07:12 +0000 X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. Original-Received: from mail-gx0-f20.google.com (mail-gx0-f20.google.com [209.85.217.20]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id n12G78TC019222 for <2061@emacsbugs.donarmstrong.com>; Mon, 2 Feb 2009 08:07:09 -0800 Original-Received: by gxk13 with SMTP id 13so1275962gxk.1 for <2061@emacsbugs.donarmstrong.com>; Mon, 02 Feb 2009 08:07:02 -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=eKh3iFMacwcRi3WkSUUZQlQlCdLyKZYL0SmHXZeXUYI=; b=JYLelU05UY8EoKfgyzXAxxgogzqngt5GX2/gIxQT+9aY2Y+TbGP/S2wXhdkm08Qjqc epCldeey7yG61G4J2TFX4oEwQ5rpANo4dmwl2Pr2tOvZDqwm/+G2YdyVT+gHm+XV5lyW 3gHFlkXJdIrrosuGngVRzUOG+mPIgtATB0iIE= 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=La7zXc4Q/gk4z6kw+aEOKXOy7kiUtw5uQhxTFaPLUm6KKyUYbcWNHPYPqudQZaAo+o Y+b73hEV1UcQ+DjiBSbwEqSk1kltW2zVT2VlIkFlD8Q6XijrXNoxqhQbhhe8eSm3R/KU MUbs+BF1rRP1zFlw8K/r8KcupUWUrvs9MgKG8= Original-Received: by 10.90.101.17 with SMTP id y17mr1212835agb.106.1233590822656; Mon, 02 Feb 2009 08:07:02 -0800 (PST) In-Reply-To: X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) Resent-Date: Mon, 02 Feb 2009 11:23:38 -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:24833 Archived-At: I won't pursue this any further. You all have given me some useful workarounds that I will explore further. Thanks Brent On 1/27/09, Juanma Barranquero wrote: > 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 >