comparison lisp/dired.el @ 13726:0611604f3cd3

(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').
author Karl Heuer <kwzh@gnu.org>
date Wed, 13 Dec 1995 19:42:33 +0000
parents 216edf9576ea
children 6a9cecd5bcfb
comparison
equal deleted inserted replaced
13725:9729af46fe60 13726:0611604f3cd3
2010 2010
2011 (defun dired-flag-backup-files (&optional unflag-p) 2011 (defun dired-flag-backup-files (&optional unflag-p)
2012 "Flag all backup files (names ending with `~') for deletion. 2012 "Flag all backup files (names ending with `~') for deletion.
2013 With prefix argument, unflag these files." 2013 With prefix argument, unflag these files."
2014 (interactive "P") 2014 (interactive "P")
2015 (let ((dired-marker-char (if unflag-p ?\040 dired-del-marker))) 2015 (let ((dired-marker-char (if unflag-p ?\ dired-del-marker))
2016 (last-c (if (eq system-type 'ms-dos) ?k ?~)))
2016 (dired-mark-if 2017 (dired-mark-if
2017 ;; It is less than general to check for ~ here, 2018 ;; Don't call backup-file-name-p unless the last character looks like
2019 ;; it might be the end of a backup file name. This isn't very general,
2018 ;; but it's the only way this runs fast enough. 2020 ;; but it's the only way this runs fast enough.
2019 (and (save-excursion (end-of-line) 2021 (and (save-excursion (end-of-line)
2020 (or 2022 ;; Handle executables in case of -F option.
2021 (eq (preceding-char) ?~) 2023 ;; We need not worry about the other kinds
2022 ;; Handle executables in case of -F option. 2024 ;; of markings that -F makes, since they won't
2023 ;; We need not worry about the other kinds 2025 ;; appear on real backup files.
2024 ;; of markings that -F makes, since they won't 2026 (if (eq (preceding-char) ?*)
2025 ;; appear on real backup files. 2027 (forward-char -1))
2026 (if (eq (preceding-char) ?*) 2028 (eq (preceding-char) last-c))
2027 (progn
2028 (forward-char -1)
2029 (eq (preceding-char) ?~)))))
2030 (not (looking-at dired-re-dir)) 2029 (not (looking-at dired-re-dir))
2031 (let ((fn (dired-get-filename t t))) 2030 (let ((fn (dired-get-filename t t)))
2032 (if fn (backup-file-name-p fn)))) 2031 (if fn (backup-file-name-p fn))))
2033 "backup file"))) 2032 "backup file")))
2034 2033