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

Michael Albinus <michael.albinus@gmx.de> writes:

> Hi,
>
>>     ; * lisp/dired.el (dired-mouse-drag): Create local copy if file is remote.
>>
>> +              (let ((filename (with-selected-window (posn-window
>> +                                                     (event-end event))
>> +                                (dired-file-name-at-point))))
>> +                (when filename
>> +                  ;; In theory x-dnd-username combined with a proper
>> +                  ;; file URI containing the hostname of the remote
>> +                  ;; server could be used here instead of creating a
>> +                  ;; local copy of the remote file, but no program
>> +                  ;; actually implements file DND according to the
>> +                  ;; spec.
>> +                  (when (file-remote-p filename)
>> +                    (setq filename (file-local-copy filename)))
>> +                  (gui-backend-set-selection 'XdndSelection filename)
>> +                  (x-begin-drag '("text/uri-list"
>> +                                  "text/x-dnd-username")
>> +                                (if (eq 'dired-mouse-drag-files 'link)
>> +                                    'XdndActionLink
>> +                                  'XdndActionCopy)
>> +                                nil nil t)))
>
> 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?



  reply	other threads:[~2022-03-30  7:49 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 [this message]
2022-03-30  8:01       ` Michael Albinus
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=871qyjyj59.fsf@yahoo.com \
    --to=luangruo@yahoo.com \
    --cc=emacs-devel@gnu.org \
    --cc=michael.albinus@gmx.de \
    /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).