emacs-devel
[Top][All Lists]
Advanced

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

Simplify `do-after-load-evaluation'


From: Juanma Barranquero
Subject: Simplify `do-after-load-evaluation'
Date: Sat, 29 Aug 2009 21:41:57 +0200

I was going to remove unused local vars file-element and file-elements
from `do-after-load-evaluation', but on second thought, would someone
object to the following simplification? (The original code is a bit
opaque for the really simple work it does):

Index: subr.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/subr.el,v
retrieving revision 1.646
diff -u -2 -r1.646 subr.el
--- subr.el     27 Aug 2009 04:24:08 -0000      1.646
+++ subr.el     29 Aug 2009 19:36:31 -0000
@@ -1689,14 +1689,9 @@
   "Evaluate all `eval-after-load' forms, if any, for ABS-FILE.
 ABS-FILE, a string, should be the absolute true name of a file just loaded."
-  (let ((after-load-elts after-load-alist)
-       a-l-element file-elements file-element form)
-    (while after-load-elts
-      (setq a-l-element (car after-load-elts)
-           after-load-elts (cdr after-load-elts))
-      (when (and (stringp (car a-l-element))
-                (string-match (car a-l-element) abs-file))
-       (while (setq a-l-element (cdr a-l-element)) ; discard the file name
-         (setq form (car a-l-element))
-         (eval form))))))
+  (dolist (a-l-element after-load-alist)
+    (when (and (stringp (car a-l-element))
+              (string-match-p (car a-l-element) abs-file))
+      ;; discard the file name regexp
+      (mapc #'eval (cdr a-l-element)))))

 (defun eval-next-after-load (file)




reply via email to

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