diff options
| author | Richard M. Stallman | 2002-03-29 14:43:14 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 2002-03-29 14:43:14 +0000 |
| commit | 1312bfc633ffb1d9a7e2c350922e78e7c82e79ea (patch) | |
| tree | 6390a6dece8a8d329babcf22d448620845f9a49f | |
| parent | d88c92eb325c8ced8b2dac9f08d8a52bbbd573e3 (diff) | |
| download | emacs-1312bfc633ffb1d9a7e2c350922e78e7c82e79ea.tar.gz emacs-1312bfc633ffb1d9a7e2c350922e78e7c82e79ea.zip | |
(dired-get-marked-files): New arg FILTER allows selection of some files.
| -rw-r--r-- | lisp/dired.el | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/lisp/dired.el b/lisp/dired.el index ad12b5c34ac..75cc631c0a4 100644 --- a/lisp/dired.el +++ b/lisp/dired.el | |||
| @@ -397,18 +397,28 @@ BODY should not be too long as it is expanded four times." | |||
| 397 | ;; save-excursion loses, again | 397 | ;; save-excursion loses, again |
| 398 | (dired-move-to-filename))) | 398 | (dired-move-to-filename))) |
| 399 | 399 | ||
| 400 | (defun dired-get-marked-files (&optional localp arg) | 400 | (defun dired-get-marked-files (&optional localp arg filter) |
| 401 | "Return the marked files' names as list of strings. | 401 | "Return the marked files' names as list of strings. |
| 402 | The list is in the same order as the buffer, that is, the car is the | 402 | The list is in the same order as the buffer, that is, the car is the |
| 403 | first marked file. | 403 | first marked file. |
| 404 | Values returned are normally absolute pathnames. | 404 | Values returned are normally absolute file names. |
| 405 | Optional arg LOCALP as in `dired-get-filename'. | 405 | Optional arg LOCALP as in `dired-get-filename'. |
| 406 | Optional second argument ARG forces to use other files. If ARG is an | 406 | Optional second argument ARG specifies files near point |
| 407 | integer, use the next ARG files. If ARG is otherwise non-nil, use | 407 | instead of marked files. If ARG is an integer, use the next ARG files. |
| 408 | current file. Usually ARG comes from the current prefix arg." | 408 | If ARG is otherwise non-nil, use file. Usually ARG comes from |
| 409 | (save-excursion | 409 | the command's prefix arg. |
| 410 | (nreverse (dired-map-over-marks (dired-get-filename localp) arg)))) | 410 | Optional third argument FILTER, if non-nil, is a function to select |
| 411 | 411 | some of the files--those for which (funcall FILTER FILENAME) is non-nil." | |
| 412 | (let ((all-of-them | ||
| 413 | (save-excursion | ||
| 414 | (dired-map-over-marks (dired-get-filename localp) arg))) | ||
| 415 | result) | ||
| 416 | (if (not filter) | ||
| 417 | (nreverse all-of-them) | ||
| 418 | (dolist (file all-of-them) | ||
| 419 | (if (funcall filter file) | ||
| 420 | (push file result))) | ||
| 421 | result))) | ||
| 412 | 422 | ||
| 413 | ;; Function dired-ls is redefinable for VMS, ange-ftp, Prospero or | 423 | ;; Function dired-ls is redefinable for VMS, ange-ftp, Prospero or |
| 414 | ;; other special applications. | 424 | ;; other special applications. |