summaryrefslogtreecommitdiff
path: root/lisp/dired.el
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1993-05-24 23:03:04 +0000
committerRichard M. Stallman <rms@gnu.org>1993-05-24 23:03:04 +0000
commita91526b92753e943e6e72fbdea70cb123fd358f9 (patch)
tree6bd23c29b15fd3c1f1bff3df0eac250f3d38e59a /lisp/dired.el
parentd1f504609f9e56343a0375d25965d3f718b40eef (diff)
downloademacs-a91526b92753e943e6e72fbdea70cb123fd358f9.tar.gz
(dired-flag-backup-files): Speedup:
check explicitly for ~ at end of line. (dired-flag-auto-save-files): Similar change.
Diffstat (limited to 'lisp/dired.el')
-rw-r--r--lisp/dired.el20
1 files changed, 14 insertions, 6 deletions
diff --git a/lisp/dired.el b/lisp/dired.el
index cc7e575ac56..f26677d2063 100644
--- a/lisp/dired.el
+++ b/lisp/dired.el
@@ -1709,11 +1709,15 @@ A prefix argument says to unflag those files instead."
(interactive "P")
(let ((dired-marker-char (if unflag-p ?\040 dired-del-marker)))
(dired-mark-if
- (and (not (looking-at dired-re-dir))
- (let ((fn (dired-get-filename t t)))
- (if fn (auto-save-file-name-p
- (file-name-nondirectory fn)))))
- "auto save file")))
+ ;; It is less than general to check for ~ here,
+ ;; but it's the only way this runs fast enough.
+ (and (save-excursion (end-of-line)
+ (eq (preceding-char) ?#))
+ (not (looking-at dired-re-dir))
+ (let ((fn (dired-get-filename t t)))
+ (if fn (auto-save-file-name-p
+ (file-name-nondirectory fn)))))
+ "auto save file")))
(defun dired-flag-backup-files (&optional unflag-p)
"Flag all backup files (names ending with `~') for deletion.
@@ -1721,7 +1725,11 @@ With prefix argument, unflag these files."
(interactive "P")
(let ((dired-marker-char (if unflag-p ?\040 dired-del-marker)))
(dired-mark-if
- (and (not (looking-at dired-re-dir))
+ ;; It is less than general to check for ~ here,
+ ;; but it's the only way this runs fast enough.
+ (and (save-excursion (end-of-line)
+ (eq (preceding-char) ?~))
+ (not (looking-at dired-re-dir))
(let ((fn (dired-get-filename t t)))
(if fn (backup-file-name-p fn))))
"backup file")))