changeset 7895:fac7ff0a7aeb

(make-auto-save-file-name): Don't use slashes in autosave name for a non-file buffer.
author Karl Heuer <kwzh@gnu.org>
date Wed, 15 Jun 1994 02:43:39 +0000
parents d385199b26b6
children ec45b17e09b3
files lisp/files.el
diffstat 1 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/files.el	Wed Jun 15 01:09:17 1994 +0000
+++ b/lisp/files.el	Wed Jun 15 02:43:39 1994 +0000
@@ -1951,7 +1951,14 @@
 	      (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'.