aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1995-02-22 01:30:19 +0000
committerRichard M. Stallman1995-02-22 01:30:19 +0000
commit909149386e5118fc29eb45769ff7f63dad19f360 (patch)
tree316a43559d01399d421298487c85c7a58e842589
parentfad2477b8090d98f8df9223d2ac38c7fee3f1c2c (diff)
downloademacs-909149386e5118fc29eb45769ff7f63dad19f360.tar.gz
emacs-909149386e5118fc29eb45769ff7f63dad19f360.zip
(eval-after-load): Run FORM now if FILE's already loaded.
-rw-r--r--lisp/subr.el9
1 files changed, 8 insertions, 1 deletions
diff --git a/lisp/subr.el b/lisp/subr.el
index 07bbdb45b5e..11abcdc3aa1 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -730,13 +730,20 @@ other hooks, such as major mode hooks, can do the job."
730(defun eval-after-load (file form) 730(defun eval-after-load (file form)
731 "Arrange that, if FILE is ever loaded, FORM will be run at that time. 731 "Arrange that, if FILE is ever loaded, FORM will be run at that time.
732This makes or adds to an entry on `after-load-alist'. 732This makes or adds to an entry on `after-load-alist'.
733If FILE is already loaded, evaluate FORM right now.
733It does nothing if FORM is already on the list for FILE. 734It does nothing if FORM is already on the list for FILE.
734FILE should be the name of a library, with no directory name." 735FILE should be the name of a library, with no directory name."
736 ;; Make sure there is an element for FILE.
735 (or (assoc file after-load-alist) 737 (or (assoc file after-load-alist)
736 (setq after-load-alist (cons (list file) after-load-alist))) 738 (setq after-load-alist (cons (list file) after-load-alist)))
739 ;; Add FORM to the element if it isn't there.
737 (let ((elt (assoc file after-load-alist))) 740 (let ((elt (assoc file after-load-alist)))
738 (or (member form (cdr elt)) 741 (or (member form (cdr elt))
739 (nconc elt (list form)))) 742 (progn
743 (nconc elt (list form))
744 ;; If the file has been loaded already, run FORM right away.
745 (and (assoc file load-history)
746 (eval form)))))
740 form) 747 form)
741 748
742(defun eval-next-after-load (file) 749(defun eval-next-after-load (file)