From: Richard M. Stallman Date: Sun, 1 Sep 1996 00:20:33 +0000 (+0000) Subject: (make-auto-save-file-name): Try a few directories X-Git-Tag: emacs-20.1~3929 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=a8abaf83a47eaf0fd0196516629056d2bd861ad5;p=emacs.git (make-auto-save-file-name): Try a few directories to get one we can write in. --- diff --git a/lisp/files.el b/lisp/files.el index 84dd9391846..35c430c1942 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -2471,8 +2471,14 @@ See also `auto-save-file-name-p'." "\\\\") (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'.