diff lisp/cus-edit.el @ 5645:5d3bb1100832

Remove some utility functions from the global namespace, lisp/ lisp/ChangeLog addition: 2012-04-07 Aidan Kehoe <kehoea@parhasard.net> Remove some utility functions from the global namespace, it's more appropriate to have them as labels (that is, lexically-visible functions.) * behavior.el: * behavior.el (behavior-menu-filter-1): Moved to being a label. * behavior.el (behavior-menu-filter): Use the label. * cus-edit.el (custom-load-symbol-1): Moved to being a label. * cus-edit.el (custom-load-symbol): Use the label. * menubar.el (find-menu-item-1): Moved to being a label. * menubar.el (find-menu-item): Use the label. * window-xemacs.el: * window-xemacs.el (display-buffer-1): Moved to being a label. * window-xemacs.el (display-buffer): Use the label; use (block ...) instead of (catch ...), use prog1 instead of needlessly binding a variable.
author Aidan Kehoe <kehoea@parhasard.net>
date Sat, 07 Apr 2012 21:57:31 +0100
parents 4dee0387b9de
children cc6f0266bc36
line wrap: on
line diff
--- a/lisp/cus-edit.el	Fri Mar 02 18:26:14 2012 +0000
+++ b/lisp/cus-edit.el	Sat Apr 07 21:57:31 2012 +0100
@@ -1684,33 +1684,28 @@
 
 (defun custom-load-symbol (symbol)
   "Load all dependencies for SYMBOL."
-  (unless custom-load-recursion
-    (let ((custom-load-recursion t)
-	  (loads (get symbol 'custom-loads))
-	  load)
-      (while loads
-	(setq load (car loads)
-	      loads (cdr loads))
-	(custom-load-symbol-1 load)))))
-
-(defun custom-load-symbol-1 (load)
-  (cond ((symbolp load)
-	 (condition-case nil
-	     (require load)
-	   (error nil)))
-	;; Don't reload a file already loaded.
-	((and (boundp 'preloaded-file-list)
-	      (member load preloaded-file-list)))
-	((assoc load load-history))
-	((assoc (locate-library load) load-history))
-	(t
-	 (condition-case nil
-	     ;; Without this, we would load cus-edit recursively.
-	     ;; We are still loading it when we call this,
-	     ;; and it is not in load-history yet.
-	     (or (equal load "cus-edit")
-		 (load-library load))
-	   (error nil)))))
+  (labels
+      ((custom-load-symbol-1 (load)
+	 (cond ((symbolp load)
+		(condition-case nil
+		    (require load)
+		  (error nil)))
+	       ;; Don't reload a file already loaded.
+	       ((and (boundp 'preloaded-file-list)
+		     (member load preloaded-file-list)))
+	       ((assoc load load-history))
+	       ((assoc (locate-library load) load-history))
+	       (t
+		(condition-case nil
+		    ;; Without this, we would load cus-edit recursively.
+		    ;; We are still loading it when we call this,
+		    ;; and it is not in load-history yet.
+		    (or (equal load "cus-edit")
+			(load-library load))
+		  (error nil))))))
+    (unless custom-load-recursion
+      (let ((custom-load-recursion t))
+        (map nil #'custom-load-symbol-1 (get symbol 'custom-loads))))))
 
 (defvar custom-already-loaded-custom-defines nil
   "List of already-loaded `custom-defines' files.")