(extension (file-name-extension f t)))
(make-temp-file prefix dir-flag extension)))
+;; `temporary-file-directory' as function is introduced with Emacs 25.2.
+(defalias 'tramp-compat-temporary-file-directory-function
+ (if (fboundp 'temporary-file-directory)
+ 'temporary-file-directory
+ 'tramp-handle-temporary-file-directory))
+
;; PRESERVE-EXTENDED-ATTRIBUTES has been introduced with Emacs 24.1
;; (as PRESERVE-SELINUX-CONTEXT), and renamed in Emacs 24.3.
(defun tramp-compat-copy-file
(defun tramp-handle-make-nearby-temp-file (prefix &optional dir-flag suffix)
"Like `make-nearby-temp-file' for Tramp files."
- (let ((temporary-file-directory (temporary-file-directory)))
+ (let ((temporary-file-directory
+ (tramp-compat-temporary-file-directory-function)))
(make-temp-file prefix dir-flag suffix)))
;;; Compatibility functions section:
(ignore-errors (delete-file tmp-name1))
(ignore-errors (delete-directory tmp-name2 'recursive)))))
+;; The functions have been introduced in Emacs 25.2.
(ert-deftest tramp-test32-make-nearby-temp-file ()
"Check `make-nearby-temp-file' and `temporary-file-directory'."
(skip-unless (tramp--test-enabled))
+ (skip-unless
+ (and (fboundp 'make-nearby-temp-file) (fboundp 'temporary-file-directory)))
(let ((default-directory tramp-test-temporary-file-directory)
tmp-file)