emacs-diffs
[Top][All Lists]
Advanced

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

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


From: Glenn Morris
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r107610: eval-after-load fix for bug#10946
Date: Thu, 15 Mar 2012 21:27:23 -0400
User-agent: Bazaar (2.3.1)

------------------------------------------------------------
revno: 107610
committer: Glenn Morris <address@hidden>
branch nick: trunk
timestamp: Thu 2012-03-15 21:27:23 -0400
message:
  eval-after-load fix for bug#10946
  
  * lisp/subr.el (eval-after-load): If named feature is provided not
  from a file, run after-load forms.
modified:
  lisp/ChangeLog
  lisp/subr.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2012-03-16 01:10:46 +0000
+++ b/lisp/ChangeLog    2012-03-16 01:27:23 +0000
@@ -1,5 +1,8 @@
 2012-03-16  Glenn Morris  <address@hidden>
 
+       * subr.el (eval-after-load): If named feature is provided not from
+       a file, run after-load forms.  (Bug#10946)
+
        * calendar/calendar.el (calendar-insert-at-column):
        Handle non-unit-width characters a bit better.  (Bug#10978)
 

=== modified file 'lisp/subr.el'
--- a/lisp/subr.el      2012-03-11 16:16:50 +0000
+++ b/lisp/subr.el      2012-03-16 01:27:23 +0000
@@ -1785,6 +1785,8 @@
 
 Alternatively, FILE can be a feature (i.e. a symbol), in which case FORM
 is evaluated at the end of any file that `provide's this feature.
+If the feature is provided when evaluating code not associated with a
+file, FORM is evaluated immediately after the provide statement.
 
 Usually FILE is just a library name like \"font-lock\" or a feature name
 like 'font-lock.
@@ -1814,14 +1816,16 @@
        ;; 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)))))
+             `(if 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))
+                ;; Not being provided from a file, run form right now.
+                ,form)))
       ;; Add FORM to the element unless it's already there.
       (unless (member form (cdr elt))
        (nconc elt (purecopy (list form)))))))


reply via email to

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