[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: master 7a5f2b79e9: ; * lisp/dired.el (dired-mouse-drag): Create loca
From: |
Michael Albinus |
Subject: |
Re: master 7a5f2b79e9: ; * lisp/dired.el (dired-mouse-drag): Create local copy if file is remote. |
Date: |
Wed, 30 Mar 2022 10:01:44 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) |
Po Lu <luangruo@yahoo.com> writes:
>> Reading the code, it looks to me like you need to remove the local copy
>> later. Otherwise, it will trash your temp directory.
>
> Ah, thanks. I always thought the old file would be removed
> automatically after a while (i.e. when a new file is created).
>
> The problem is that there's no way to know when the drop target has
> finished opening the file, so the best solution is probably to remove
> the old file when a new file is created.
>
> WDYT?
You must remember the file name of the "old" local copy, because it is
random.
--8<---------------cut here---------------start------------->8---
(file-local-copy "/ssh::.emacs")
=> "/tmp/tramp.k2vQK0"
--8<---------------cut here---------------end--------------->8---
An (undocumented) possibility would be to let-bind
tramp-temp-name-prefix to something else. Then you could easily identify
your own temp files.
--8<---------------cut here---------------start------------->8---
(let ((tramp-temp-name-prefix "my-own-prefix."))
(file-local-copy "/ssh::.emacs"))
=> "/tmp/my-own-prefix.HDfgDZ"
--8<---------------cut here---------------end--------------->8---
Best regards, Michael.