summaryrefslogtreecommitdiff
path: root/lisp/files.el
diff options
context:
space:
mode:
authorGlenn Morris <rgm@gnu.org>2010-09-30 20:57:26 -0700
committerGlenn Morris <rgm@gnu.org>2010-09-30 20:57:26 -0700
commit1ef075bb27f5fa06dd668a5e9fac26029b5429bc (patch)
tree18f51c6546baf8eee040f0594eca31aae1c4d78c /lisp/files.el
parenta16f5f64c766b006d52d6decfef8ac47b77580b5 (diff)
downloademacs-1ef075bb27f5fa06dd668a5e9fac26029b5429bc.tar.gz
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).
Diffstat (limited to 'lisp/files.el')
-rw-r--r--lisp/files.el15
1 files changed, 15 insertions, 0 deletions
diff --git a/lisp/files.el b/lisp/files.el
index 40627f690f8..92574283dd7 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -190,12 +190,27 @@ If the buffer is visiting a new file, the value is nil.")
(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)