diff lisp/files.el @ 5270:3acaa0fc09be

Use #'some, #'every, etc. for composing boolean operations on lists. 2010-09-16 Aidan Kehoe <kehoea@parhasard.net> * info.el (Info-insert-dir): * format.el (format-deannotate-region): * files.el (cd, save-buffers-kill-emacs): Use #'some, #'every and related functions for applying boolean operations to lists, instead of rolling our own ones that cons and don't short-circuit.
author Aidan Kehoe <kehoea@parhasard.net>
date Thu, 16 Sep 2010 15:58:10 +0100
parents d4fae3ebf26a
children f00192e1cd49 308d34e9f07d
line wrap: on
line diff
--- a/lisp/files.el	Thu Sep 16 15:34:35 2010 +0100
+++ b/lisp/files.el	Thu Sep 16 15:58:10 2010 +0100
@@ -606,15 +606,10 @@
 	(setq cd-path (or (and trypath
 			       (mapcar #'file-name-as-directory trypath))
 			  (list (file-name-as-directory "")))))
-      (or (catch 'found
-	    (mapc #'(lambda (x)
-                      (let ((f (expand-file-name (concat x dir))))
-                        (if (file-directory-p f)
-                            (progn
-                              (cd-absolute f)
-                              (throw 'found t)))))
-                  cd-path)
-	    nil)
+      (or (some #'(lambda (x)
+                    (let ((f (expand-file-name (concat x dir))))
+                      (when (file-directory-p f) (cd-absolute f))))
+                cd-path)
 	  ;; jwz: give a better error message to those of us with the
 	  ;; good taste not to use a kludge like $CDPATH.
 	  (if (equal cd-path '("./"))
@@ -4454,9 +4449,10 @@
 With prefix arg, silently save all file-visiting buffers, then kill."
   (interactive "P")
   (save-some-buffers arg t)
-  (and (or (not (memq t (mapcar #'(lambda (buf) (and (buffer-file-name buf)
-						     (buffer-modified-p buf)))
-				(buffer-list))))
+  (and (or (not (some #'(lambda (buf)
+                          (and (buffer-file-name buf)
+			       (buffer-modified-p buf)))
+                      (buffer-list)))
 	   (yes-or-no-p "Modified buffers exist; exit anyway? "))
        (or (not (fboundp 'process-list))
 	   ;; process-list is not defined on VMS.