Mercurial > emacs
comparison lisp/dired-aux.el @ 43904:18bde66fd00f
(dired-fun-in-all-buffers): Moved to dired.el.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Thu, 14 Mar 2002 08:55:48 +0000 |
parents | d1778d61917a |
children | 1541aec5edea |
comparison
equal
deleted
inserted
replaced
43903:9978ea345d85 | 43904:18bde66fd00f |
---|---|
784 (dired-add-entry file nil t) | 784 (dired-add-entry file nil t) |
785 ;; Replace space by old marker without moving point. | 785 ;; Replace space by old marker without moving point. |
786 ;; Faster than goto+insdel inside a save-excursion? | 786 ;; Faster than goto+insdel inside a save-excursion? |
787 (subst-char-in-region opoint (1+ opoint) ?\040 char)))) | 787 (subst-char-in-region opoint (1+ opoint) ?\040 char)))) |
788 (dired-move-to-filename)) | 788 (dired-move-to-filename)) |
789 | |
790 (defun dired-fun-in-all-buffers (directory file fun &rest args) | |
791 ;; In all buffers dired'ing DIRECTORY, run FUN with ARGS. | |
792 ;; If the buffer has a wildcard pattern, check that it matches FILE. | |
793 ;; (FILE does not include a directory component.) | |
794 ;; FILE may be nil, in which case ignore it. | |
795 ;; Return list of buffers where FUN succeeded (i.e., returned non-nil). | |
796 (let ((buf-list (dired-buffers-for-dir (expand-file-name directory) | |
797 file)) | |
798 (obuf (current-buffer)) | |
799 buf success-list) | |
800 (while buf-list | |
801 (setq buf (car buf-list) | |
802 buf-list (cdr buf-list)) | |
803 (unwind-protect | |
804 (progn | |
805 (set-buffer buf) | |
806 (if (apply fun args) | |
807 (setq success-list (cons (buffer-name buf) success-list)))) | |
808 (set-buffer obuf))) | |
809 success-list)) | |
810 | 789 |
811 ;;;###autoload | 790 ;;;###autoload |
812 (defun dired-add-file (filename &optional marker-char) | 791 (defun dired-add-file (filename &optional marker-char) |
813 (dired-fun-in-all-buffers | 792 (dired-fun-in-all-buffers |
814 (file-name-directory filename) (file-name-nondirectory filename) | 793 (file-name-directory filename) (file-name-nondirectory filename) |