unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Michael Albinus <michael.albinus@gmx.de>
To: Po Lu <luangruo@yahoo.com>
Cc: emacs-devel@gnu.org
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	[thread overview]
Message-ID: <87v8vvc1hz.fsf@gmx.de> (raw)
In-Reply-To: <871qyjyj59.fsf@yahoo.com> (Po Lu's message of "Wed, 30 Mar 2022 15:49:38 +0800")

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.



  reply	other threads:[~2022-03-30  8:01 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <164862126656.8211.8114609736677843326@vcs2.savannah.gnu.org>
     [not found] ` <20220330062106.D045CC01684@vcs2.savannah.gnu.org>
2022-03-30  7:38   ` master 7a5f2b79e9: ; * lisp/dired.el (dired-mouse-drag): Create local copy if file is remote Michael Albinus
2022-03-30  7:49     ` Po Lu
2022-03-30  8:01       ` Michael Albinus [this message]
2022-03-30  8:28         ` Po Lu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87v8vvc1hz.fsf@gmx.de \
    --to=michael.albinus@gmx.de \
    --cc=emacs-devel@gnu.org \
    --cc=luangruo@yahoo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).