Subject: Re: bug#44216: 28.0.50; Incorret during delete in Tramp: Trashing...done

From: Jean Louis <[email-masked]>
Date: Mon, 26 Oct 2020 14:51:48 +0300

That is great if the Tramp is looking for remote `trash' command, as
there is software `trash-cli' it is named `trash' and it is
compatible with GNU rm. It is convenient.

That feature is not using the specified variable, so it is using
Freedesktop.org specified Trash location, at first invokation it was
~/.local/share/Trash and it may be configured.

In that case, when trash-directory variable is configured that is
separate from remote Trash and from Freedesktop.org and I rather
prefer specifying the trash directory myself.

The description of this variable is vague as I cannot know is it in
the context of Freedesktop.org "system's  trash", as now the remote
`trash' command is actually using such, though users could have remote
trash command to use anything; or is it in the context of being
configured through Emacs

Hide Delete By Moving To Trash: Toggle  on (non-nil)
    State : SAVED and set.
   Specifies whether to use the system’s trash can. Hide
   When non-nil, certain file deletion commands use the function
   ‘move-file-to-trash’ instead of deleting files outright.
   This includes interactive calls to ‘delete-file’ and
   ‘delete-directory’ and the Dired deletion commands.
Groups: Auto Save

As then  this settings clarify the first description.

Hide Trash Directory: Value Menu Directory: /home/data1/protected/tmp/Trash/
    State : SAVED and set.
   Directory for ‘move-file-to-trash’ to move files and directories to. More
Groups: Auto Save

In my opinion "system's trash" should be clarified. So far I
understand how it is now, it is Emacs's system's trash, it is not OS
system's trash as variable is set via Emacs.

* Lars Ingebrigtsen <[email-masked]> [2020-10-26 14:15]:
> Jean Louis <[email-masked]> writes:
> 
> > I have the variable trash-directory set and files go to ~/tmp/Trash
> >
> > During Tramp ssh://example.com:~/ session I have delete a file and I can
> > see the message: Trashing...done which should not be during Tramp
> > session, as it gave me impression that file will be now transferred in
> > background to my local Trash directory which not the case. Not that I
> > have seen the file in Trash.
> 
> Please try to give more detailed bug reports with recipes starting from
> "emacs -Q".
> 
> I reproduced this bug by setting:
> 
> (setq delete-by-moving-to-trash t
>       trash-directory "~/Trash/")
> 
> and then going to "/ssh:other-host:/tmp/" and deleting a file.  As you
> say, the file isn't moved to ~/Trash.
> 
> This is because:
> 
> (defun tramp-get-remote-trash (vec)
>   "Determine remote `trash' command.
> This command is returned only if `delete-by-moving-to-trash' is non-nil."
>   (and delete-by-moving-to-trash
>        (with-tramp-connection-property vec "trash"
> 	 (tramp-message vec 5 "Finding a suitable `trash' command")
> 	 (tramp-find-executable vec "trash" (tramp-get-remote-path vec)))))
> 
> Tramp is looking for an executable on the remote host called "trash"?
> Which doesn't exist.
> 
> Shouldn't Tramp then move the file to `trash-directory' instead of
> giving up and just deleting the file?
> 
> If this is working as designed, it should at least be mentioned in the
> doc string(s) and the manual.

-- 
Jean Louis