emacs-devel
[Top][All Lists]
Advanced

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

Re: master 7a5f2b79e9: ; * lisp/dired.el (dired-mouse-drag): Create loca


From: Po Lu
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
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.91 (gnu/linux)

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 via email to

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