Subject: Re: bug#15389: 24.2.91; order of eval-after-load actions

From: Stefan Monnier <[email-masked]>
Date: Mon, 16 Sep 2013 12:30:47 -0400

> 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.