emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r106344: eval-after-load fix for bug#


From: Glenn Morris
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r106344: eval-after-load fix for bug#10009
Date: Thu, 10 Nov 2011 20:46:03 -0500
User-agent: Bazaar (2.3.1)

------------------------------------------------------------
revno: 106344
committer: Glenn Morris <address@hidden>
branch nick: trunk
timestamp: Thu 2011-11-10 20:46:03 -0500
message:
  eval-after-load fix for bug#10009
  
  * lisp/subr.el (eval-after-load): If FILE is already loaded,
  evaluate FORM before it gets wrapped in more stuff.
modified:
  lisp/ChangeLog
  lisp/subr.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2011-11-10 02:36:48 +0000
+++ b/lisp/ChangeLog    2011-11-11 01:46:03 +0000
@@ -1,3 +1,8 @@
+2011-11-11  Glenn Morris  <address@hidden>
+
+       * subr.el (eval-after-load): If FILE is already loaded,
+       evaluate FORM before it gets wrapped in more stuff.  (Bug#10009)
+
 2011-11-10  Glenn Morris  <address@hidden>
 
        * vc/vc-svn.el (vc-svn-create-repo, vc-svn-modify-change-comment):

=== modified file 'lisp/subr.el'
--- a/lisp/subr.el      2011-10-31 10:53:16 +0000
+++ b/lisp/subr.el      2011-11-11 01:46:03 +0000
@@ -1797,30 +1797,29 @@
       (push elt after-load-alist))
     ;; Make sure `form' is evalled in the current lexical/dynamic code.
     (setq form `(funcall ',(eval `(lambda () ,form) lexical-binding)))
-    (when (symbolp regexp-or-feature)
-      ;; For features, the after-load-alist elements get run when `provide' is
-      ;; called rather than at the end of the file.  So add an indirection to
-      ;; make sure that `form' is really run "after-load" in case the provide
-      ;; call happens early.
-      (setq form
-            `(when load-file-name
-               (let ((fun (make-symbol "eval-after-load-helper")))
-                 (fset fun `(lambda (file)
-                              (if (not (equal file ',load-file-name))
-                                  nil
-                                (remove-hook 'after-load-functions ',fun)
-                                ,',form)))
-                 (add-hook 'after-load-functions fun)))))
-    ;; Add FORM to the element unless it's already there.
-    (unless (member form (cdr elt))
-      (nconc elt (purecopy (list form))))
-
     ;; Is there an already loaded file whose name (or `provide' name)
     ;; matches FILE?
-    (if (if (stringp file)
-           (load-history-filename-element regexp-or-feature)
-         (featurep file))
-       (eval form))))
+    (prog1 (if (if (stringp file)
+                  (load-history-filename-element regexp-or-feature)
+                (featurep file))
+              (eval form))
+      (when (symbolp regexp-or-feature)
+       ;; For features, the after-load-alist elements get run when `provide' is
+       ;; called rather than at the end of the file.  So add an indirection to
+       ;; make sure that `form' is really run "after-load" in case the provide
+       ;; call happens early.
+       (setq form
+             `(when load-file-name
+                (let ((fun (make-symbol "eval-after-load-helper")))
+                  (fset fun `(lambda (file)
+                               (if (not (equal file ',load-file-name))
+                                   nil
+                                 (remove-hook 'after-load-functions ',fun)
+                                 ,',form)))
+                  (add-hook 'after-load-functions fun)))))
+      ;; Add FORM to the element unless it's already there.
+      (unless (member form (cdr elt))
+       (nconc elt (purecopy (list form)))))))
 
 (defvar after-load-functions nil
   "Special hook run after loading a file.


reply via email to

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