comparison lisp/files.el @ 13749:2015901ab992

(make-backup-file-name, backup-file-name-p): Use ~ even on ms-dos.
author Karl Heuer <kwzh@gnu.org>
date Tue, 19 Dec 1995 21:30:13 +0000
parents 16b681bc9286
children 881e5c4a01cb
comparison
equal deleted inserted replaced
13748:d86c1aa43559 13749:2015901ab992
1594 "Create the non-numeric backup file name for FILE. 1594 "Create the non-numeric backup file name for FILE.
1595 This is a separate function so you can redefine it for customization." 1595 This is a separate function so you can redefine it for customization."
1596 (if (eq system-type 'ms-dos) 1596 (if (eq system-type 'ms-dos)
1597 (let ((fn (file-name-nondirectory file))) 1597 (let ((fn (file-name-nondirectory file)))
1598 (concat (file-name-directory file) 1598 (concat (file-name-directory file)
1599 (if (string-match "\\([^.]*\\)\\(\\..*\\)?" fn) 1599 (or
1600 (substring fn 0 (match-end 1))) 1600 (and (string-match "\\`[^.]+\\'" fn)
1601 ".bak")) 1601 (concat (match-string 0 fn) ".~"))
1602 (and (string-match "\\`[^.]+\\.\\(..?\\)?" fn)
1603 (concat (match-string 0 fn) "~")))))
1602 (concat file "~"))) 1604 (concat file "~")))
1603 1605
1604 (defun backup-file-name-p (file) 1606 (defun backup-file-name-p (file)
1605 "Return non-nil if FILE is a backup file name (numeric or not). 1607 "Return non-nil if FILE is a backup file name (numeric or not).
1606 This is a separate function so you can redefine it for customization. 1608 This is a separate function so you can redefine it for customization.
1607 You may need to redefine `file-name-sans-versions' as well." 1609 You may need to redefine `file-name-sans-versions' as well."
1608 (if (eq system-type 'ms-dos) 1610 (string-match "~\\'" file))
1609 (string-match "\\.bak$" file)
1610 (string-match "~$" file)))
1611 1611
1612 ;; This is used in various files. 1612 ;; This is used in various files.
1613 ;; The usage of bv-length is not very clean, 1613 ;; The usage of bv-length is not very clean,
1614 ;; but I can't see a good alternative, 1614 ;; but I can't see a good alternative,
1615 ;; so as of now I am leaving it alone. 1615 ;; so as of now I am leaving it alone.