From 15233548eef90383d186130f45582a6034ed8e49 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Thu, 13 Sep 2001 12:41:41 +0000 Subject: [PATCH] (make-auto-save-file-name): If long file names are not supported, truncate the file name to DOS 8+3 limits before generating an auto-save file name from it. --- lisp/ChangeLog | 6 ++++++ lisp/files.el | 7 ++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index e5217519e17..f45f8e17f66 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2001-09-13 Eli Zaretskii + + * files.el (make-auto-save-file-name): If long file names are not + supported on MS-DOS, truncate the file name to DOS 8+3 limits before + generating an auto-save file name from it. + 2001-09-13 Gerd Moellmann * ps-print.el (ps-print-region, ps-print-region-with-faces) diff --git a/lisp/files.el b/lisp/files.el index 9964f708100..bdd5604417d 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -3264,7 +3264,12 @@ See also `auto-save-file-name-p'." (if (and (eq system-type 'ms-dos) (not (msdos-long-file-names))) - (let ((fn (file-name-nondirectory buffer-file-name))) + ;; We truncate the file name to DOS 8+3 limits before + ;; doing anything else, because the regexp passed to + ;; string-match below cannot handle extensions longer than + ;; 3 characters, multiple dots, and other atrocities. + (let ((fn (dos-8+3-filename + (file-name-nondirectory buffer-file-name)))) (string-match "\\`\\([^.]+\\)\\(\\.\\(..?\\)?.?\\|\\)\\'" fn) (concat (file-name-directory buffer-file-name) "#" (match-string 1 fn) -- 2.39.5