emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Remote temporary directory (was: bug#23076: 24.5; vc-git: add a new vari


From: Michael Albinus
Subject: Remote temporary directory (was: bug#23076: 24.5; vc-git: add a new variable for log output coding system)
Date: Wed, 27 Jul 2016 11:57:42 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux)

[Moving the discussion to emacs-devel]

Eli Zaretskii <address@hidden> writes:

Hi Eli,

>> In general, it looks OK. Although I have reservations to use Tramp
>> internal functions outside the Tramp package. But there's no Tramp
>> equivalent to make-temp-file yet. Maybe we shall add such a function?
>
> Yes, I think we should.

Thinking about, a more general solution seems to be a function which
returns a temporary directory on a remote host. Something like this:

--8<---------------cut here---------------start------------->8---
(defun temporary-file-directory (&optional base)
  "The directory for writing temporary files.
BASE indicates the host where this directory is located.  If this
is a remote file name, the directory for writing temporary files
is located on the same host.  A local file name for BASE lets the
function return the value of the variable `temporary-file-directory'.

The default value of BASE is `default-directory'."
--8<---------------cut here---------------end--------------->8---

Then you could call

(let ((temporary-file-directory (temporary-file-directory)))
  (make-temp-file "my-prefix))

Similar for `make-temp-name'. And other use cases in `process-file' and
`start-file-process'.

WDYT?

Best regards, Michael.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]