1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2025-01-03 11:33:37 +00:00

(make-auto-save-file-name): Don't use slashes in autosave name for a non-file

buffer.
This commit is contained in:
Karl Heuer 1994-06-15 02:43:39 +00:00
parent 1fefcb09d3
commit 7d483e8c84

View File

@ -1951,7 +1951,14 @@ See also `auto-save-file-name-p'."
(file-name-nondirectory buffer-file-name)
"#")
;; For non-file bfr, use bfr name and Emacs pid.
(expand-file-name (format "#%s#%s#" (buffer-name) (make-temp-name "")))))
;; Don't allow slashes, though; auto-save would try to interpret it
;; as a pathname, and it might not exist.
(let ((buffer-name (buffer-name))
(save-match-data (match-data)))
(while (string-match "/" buffer-name)
(aset buffer-name (match-beginning 0) ?-))
(store-match-data save-match-data)
(expand-file-name (format "#%s#%s#" buffer-name (make-temp-name ""))))))
(defun auto-save-file-name-p (filename)
"Return non-nil if FILENAME can be yielded by `make-auto-save-file-name'.