changeset 17256:d8e38cfca028

(make-auto-save-file-name): Replace both / and \ with sequences starting with %.
author Richard M. Stallman <rms@gnu.org>
date Sat, 29 Mar 1997 00:32:54 +0000
parents 30b7f4899d66
children db95fd8937dc
files lisp/files.el
diffstat 1 files changed, 11 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/files.el	Fri Mar 28 22:58:58 1997 +0000
+++ b/lisp/files.el	Sat Mar 29 00:32:54 1997 +0000
@@ -2578,20 +2578,17 @@
 
     (let ((buffer-name (buffer-name))
 	  (limit 0))
-      ;; Use technique from Sebastian Kremer's auto-save
-      ;; package to turn slashes into \\!.  This ensures that
-      ;; the auto-save buffer name is unique.
-
-      (while (string-match "[/\\]" buffer-name limit)
-	(setq buffer-name (concat (substring buffer-name 0 (match-beginning 0))
-			(if (string= (substring buffer-name
-						(match-beginning 0)
-						(match-end 0))
-				     "/")
-			    "\\!"
-			  "\\\\")
-			(substring buffer-name (match-end 0))))
-	(setq limit (1+ (match-end 0))))
+      ;; Eliminate all slashes and backslashes by
+      ;; replacing them with sequences that start with %.
+      ;; Quote % also, to keep distinct names distinct.
+      (while (string-match "[/\\%]" buffer-name limit)
+	(let* ((character (aref buffer-name (match-beginning 0)))
+	       (replacement
+		(cond ((eq character ?%) "%%")
+		      ((eq character ?/) "%+")
+		      ((eq character ?\\) "%-"))))
+	  (setq buffer-name (replace-match replacement t t buffer-name))
+	  (setq limit (1+ (match-end 0)))))
       ;; Generate the file name.
       (expand-file-name
        (format "#%s#%s#" buffer-name (make-temp-name ""))