summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Heuer <kwzh@gnu.org>1995-12-13 19:42:33 +0000
committerKarl Heuer <kwzh@gnu.org>1995-12-13 19:42:33 +0000
commit6c919b6540637b939f5d6fb6f05bb950c000c547 (patch)
treef1f18c420001a9b78b0416081f584f220d4fdd6d
parent7d5f9e4189ef5e8252e657bbdc80e7e59f93148a (diff)
downloademacs-6c919b6540637b939f5d6fb6f05bb950c000c547.tar.gz
(dired-flag-backup-files): Under MS-DOS, search for
possible backup files by checking for filenames which end with a `k' (the backup extension is `.bak').
-rw-r--r--lisp/dired.el23
1 files changed, 11 insertions, 12 deletions
diff --git a/lisp/dired.el b/lisp/dired.el
index 8d6b4058e34..5782e0ab012 100644
--- a/lisp/dired.el
+++ b/lisp/dired.el
@@ -2012,21 +2012,20 @@ A prefix argument says to unflag those files instead."
"Flag all backup files (names ending with `~') for deletion.
With prefix argument, unflag these files."
(interactive "P")
- (let ((dired-marker-char (if unflag-p ?\040 dired-del-marker)))
+ (let ((dired-marker-char (if unflag-p ?\ dired-del-marker))
+ (last-c (if (eq system-type 'ms-dos) ?k ?~)))
(dired-mark-if
- ;; It is less than general to check for ~ here,
+ ;; Don't call backup-file-name-p unless the last character looks like
+ ;; it might be the end of a backup file name. This isn't very general,
;; but it's the only way this runs fast enough.
(and (save-excursion (end-of-line)
- (or
- (eq (preceding-char) ?~)
- ;; Handle executables in case of -F option.
- ;; We need not worry about the other kinds
- ;; of markings that -F makes, since they won't
- ;; appear on real backup files.
- (if (eq (preceding-char) ?*)
- (progn
- (forward-char -1)
- (eq (preceding-char) ?~)))))
+ ;; Handle executables in case of -F option.
+ ;; We need not worry about the other kinds
+ ;; of markings that -F makes, since they won't
+ ;; appear on real backup files.
+ (if (eq (preceding-char) ?*)
+ (forward-char -1))
+ (eq (preceding-char) last-c))
(not (looking-at dired-re-dir))
(let ((fn (dired-get-filename t t)))
(if fn (backup-file-name-p fn))))