changeset 110669:1ec34887255d

Tweak temporary-file-directory on darwin systems. * lisp/files.el (temporary-file-directory): On darwin, also try DARWIN_USER_TEMP_DIR (see discussion in bug#7135).
author Glenn Morris <rgm@gnu.org>
date Thu, 30 Sep 2010 20:57:26 -0700
parents 838ae151fca7
children bd7b628a1f67
files lisp/ChangeLog lisp/files.el
diffstat 2 files changed, 20 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Fri Oct 01 03:28:45 2010 +0200
+++ b/lisp/ChangeLog	Thu Sep 30 20:57:26 2010 -0700
@@ -1,3 +1,8 @@
+2010-10-01  Glenn Morris  <rgm@gnu.org>
+
+	* files.el (temporary-file-directory): On darwin, also try
+	DARWIN_USER_TEMP_DIR (see discussion in bug#7135).
+
 2010-10-01  Juanma Barranquero  <lekktu@gmail.com>
 
 	* server.el (server-start): Revert part of revno 101688.
--- a/lisp/files.el	Fri Oct 01 03:28:45 2010 +0200
+++ b/lisp/files.el	Thu Sep 30 20:57:26 2010 -0700
@@ -190,12 +190,27 @@
 
 (defcustom temporary-file-directory
   (file-name-as-directory
+   ;; FIXME ? Should there be Ftemporary_file_directory to do the
+   ;; following more robustly (cf set_local_socket in emacsclient.c).
+   ;; It could be used elsewhere, eg Fcall_process_region, server-socket-dir.
+   ;; See bug#7135.
    (cond ((memq system-type '(ms-dos windows-nt))
 	  (or (getenv "TEMP") (getenv "TMPDIR") (getenv "TMP") "c:/temp"))
+	 ((eq system-type 'darwin)
+	  (or (getenv "TMPDIR") (getenv "TMP") (getenv "TEMP")
+	      (let ((tmp (ignore-errors (shell-command-to-string ; bug#7135
+					 "getconf DARWIN_USER_TEMP_DIR"))))
+		(and (stringp tmp)
+		     (setq tmp (replace-regexp-in-string "\n\\'" "" tmp))
+		     ;; This handles "getconf: Unrecognized variable..."
+		     (file-directory-p tmp)
+		     tmp))
+	      "/tmp"))
 	 (t
 	  (or (getenv "TMPDIR") (getenv "TMP") (getenv "TEMP") "/tmp"))))
   "The directory for writing temporary files."
   :group 'files
+  ;; Darwin section added 24.1, does not seem worth :version bump.
   :initialize 'custom-initialize-delay
   :type 'directory)