From unknown Thu Jun 19 14:04:22 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#15389 <15389@debbugs.gnu.org> To: bug#15389 <15389@debbugs.gnu.org> Subject: Status: 24.2.91; order of eval-after-load actions Reply-To: bug#15389 <15389@debbugs.gnu.org> Date: Thu, 19 Jun 2025 21:04:22 +0000 retitle 15389 24.2.91; order of eval-after-load actions reassign 15389 emacs submitter 15389 joaotavora@gmail.com (Jo=C3=A3o T=C3=A1vora) severity 15389 wishlist thanks From debbugs-submit-bounces@debbugs.gnu.org Sun Sep 15 18:41:45 2013 Received: (at submit) by debbugs.gnu.org; 15 Sep 2013 22:41:45 +0000 Received: from localhost ([127.0.0.1]:39314 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VLL0i-00071Y-A1 for submit@debbugs.gnu.org; Sun, 15 Sep 2013 18:41:44 -0400 Received: from eggs.gnu.org ([208.118.235.92]:57622) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VLL0g-00071K-7F for submit@debbugs.gnu.org; Sun, 15 Sep 2013 18:41:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VLL0S-0007C2-Ov for submit@debbugs.gnu.org; Sun, 15 Sep 2013 18:41:37 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-0.5 required=5.0 tests=BAYES_05,FREEMAIL_FROM, T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:34714) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VLL0S-0007By-Lw for submit@debbugs.gnu.org; Sun, 15 Sep 2013 18:41:28 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59315) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VLL0K-0008Ao-7R for bug-gnu-emacs@gnu.org; Sun, 15 Sep 2013 18:41:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VLL0A-00078V-88 for bug-gnu-emacs@gnu.org; Sun, 15 Sep 2013 18:41:20 -0400 Received: from mail-ea0-x229.google.com ([2a00:1450:4013:c01::229]:41076) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VLL0A-00078P-0b for bug-gnu-emacs@gnu.org; Sun, 15 Sep 2013 18:41:10 -0400 Received: by mail-ea0-f169.google.com with SMTP id k11so1674615eaj.14 for ; Sun, 15 Sep 2013 15:41:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:date:message-id:mime-version:content-type; bh=jCT92eOqGLD5TcUl+BqerGF3iZWqGj/Q96BxOJl4DAs=; b=t0xNHULBL4HVaWX1Fl64xaqFTYbTZQU5cTo7wvznhl/Q3KMVEsJBpJgfIPFJZ8KyAr Y0LmSnbYoeGmsoRRd56mBaW7Nk1xRUMZ+7S2GFpxo60jauYCZbUO0RE+2Ml+WCEc7Qsk pxpWPgDA+xOhIZziFAfbelPXrBVUfDctZ7wzwK8zR+1TIfrMBDPTlAOumKHTH981W7CQ G3l3C3faLMHRCJTDIRez0ftRBodbWig6YsSGncXUu2liNXo1Vp6EOfXcDEvkmo0ry9Xr tvIOBiPMuuKQZU9Y8+Bk11rXVmNFO8VJf+w+2do4hHteQuvrWvexI/raknMaIgLerXOu 6kdw== X-Received: by 10.14.8.72 with SMTP id 48mr38468359eeq.25.1379284868379; Sun, 15 Sep 2013 15:41:08 -0700 (PDT) Received: from king.localhost (88.210.112.25.rev.optimus.pt. [88.210.112.25]) by mx.google.com with ESMTPSA id r48sm36730902eev.14.1969.12.31.16.00.00 (version=TLSv1 cipher=RC4-SHA bits=128/128); Sun, 15 Sep 2013 15:41:07 -0700 (PDT) Received: by king.localhost (Postfix, from userid 501) id E870D53E6BE4; Sun, 15 Sep 2013 23:41:01 +0100 (WEST) From: joaotavora@gmail.com (=?utf-8?B?Sm/Do28gVMOhdm9yYQ==?=) To: bug-gnu-emacs@gnu.org Subject: 24.2.91; order of eval-after-load actions Date: Sun, 15 Sep 2013 23:41:01 +0100 Message-ID: MIME-Version: 1.0 Content-Type: text/plain X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.0 (----) Hi maintainers, Consider a file foo-test.el consisting of this content (eval-after-load 'foo `(progn (message "foo1"))) (eval-after-load 'foo `(progn (message "foo2"))) (provide 'foo) If I interactively eval these forms in order using `eval-last-sexp', for example I get foo1 foo2 in the *Messages* buffer. But if i load the file like so emacs -Q --batch -l foo-test.el I get foo2 foo1 Is this the expected behaviour? Shouldn't the order in which the hooks are run match the order of definition. In GNU Emacs 24.2.91.1 (x86_64-apple-darwin11.4.2, Carbon Version 1.6.0 AppKit 1138.51) of 2012-12-25 on king Windowing system distributor `Apple Inc.', version 10.7.5 Configured using: `configure '--prefix=/usr/local/Cellar/emacs-mac/HEAD' '--enable-locallisppath=/usr/local/share/emacs/site-lisp' '--infodir=/usr/local/Cellar/emacs-mac/HEAD/share/info/emacs' '--with-mac' '--enable-mac-app' 'CC=cc'' Important settings: value of $LANG: en_US.UTF-8 locale-coding-system: utf-8-unix default enable-multibyte-characters: t From debbugs-submit-bounces@debbugs.gnu.org Mon Sep 16 02:58:12 2013 Received: (at 15389) by debbugs.gnu.org; 16 Sep 2013 06:58:12 +0000 Received: from localhost ([127.0.0.1]:40007 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VLSl8-0003lK-VZ for submit@debbugs.gnu.org; Mon, 16 Sep 2013 02:58:11 -0400 Received: from fencepost.gnu.org ([208.118.235.10]:41476 ident=Debian-exim) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VLSl6-0003lA-8q for 15389@debbugs.gnu.org; Mon, 16 Sep 2013 02:58:08 -0400 Received: from rgm by fencepost.gnu.org with local (Exim 4.71) (envelope-from ) id 1VLSl5-00045d-03; Mon, 16 Sep 2013 02:58:07 -0400 From: Glenn Morris To: joaotavora@gmail.com (=?utf-8?B?Sm/Do28gVMOhdm9yYQ==?=) Subject: Re: bug#15389: 24.2.91; order of eval-after-load actions References: X-Spook: CID Ft. Meade cryptanalysis quiche spy Al Jazeera enemy X-Ran: r2V/PgIJ<6LM?qq8K%q\"FY3v"gi'F,_*Xw?[EV+!qZp9Zuz}{jo!Zl%pVS.^1#V`wmq|F X-Hue: magenta X-Debbugs-No-Ack: yes X-Attribution: GM Date: Mon, 16 Sep 2013 02:58:06 -0400 In-Reply-To: (=?utf-8?Q?=22Jo=C3=A3o_T=C3=A1vor?= =?utf-8?Q?a=22's?= message of "Sun, 15 Sep 2013 23:41:01 +0100") Message-ID: User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -5.7 (-----) X-Debbugs-Envelope-To: 15389 Cc: 15389@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.7 (-----) Jo=C3=A3o T=C3=A1vora wrote: > Is this the expected behaviour? Shouldn't the order in which the hooks > are run match the order of definition.=20 I don't think eval-after-load promises anything about the order of evaluation. At the moment, it works like add-hook, ie adds to the front of the list. Do you have an example where it actually matters? > In GNU Emacs 24.2.91.1 (x86_64-apple-darwin11.4.2, Carbon Version 1.6.0 A= ppKit 1138.51) BTW, there's zero reason to use that anymore since 24.3 was released. From debbugs-submit-bounces@debbugs.gnu.org Mon Sep 16 07:17:56 2013 Received: (at 15389) by debbugs.gnu.org; 16 Sep 2013 11:17:56 +0000 Received: from localhost ([127.0.0.1]:40535 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VLWoV-000344-Af for submit@debbugs.gnu.org; Mon, 16 Sep 2013 07:17:55 -0400 Received: from mail-bk0-f43.google.com ([209.85.214.43]:55781) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VLWoS-00033p-1g for 15389@debbugs.gnu.org; Mon, 16 Sep 2013 07:17:52 -0400 Received: by mail-bk0-f43.google.com with SMTP id mz13so1424318bkb.2 for <15389@debbugs.gnu.org>; Mon, 16 Sep 2013 04:17:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-type:content-transfer-encoding; bh=zC5BPpEcvKrxciBWbcc5i7AAYkgkNqMTcSAOvpJLlYE=; b=TPpVO6PqsyV5Jnyihz1qyZJRQL9xZwtgYeb7h3/fo8FZH6OC+fGtfXyk/azh7fRyD5 HPmp2t8Uitx2j7RLdJQ+pTlVIFdI8Pa292TA4CNlaqUe6Kp7+St5Gmr37VLNpsDLbXAe UJTZjUaUfdqYgBh1kYsD+CofmLdn0A2MYWG75KyBCD+wUtty8GSzfWbNLL/vYwhrE1fu lKNJA7oHxQWaTPsPQTv/VRfijxCKh3N1K6kdIaPgNEoIBm2IRurQ4ieW2Wg9aubYh2gm p61TgUipbZ0zyMBa5ZdB6Oin8NwpSSzac0MK8lF7omwY6P9FmUWiFb8FTShobVX/40rL jdpA== X-Received: by 10.204.234.5 with SMTP id ka5mr795068bkb.5.1379330266192; Mon, 16 Sep 2013 04:17:46 -0700 (PDT) Received: from king.localhost (88.210.112.39.rev.optimus.pt. [88.210.112.39]) by mx.google.com with ESMTPSA id on10sm7359644bkb.13.1969.12.31.16.00.00 (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 16 Sep 2013 04:17:45 -0700 (PDT) Received: by king.localhost (Postfix, from userid 501) id A8B5E53E849E; Mon, 16 Sep 2013 12:17:38 +0100 (WEST) From: joaotavora@gmail.com (=?utf-8?B?Sm/Do28gVMOhdm9yYQ==?=) To: Glenn Morris Subject: Re: bug#15389: 24.2.91; order of eval-after-load actions References: Date: Mon, 16 Sep 2013 12:17:38 +0100 In-Reply-To: (Glenn Morris's message of "Mon, 16 Sep 2013 02:58:06 -0400") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2.91 (darwin) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 15389 Cc: 15389@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) Glenn Morris writes: > Jo=C3=A3o T=C3=A1vora wrote: > >> Is this the expected behaviour? Shouldn't the order in which the hooks >> are run match the order of definition. > > I don't think eval-after-load promises anything about the order of > evaluation. At the moment, it works like add-hook, ie adds to the front > of the list. Well, add-hook has an `append' option right? That would be nice. > Do you have an example where it actually matters? Yes. I use small configuration files that are loaded in a particular order to configure emacs in different flavors, an idea that I took from debian, i believe, some years ago. For example, take gnus. If I activate the "common" and "work" flavors in that order, (which I do when I'm at work) the statements in the "work" flavor will sometimes overwrite settings that I set in the "common" flavor, like a different smtp servers. It all worked fine until I remembered to introduce eval-after-load to make startup faster. I could possibly, for instance, never `setq' a variable directly in the progn body passed to eval-after-load. Using a million mode-specific hooks I could ensure that "work" always takes precedence. But this would defeat the purpose of my simple directories-flavors and 33some-foo-config.el scheme, which has served me wonderfully for years now and relies on this simple feature of lisp. But it would just be neater if the order of appearance matched the order of evaluation. I don't have to use eval-after-load. Isn't there another similar mechanism? Where can I start looking? >> In GNU Emacs 24.2.91.1 (x86_64-apple-darwin11.4.2, Carbon Version 1.6.0 = AppKit 1138.51) > > BTW, there's zero reason to use that anymore since 24.3 was released. There's a reason: this one's working fine. It takes me time and patience to compile another emacs with my fullscreen patches. Thanks, Jo=C3=A3o From debbugs-submit-bounces@debbugs.gnu.org Mon Sep 16 12:30:52 2013 Received: (at 15389) by debbugs.gnu.org; 16 Sep 2013 16:30:52 +0000 Received: from localhost ([127.0.0.1]:41361 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VLbhL-0003VT-2V for submit@debbugs.gnu.org; Mon, 16 Sep 2013 12:30:51 -0400 Received: from chene.dit.umontreal.ca ([132.204.246.20]:48481) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VLbhI-0003VK-9u for 15389@debbugs.gnu.org; Mon, 16 Sep 2013 12:30:48 -0400 Received: from faina.iro.umontreal.ca (lechon.iro.umontreal.ca [132.204.27.242]) by chene.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id r8GGUlU9011182; Mon, 16 Sep 2013 12:30:47 -0400 Received: by faina.iro.umontreal.ca (Postfix, from userid 20848) id 4E7A5B40D3; Mon, 16 Sep 2013 12:30:47 -0400 (EDT) From: Stefan Monnier To: joaotavora@gmail.com (=?windows-1252?B?Sm/jbyBU4XZvcmE=?=) Subject: Re: bug#15389: 24.2.91; order of eval-after-load actions Message-ID: References: Date: Mon, 16 Sep 2013 12:30:47 -0400 In-Reply-To: (=?windows-1252?Q?=22Jo=E3o_T=E1vo?= =?windows-1252?Q?ra=22's?= message of "Sun, 15 Sep 2013 23:41:01 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-NAI-Spam-Flag: NO X-NAI-Spam-Threshold: 5 X-NAI-Spam-Score: 0 X-NAI-Spam-Rules: 1 Rules triggered RV4703=0 X-NAI-Spam-Version: 2.3.0.9362 : core <4703> : inlines <87> : streams <1038680> : uri <1538512> X-Spam-Score: -2.0 (--) X-Debbugs-Envelope-To: 15389 Cc: 15389@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.0 (--) > If I interactively eval these forms in order using `eval-last-sexp', for > example I get > foo1 > foo2 > in the *Messages* buffer. But if i load the file like so > emacs -Q --batch -l foo-test.el > I get > foo2 > foo1 > Is this the expected behaviour? No, indeed, thank you for the clear test case. Should now be fixed in the emacs-24 branch with the trivial patch below. Stefan --- lisp/subr.el 2013-07-03 03:13:07 +0000 +++ lisp/subr.el 2013-09-16 16:28:00 +0000 @@ -1872,7 +1872,7 @@ nil (remove-hook 'after-load-functions ',fun) ,',form))) - (add-hook 'after-load-functions fun)) + (add-hook 'after-load-functions fun 'append)) ;; Not being provided from a file, run form right now. ,form))) ;; Add FORM to the element unless it's already there. From debbugs-submit-bounces@debbugs.gnu.org Mon Sep 16 12:37:18 2013 Received: (at control) by debbugs.gnu.org; 16 Sep 2013 16:37:19 +0000 Received: from localhost ([127.0.0.1]:41379 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VLbnZ-0003gy-Gn for submit@debbugs.gnu.org; Mon, 16 Sep 2013 12:37:18 -0400 Received: from fencepost.gnu.org ([208.118.235.10]:51158 ident=Debian-exim) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VLbnV-0003gp-OU for control@debbugs.gnu.org; Mon, 16 Sep 2013 12:37:15 -0400 Received: from rgm by fencepost.gnu.org with local (Exim 4.71) (envelope-from ) id 1VLbnV-0002W0-A6 for control@debbugs.gnu.org; Mon, 16 Sep 2013 12:37:13 -0400 Date: Mon, 16 Sep 2013 12:37:13 -0400 Message-Id: Subject: control message for bug 15389 To: X-Mailer: mail (GNU Mailutils 2.1) From: Glenn Morris X-Spam-Score: -5.7 (-----) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.7 (-----) close 15389 24.4 From unknown Thu Jun 19 14:04:22 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Tue, 15 Oct 2013 11:24:04 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator