changeset 16015:f51aa92862ac

(make-auto-save-file-name): Try a few directories to get one we can write in.
author Richard M. Stallman <rms@gnu.org>
date Sun, 01 Sep 1996 00:20:33 +0000
parents 530b7973135f
children 2ee7579db4a9
files lisp/files.el
diffstat 1 files changed, 8 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/files.el	Sun Sep 01 00:14:32 1996 +0000
+++ b/lisp/files.el	Sun Sep 01 00:20:33 1996 +0000
@@ -2471,8 +2471,14 @@
 			  "\\\\")
 			(substring buffer-name (match-end 0))))
 	(setq limit (1+ (match-end 0))))
-
-      (expand-file-name (format "#%s#%s#" buffer-name (make-temp-name ""))))))
+      ;; Generate the file name.
+      (expand-file-name
+       (format "#%s#%s#" buffer-name (make-temp-name ""))
+       ;; Try a few alternative directories, to get one we can write it.
+       (cond
+	((file-writable-p default-directory) default-directory)
+	((file-writable-p "/var/tmp/") "/var/tmp/")
+	("~/"))))))
 
 (defun auto-save-file-name-p (filename)
   "Return non-nil if FILENAME can be yielded by `make-auto-save-file-name'.