Commit 68cbc58b authored by Glenn Morris's avatar Glenn Morris
Browse files

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.
parent 9a4de110
2011-11-11 Glenn Morris <rgm@gnu.org>
* 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 <rgm@gnu.org> 2011-11-10 Glenn Morris <rgm@gnu.org>
* vc/vc-svn.el (vc-svn-create-repo, vc-svn-modify-change-comment): * vc/vc-svn.el (vc-svn-create-repo, vc-svn-modify-change-comment):
......
...@@ -1797,6 +1797,12 @@ This function makes or adds to an entry on `after-load-alist'." ...@@ -1797,6 +1797,12 @@ This function makes or adds to an entry on `after-load-alist'."
(push elt after-load-alist)) (push elt after-load-alist))
;; Make sure `form' is evalled in the current lexical/dynamic code. ;; Make sure `form' is evalled in the current lexical/dynamic code.
(setq form `(funcall ',(eval `(lambda () ,form) lexical-binding))) (setq form `(funcall ',(eval `(lambda () ,form) lexical-binding)))
;; Is there an already loaded file whose name (or `provide' name)
;; matches FILE?
(prog1 (if (if (stringp file)
(load-history-filename-element regexp-or-feature)
(featurep file))
(eval form))
(when (symbolp regexp-or-feature) (when (symbolp regexp-or-feature)
;; For features, the after-load-alist elements get run when `provide' is ;; 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 ;; called rather than at the end of the file. So add an indirection to
...@@ -1813,14 +1819,7 @@ This function makes or adds to an entry on `after-load-alist'." ...@@ -1813,14 +1819,7 @@ This function makes or adds to an entry on `after-load-alist'."
(add-hook 'after-load-functions fun))))) (add-hook 'after-load-functions fun)))))
;; Add FORM to the element unless it's already there. ;; Add FORM to the element unless it's already there.
(unless (member form (cdr elt)) (unless (member form (cdr elt))
(nconc elt (purecopy (list form)))) (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))))
(defvar after-load-functions nil (defvar after-load-functions nil
"Special hook run after loading a file. "Special hook run after loading a file.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment