From: morioka Date: Sun, 25 Oct 1998 18:16:43 +0000 (+0000) Subject: (eval-after-load): New function. X-Git-Tag: apel-9_6~8 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2e581bd965e47917b94c554f5ff31af0d93c282d;p=elisp%2Fapel.git (eval-after-load): New function. --- diff --git a/poe-xemacs.el b/poe-xemacs.el index 5c2f28b..3391278 100644 --- a/poe-xemacs.el +++ b/poe-xemacs.el @@ -83,7 +83,41 @@ (concat ancestor (substring filename (match-end 0))))) ) - + +;;; @ for anything older than XEmacs 20.2 +;;; + +;; eval-after-load is not defined in XEmacs but after-load-alist is +;; usable. See subr.el in XEmacs. + +(defun-maybe 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'. +If FILE is already loaded, evaluate FORM right now. +It does nothing if FORM is already on the list for FILE. +FILE should be the name of a library, with no directory name." + ;; Make sure there is an element for FILE. + (or (assoc file after-load-alist) + (setq after-load-alist (cons (list file) after-load-alist))) + ;; Add FORM to the element if it isn't there. + (let ((elt (assoc file after-load-alist))) + (or (member form (cdr elt)) + (progn + (nconc elt (list form)) + ;; If the file has been loaded already, run FORM right away. + (and (assoc file load-history) + (eval form))))) + form) + +;; (defun-maybe eval-after-load (file form) +;; (or (assoc file after-load-alist) +;; (setq after-load-alist (cons (list file) after-load-alist))) +;; (let ((elt (assoc file after-load-alist))) +;; (or (member form (cdr elt)) +;; (nconc elt (list form)))) +;; form) + + ;;; @ Emacs 20.3 emulation ;;;