# HG changeset patch # User Aidan Kehoe # Date 1284649090 -3600 # Node ID 3acaa0fc09be8f63648b7b07d7bef4b63e729829 # Parent 90a0084b3541132a577136fc2c2b71f15f9955d3 Use #'some, #'every, etc. for composing boolean operations on lists. 2010-09-16 Aidan Kehoe * 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. diff -r 90a0084b3541 -r 3acaa0fc09be lisp/ChangeLog --- a/lisp/ChangeLog Thu Sep 16 15:34:35 2010 +0100 +++ b/lisp/ChangeLog Thu Sep 16 15:58:10 2010 +0100 @@ -1,3 +1,12 @@ +2010-09-16 Aidan Kehoe + + * 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. + 2010-09-16 Aidan Kehoe * bytecomp.el (byte-compile-initial-macro-environment): diff -r 90a0084b3541 -r 3acaa0fc09be lisp/files.el --- 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. diff -r 90a0084b3541 -r 3acaa0fc09be lisp/format.el --- a/lisp/format.el Thu Sep 16 15:34:35 2010 +0100 +++ b/lisp/format.el Thu Sep 16 15:58:10 2010 +0100 @@ -604,9 +604,8 @@ (if (member top-name ans) ;; This annotation is listed, but still have to ;; check if multiple annotations are satisfied - (if (member nil (mapcar (lambda (r) - (assoc r open-ans)) - ans)) + (if (notevery (lambda (r) (assoc r open-ans)) + ans) nil ; multiple ans not satisfied ;; If there are multiple annotations going ;; into one text property, split up the other diff -r 90a0084b3541 -r 3acaa0fc09be lisp/info.el --- a/lisp/info.el Thu Sep 16 15:34:35 2010 +0100 +++ b/lisp/info.el Thu Sep 16 15:58:10 2010 +0100 @@ -864,14 +864,13 @@ (if (and Info-dir-contents Info-dir-file-attributes ;; Verify that none of the files we used has changed ;; since we used it. - (eval (cons 'and - (mapcar #'(lambda (elt) - (let ((curr (file-attributes (car elt)))) - ;; Don't compare the access time. - (if curr (setcar (nthcdr 4 curr) 0)) - (setcar (nthcdr 4 (cdr elt)) 0) - (equal (cdr elt) curr))) - Info-dir-file-attributes)))) + (every #'(lambda (elt) + (let ((curr (file-attributes (car elt)))) + ;; Don't compare the access time. + (if curr (setcar (nthcdr 4 curr) 0)) + (setcar (nthcdr 4 (cdr elt)) 0) + (equal (cdr elt) curr))) + Info-dir-file-attributes)) (insert Info-dir-contents) (let ((dirs (reverse Info-directory-list)) buffers lbuffers buffer others nodes dirs-done)