Mercurial > hg > xemacs-beta
comparison 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 |
comparison
equal
deleted
inserted
replaced
5269:90a0084b3541 | 5270:3acaa0fc09be |
---|---|
604 ;; do under Windows. | 604 ;; do under Windows. |
605 (unless (and cd-path (equal cdpath-current cdpath-previous)) | 605 (unless (and cd-path (equal cdpath-current cdpath-previous)) |
606 (setq cd-path (or (and trypath | 606 (setq cd-path (or (and trypath |
607 (mapcar #'file-name-as-directory trypath)) | 607 (mapcar #'file-name-as-directory trypath)) |
608 (list (file-name-as-directory ""))))) | 608 (list (file-name-as-directory ""))))) |
609 (or (catch 'found | 609 (or (some #'(lambda (x) |
610 (mapc #'(lambda (x) | 610 (let ((f (expand-file-name (concat x dir)))) |
611 (let ((f (expand-file-name (concat x dir)))) | 611 (when (file-directory-p f) (cd-absolute f)))) |
612 (if (file-directory-p f) | 612 cd-path) |
613 (progn | |
614 (cd-absolute f) | |
615 (throw 'found t))))) | |
616 cd-path) | |
617 nil) | |
618 ;; jwz: give a better error message to those of us with the | 613 ;; jwz: give a better error message to those of us with the |
619 ;; good taste not to use a kludge like $CDPATH. | 614 ;; good taste not to use a kludge like $CDPATH. |
620 (if (equal cd-path '("./")) | 615 (if (equal cd-path '("./")) |
621 (error "No such directory: %s" (expand-file-name dir)) | 616 (error "No such directory: %s" (expand-file-name dir)) |
622 (error "Directory not found in $CDPATH: %s" dir)))))) | 617 (error "Directory not found in $CDPATH: %s" dir)))))) |
4452 (defun save-buffers-kill-emacs (&optional arg) | 4447 (defun save-buffers-kill-emacs (&optional arg) |
4453 "Offer to save each buffer, then kill this XEmacs process. | 4448 "Offer to save each buffer, then kill this XEmacs process. |
4454 With prefix arg, silently save all file-visiting buffers, then kill." | 4449 With prefix arg, silently save all file-visiting buffers, then kill." |
4455 (interactive "P") | 4450 (interactive "P") |
4456 (save-some-buffers arg t) | 4451 (save-some-buffers arg t) |
4457 (and (or (not (memq t (mapcar #'(lambda (buf) (and (buffer-file-name buf) | 4452 (and (or (not (some #'(lambda (buf) |
4458 (buffer-modified-p buf))) | 4453 (and (buffer-file-name buf) |
4459 (buffer-list)))) | 4454 (buffer-modified-p buf))) |
4455 (buffer-list))) | |
4460 (yes-or-no-p "Modified buffers exist; exit anyway? ")) | 4456 (yes-or-no-p "Modified buffers exist; exit anyway? ")) |
4461 (or (not (fboundp 'process-list)) | 4457 (or (not (fboundp 'process-list)) |
4462 ;; process-list is not defined on VMS. | 4458 ;; process-list is not defined on VMS. |
4463 (let ((processes (process-list)) | 4459 (let ((processes (process-list)) |
4464 active) | 4460 active) |