diff options
| author | Michael Albinus | 2016-08-10 12:10:26 +0200 |
|---|---|---|
| committer | Michael Albinus | 2016-08-10 12:10:26 +0200 |
| commit | c2664aaab68759ebd8cfb615c1f2fd73f065caa7 (patch) | |
| tree | f352f5cad05914e9329f04a21cdc784ed9c525ed | |
| parent | 5115743b672ed71d704a3afaac8b9bb2e4f09dd7 (diff) | |
| download | emacs-c2664aaab68759ebd8cfb615c1f2fd73f065caa7.tar.gz emacs-c2664aaab68759ebd8cfb615c1f2fd73f065caa7.zip | |
Add compatibility layer for `temporary-file-directory-function'
* lisp/net/tramp-compat.el
(tramp-compat-temporary-file-directory-function): New defalias.
* lisp/net/tramp.el (tramp-handle-make-nearby-temp-file): Use it.
* test/lisp/net/tramp-tests.el (tramp-test32-make-nearby-temp-file):
Skip for older Emacs versions.
| -rw-r--r-- | lisp/net/tramp-compat.el | 6 | ||||
| -rw-r--r-- | lisp/net/tramp.el | 3 | ||||
| -rw-r--r-- | test/lisp/net/tramp-tests.el | 3 |
3 files changed, 11 insertions, 1 deletions
diff --git a/lisp/net/tramp-compat.el b/lisp/net/tramp-compat.el index 348f9b8468c..b2f91016585 100644 --- a/lisp/net/tramp-compat.el +++ b/lisp/net/tramp-compat.el | |||
| @@ -118,6 +118,12 @@ Add the extension of F, if existing." | |||
| 118 | (extension (file-name-extension f t))) | 118 | (extension (file-name-extension f t))) |
| 119 | (make-temp-file prefix dir-flag extension))) | 119 | (make-temp-file prefix dir-flag extension))) |
| 120 | 120 | ||
| 121 | ;; `temporary-file-directory' as function is introduced with Emacs 25.2. | ||
| 122 | (defalias 'tramp-compat-temporary-file-directory-function | ||
| 123 | (if (fboundp 'temporary-file-directory) | ||
| 124 | 'temporary-file-directory | ||
| 125 | 'tramp-handle-temporary-file-directory)) | ||
| 126 | |||
| 121 | ;; PRESERVE-EXTENDED-ATTRIBUTES has been introduced with Emacs 24.1 | 127 | ;; PRESERVE-EXTENDED-ATTRIBUTES has been introduced with Emacs 24.1 |
| 122 | ;; (as PRESERVE-SELINUX-CONTEXT), and renamed in Emacs 24.3. | 128 | ;; (as PRESERVE-SELINUX-CONTEXT), and renamed in Emacs 24.3. |
| 123 | (defun tramp-compat-copy-file | 129 | (defun tramp-compat-copy-file |
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 29dd7038c09..429cd3646dc 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el | |||
| @@ -3996,7 +3996,8 @@ ALIST is of the form ((FROM . TO) ...)." | |||
| 3996 | 3996 | ||
| 3997 | (defun tramp-handle-make-nearby-temp-file (prefix &optional dir-flag suffix) | 3997 | (defun tramp-handle-make-nearby-temp-file (prefix &optional dir-flag suffix) |
| 3998 | "Like `make-nearby-temp-file' for Tramp files." | 3998 | "Like `make-nearby-temp-file' for Tramp files." |
| 3999 | (let ((temporary-file-directory (temporary-file-directory))) | 3999 | (let ((temporary-file-directory |
| 4000 | (tramp-compat-temporary-file-directory-function))) | ||
| 4000 | (make-temp-file prefix dir-flag suffix))) | 4001 | (make-temp-file prefix dir-flag suffix))) |
| 4001 | 4002 | ||
| 4002 | ;;; Compatibility functions section: | 4003 | ;;; Compatibility functions section: |
diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el index af705f6ce67..1735693cc21 100644 --- a/test/lisp/net/tramp-tests.el +++ b/test/lisp/net/tramp-tests.el | |||
| @@ -1934,9 +1934,12 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." | |||
| 1934 | (ignore-errors (delete-file tmp-name1)) | 1934 | (ignore-errors (delete-file tmp-name1)) |
| 1935 | (ignore-errors (delete-directory tmp-name2 'recursive))))) | 1935 | (ignore-errors (delete-directory tmp-name2 'recursive))))) |
| 1936 | 1936 | ||
| 1937 | ;; The functions have been introduced in Emacs 25.2. | ||
| 1937 | (ert-deftest tramp-test32-make-nearby-temp-file () | 1938 | (ert-deftest tramp-test32-make-nearby-temp-file () |
| 1938 | "Check `make-nearby-temp-file' and `temporary-file-directory'." | 1939 | "Check `make-nearby-temp-file' and `temporary-file-directory'." |
| 1939 | (skip-unless (tramp--test-enabled)) | 1940 | (skip-unless (tramp--test-enabled)) |
| 1941 | (skip-unless | ||
| 1942 | (and (fboundp 'make-nearby-temp-file) (fboundp 'temporary-file-directory))) | ||
| 1940 | 1943 | ||
| 1941 | (let ((default-directory tramp-test-temporary-file-directory) | 1944 | (let ((default-directory tramp-test-temporary-file-directory) |
| 1942 | tmp-file) | 1945 | tmp-file) |