| 4065 | | (let ((list auto-save-file-name-transforms) |
|---|
| 4066 | | (filename buffer-file-name) |
|---|
| 4067 | | result uniq) |
|---|
| 4068 | | ;; Apply user-specified translations |
|---|
| 4069 | | ;; to the file name. |
|---|
| 4070 | | (while (and list (not result)) |
|---|
| 4071 | | (if (string-match (car (car list)) filename) |
|---|
| 4072 | | (setq result (replace-match (cadr (car list)) t nil |
|---|
| 4073 | | filename) |
|---|
| 4074 | | uniq (car (cddr (car list))))) |
|---|
| 4075 | | (setq list (cdr list))) |
|---|
| 4076 | | (if result |
|---|
| 4077 | | (if uniq |
|---|
| 4078 | | (setq filename (concat |
|---|
| 4079 | | (file-name-directory result) |
|---|
| 4080 | | (subst-char-in-string |
|---|
| 4081 | | ?/ ?! |
|---|
| 4082 | | (replace-regexp-in-string "!" "!!" |
|---|
| 4083 | | filename)))) |
|---|
| 4084 | | (setq filename result))) |
|---|
| 4085 | | (setq result |
|---|
| 4086 | | (if (and (eq system-type 'ms-dos) |
|---|
| 4087 | | (not (msdos-long-file-names))) |
|---|
| 4088 | | ;; We truncate the file name to DOS 8+3 limits |
|---|
| 4089 | | ;; before doing anything else, because the regexp |
|---|
| 4090 | | ;; passed to string-match below cannot handle |
|---|
| 4091 | | ;; extensions longer than 3 characters, multiple |
|---|
| 4092 | | ;; dots, and other atrocities. |
|---|
| 4093 | | (let ((fn (dos-8+3-filename |
|---|
| 4094 | | (file-name-nondirectory buffer-file-name)))) |
|---|
| 4095 | | (string-match |
|---|
| 4096 | | "\\`\\([^.]+\\)\\(\\.\\(..?\\)?.?\\|\\)\\'" |
|---|
| 4097 | | fn) |
|---|
| 4098 | | (concat (file-name-directory buffer-file-name) |
|---|
| 4099 | | "#" (match-string 1 fn) |
|---|
| 4100 | | "." (match-string 3 fn) "#")) |
|---|
| 4101 | | (concat (file-name-directory filename) |
|---|
| 4102 | | "#" |
|---|
| 4103 | | (file-name-nondirectory filename) |
|---|
| 4104 | | "#"))) |
|---|
| 4105 | | ;; Make sure auto-save file names don't contain characters |
|---|
| 4106 | | ;; invalid for the underlying filesystem. |
|---|
| 4107 | | (if (and (memq system-type '(ms-dos windows-nt)) |
|---|
| 4108 | | ;; Don't modify remote (ange-ftp) filenames |
|---|
| 4109 | | (not (string-match "^/\\w+@[-A-Za-z0-9._]+:" result))) |
|---|
| 4110 | | (convert-standard-filename result) |
|---|
| 4111 | | result)) |
|---|
| | 4068 | (let ((handler (find-file-name-handler buffer-file-name |
|---|
| | 4069 | 'make-auto-save-file-name))) |
|---|
| | 4070 | (if handler |
|---|
| | 4071 | (funcall handler 'make-auto-save-file-name) |
|---|
| | 4072 | (let ((list auto-save-file-name-transforms) |
|---|
| | 4073 | (filename buffer-file-name) |
|---|
| | 4074 | result uniq) |
|---|
| | 4075 | ;; Apply user-specified translations |
|---|
| | 4076 | ;; to the file name. |
|---|
| | 4077 | (while (and list (not result)) |
|---|
| | 4078 | (if (string-match (car (car list)) filename) |
|---|
| | 4079 | (setq result (replace-match (cadr (car list)) t nil |
|---|
| | 4080 | filename) |
|---|
| | 4081 | uniq (car (cddr (car list))))) |
|---|
| | 4082 | (setq list (cdr list))) |
|---|
| | 4083 | (if result |
|---|
| | 4084 | (if uniq |
|---|
| | 4085 | (setq filename (concat |
|---|
| | 4086 | (file-name-directory result) |
|---|
| | 4087 | (subst-char-in-string |
|---|
| | 4088 | ?/ ?! |
|---|
| | 4089 | (replace-regexp-in-string "!" "!!" |
|---|
| | 4090 | filename)))) |
|---|
| | 4091 | (setq filename result))) |
|---|
| | 4092 | (setq result |
|---|
| | 4093 | (if (and (eq system-type 'ms-dos) |
|---|
| | 4094 | (not (msdos-long-file-names))) |
|---|
| | 4095 | ;; We truncate the file name to DOS 8+3 limits |
|---|
| | 4096 | ;; before doing anything else, because the regexp |
|---|
| | 4097 | ;; passed to string-match below cannot handle |
|---|
| | 4098 | ;; extensions longer than 3 characters, multiple |
|---|
| | 4099 | ;; dots, and other atrocities. |
|---|
| | 4100 | (let ((fn (dos-8+3-filename |
|---|
| | 4101 | (file-name-nondirectory buffer-file-name)))) |
|---|
| | 4102 | (string-match |
|---|
| | 4103 | "\\`\\([^.]+\\)\\(\\.\\(..?\\)?.?\\|\\)\\'" |
|---|
| | 4104 | fn) |
|---|
| | 4105 | (concat (file-name-directory buffer-file-name) |
|---|
| | 4106 | "#" (match-string 1 fn) |
|---|
| | 4107 | "." (match-string 3 fn) "#")) |
|---|
| | 4108 | (concat (file-name-directory filename) |
|---|
| | 4109 | "#" |
|---|
| | 4110 | (file-name-nondirectory filename) |
|---|
| | 4111 | "#"))) |
|---|
| | 4112 | ;; Make sure auto-save file names don't contain characters |
|---|
| | 4113 | ;; invalid for the underlying filesystem. |
|---|
| | 4114 | (if (and (memq system-type '(ms-dos windows-nt)) |
|---|
| | 4115 | ;; Don't modify remote (ange-ftp) filenames |
|---|
| | 4116 | (not (string-match "^/\\w+@[-A-Za-z0-9._]+:" result))) |
|---|
| | 4117 | (convert-standard-filename result) |
|---|
| | 4118 | result)))) |
|---|