From: Richard M. Stallman Date: Wed, 5 Jan 1994 20:31:27 +0000 (+0000) Subject: (eval-after-load): Do nothing if FORM is already on the list. X-Git-Tag: emacs-19.34~10411 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=12c7071c31ee37d908f4e3f2b104332e3b543784;p=emacs.git (eval-after-load): Do nothing if FORM is already on the list. --- diff --git a/lisp/subr.el b/lisp/subr.el index 943c82f4941..b4f43ff9867 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -513,10 +513,13 @@ list of hooks to run in HOOK, then nothing is done. See `add-hook'." (defun eval-after-load (file form) "Arrange that, if FILE is ever loaded, FORM will be run at that time. This makes or adds to an entry on `after-load-alist'. +It does nothing if FORM is already on the list for FILE. FILE should be the name of a library, with no directory name." (or (assoc file after-load-alist) (setq after-load-alist (cons (list file) after-load-alist))) - (nconc (assoc file after-load-alist) (list form)) + (let ((elt (assoc file after-load-alist))) + (or (member form (cdr elt)) + (nconc elt (list form)))) form) (defun eval-next-after-load (file)