diff options
| author | Richard M. Stallman | 2002-03-14 08:55:20 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 2002-03-14 08:55:20 +0000 |
| commit | bf989169d3aa9c213dc85b0da1d20c20da9f0fdd (patch) | |
| tree | 402a72bb4d23d8a35fc633d0619a6482c67088ed | |
| parent | af1eab213c151c718a0894473f4d9543b03d6d61 (diff) | |
| download | emacs-bf989169d3aa9c213dc85b0da1d20c20da9f0fdd.tar.gz emacs-bf989169d3aa9c213dc85b0da1d20c20da9f0fdd.zip | |
(dired-readin): Clear out undo list.
(dired-fun-in-all-buffers): Definition moved from dired-aux.el.
(dired-delete-entry): New function.
(dired-internal-do-deletions): Use dired-fun-in-all-buffers
and dired-delete-entry, to update this buffer (and others).
| -rw-r--r-- | lisp/dired.el | 31 |
1 files changed, 28 insertions, 3 deletions
diff --git a/lisp/dired.el b/lisp/dired.el index 7c95bbe51ab..7dd5872b246 100644 --- a/lisp/dired.el +++ b/lisp/dired.el | |||
| @@ -636,6 +636,8 @@ If DIRNAME is already in a dired buffer, that buffer is used without refresh." | |||
| 636 | (let ((attributes (file-attributes dirname))) | 636 | (let ((attributes (file-attributes dirname))) |
| 637 | (if (eq (car attributes) t) | 637 | (if (eq (car attributes) t) |
| 638 | (set-visited-file-modtime (nth 5 attributes)))) | 638 | (set-visited-file-modtime (nth 5 attributes)))) |
| 639 | (if (consp buffer-undo-list) | ||
| 640 | (setq buffer-undo-list nil)) | ||
| 639 | (set-buffer-modified-p nil)))) | 641 | (set-buffer-modified-p nil)))) |
| 640 | 642 | ||
| 641 | ;; Subroutines of dired-readin | 643 | ;; Subroutines of dired-readin |
| @@ -2071,9 +2073,9 @@ if there are no flagged files." | |||
| 2071 | ;; if we get here, removing worked | 2073 | ;; if we get here, removing worked |
| 2072 | (setq succ (1+ succ)) | 2074 | (setq succ (1+ succ)) |
| 2073 | (message "%s of %s deletions" succ count) | 2075 | (message "%s of %s deletions" succ count) |
| 2074 | (delete-region (progn (beginning-of-line) (point)) | 2076 | (dired-fun-in-all-buffers |
| 2075 | (progn (forward-line 1) (point))) | 2077 | (file-name-directory fn) (file-name-nondirectory fn) |
| 2076 | (dired-clean-up-after-deletion fn)) | 2078 | (function dired-delete-entry) fn)) |
| 2077 | (error;; catch errors from failed deletions | 2079 | (error;; catch errors from failed deletions |
| 2078 | (dired-log "%s\n" err) | 2080 | (dired-log "%s\n" err) |
| 2079 | (setq failures (cons (car (car l)) failures))))) | 2081 | (setq failures (cons (car (car l)) failures))))) |
| @@ -2088,6 +2090,29 @@ if there are no flagged files." | |||
| 2088 | (message "(No deletions performed)"))) | 2090 | (message "(No deletions performed)"))) |
| 2089 | (dired-move-to-filename)) | 2091 | (dired-move-to-filename)) |
| 2090 | 2092 | ||
| 2093 | (defun dired-fun-in-all-buffers (directory file fun &rest args) | ||
| 2094 | ;; In all buffers dired'ing DIRECTORY, run FUN with ARGS. | ||
| 2095 | ;; If the buffer has a wildcard pattern, check that it matches FILE. | ||
| 2096 | ;; (FILE does not include a directory component.) | ||
| 2097 | ;; FILE may be nil, in which case ignore it. | ||
| 2098 | ;; Return list of buffers where FUN succeeded (i.e., returned non-nil). | ||
| 2099 | (let (success-list) | ||
| 2100 | (dolist (buf (dired-buffers-for-dir (expand-file-name directory) | ||
| 2101 | file)) | ||
| 2102 | (with-current-buffer buf | ||
| 2103 | (if (apply fun args) | ||
| 2104 | (setq success-list (cons (buffer-name buf) success-list))))) | ||
| 2105 | success-list)) | ||
| 2106 | |||
| 2107 | ;; Delete the entry for FILE from | ||
| 2108 | (defun dired-delete-entry (file) | ||
| 2109 | (save-excursion | ||
| 2110 | (and (dired-goto-file file) | ||
| 2111 | (let (buffer-read-only) | ||
| 2112 | (delete-region (progn (beginning-of-line) (point)) | ||
| 2113 | (save-excursion (forward-line 1) (point)))))) | ||
| 2114 | (dired-clean-up-after-deletion file)) | ||
| 2115 | |||
| 2091 | ;; This is a separate function for the sake of dired-x.el. | 2116 | ;; This is a separate function for the sake of dired-x.el. |
| 2092 | (defun dired-clean-up-after-deletion (fn) | 2117 | (defun dired-clean-up-after-deletion (fn) |
| 2093 | ;; Clean up after a deleted file or directory FN. | 2118 | ;; Clean up after a deleted file or directory FN. |