GNU bug report logs - #33336
26; Document how to restore trashed files

Previous Next

Package: emacs;

Reported by: Drew Adams <drew.adams <at> oracle.com>

Date: Sat, 10 Nov 2018 19:33:02 UTC

Severity: wishlist

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 33336 in the body.
You can then email your comments to 33336 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#33336; Package emacs. (Sat, 10 Nov 2018 19:33:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Drew Adams <drew.adams <at> oracle.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 10 Nov 2018 19:33:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Drew Adams <drew.adams <at> oracle.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 26; Document how to restore trashed files
Date: Sat, 10 Nov 2018 11:31:48 -0800 (PST)
I tried to answer this question, knowing nothing about trashed files:
https://emacs.stackexchange.com/q/37492/105

I can understand that if files are trashed to the system recycle bin
then perhaps Emacs cannot help users much in telling them how to restore
trashed files (or can it?).

But if `trash-directory' is non-nil then can't (and shouldn't) Emacs
tell users how to restore files trashed there?  Is there an Emacs
operation that does this?  If not, can a user just move a file from that
directory to another (IOW, are trashed files normal files)?  And is
there some way for a user to know what the original location was for a
trashed file?

In sum, is there something that Emacs can offer users, in terms of
helping them restore trashed files?


In GNU Emacs 26.1 (build 1, x86_64-w64-mingw32)
 of 2018-05-30
Repository revision: 07f8f9bc5a51f5aa94eb099f3e15fbe0c20ea1ea
Windowing system distributor `Microsoft Corp.', version 10.0.16299
Configured using:
 `configure --without-dbus --host=x86_64-w64-mingw32
 --without-compress-install 'CFLAGS=-O2 -static -g3''




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#33336; Package emacs. (Sat, 10 Nov 2018 20:01:01 GMT) Full text and rfc822 format available.

Message #8 received at 33336 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Drew Adams <drew.adams <at> oracle.com>
Cc: 33336 <at> debbugs.gnu.org
Subject: Re: bug#33336: 26; Document how to restore trashed files
Date: Sat, 10 Nov 2018 22:00:16 +0200
> Date: Sat, 10 Nov 2018 11:31:48 -0800 (PST)
> From: Drew Adams <drew.adams <at> oracle.com>
> 
> I tried to answer this question, knowing nothing about trashed files:
> https://emacs.stackexchange.com/q/37492/105

I don't think your answer is correct, not on Windows anyway.

> I can understand that if files are trashed to the system recycle bin
> then perhaps Emacs cannot help users much in telling them how to restore
> trashed files (or can it?).
> 
> But if `trash-directory' is non-nil then can't (and shouldn't) Emacs
> tell users how to restore files trashed there?  Is there an Emacs
> operation that does this?  If not, can a user just move a file from that
> directory to another (IOW, are trashed files normal files)?  And is
> there some way for a user to know what the original location was for a
> trashed file?
> 
> In sum, is there something that Emacs can offer users, in terms of
> helping them restore trashed files?

This is a system facility, Emacs just uses it.  Restoring files from
there is something specific to each system, and is not for Emacs to
provide or document.

So I don't think we should do anything with this.  Users should read
their OS documentation about this.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#33336; Package emacs. (Sat, 10 Nov 2018 21:27:02 GMT) Full text and rfc822 format available.

Message #11 received at 33336 <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 33336 <at> debbugs.gnu.org, Drew Adams <drew.adams <at> oracle.com>
Subject: Re: bug#33336: 26; Document how to restore trashed files
Date: Sat, 10 Nov 2018 16:26:07 -0500
Eli Zaretskii wrote:

> This is a system facility, Emacs just uses it.  Restoring files from
> there is something specific to each system, and is not for Emacs to
> provide or document.

I don't see how moving something out of trash is different to moving it
in this regard.

On GNU systems, the only relevant mechanism is the freedesktop trash
spec that move-file-to-trash implements. It looks like it would be
straightforward for someone who wanted to to write a
move-file-from-trash that restores files according to the trashinfo
file, and this could be hooked into dired.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#33336; Package emacs. (Sun, 11 Nov 2018 03:36:01 GMT) Full text and rfc822 format available.

Message #14 received at 33336 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Glenn Morris <rgm <at> gnu.org>
Cc: 33336 <at> debbugs.gnu.org, drew.adams <at> oracle.com
Subject: Re: bug#33336: 26; Document how to restore trashed files
Date: Sun, 11 Nov 2018 05:35:18 +0200
> From: Glenn Morris <rgm <at> gnu.org>
> Cc: Drew Adams <drew.adams <at> oracle.com>,  33336 <at> debbugs.gnu.org
> Date: Sat, 10 Nov 2018 16:26:07 -0500
> 
> Eli Zaretskii wrote:
> 
> > This is a system facility, Emacs just uses it.  Restoring files from
> > there is something specific to each system, and is not for Emacs to
> > provide or document.
> 
> I don't see how moving something out of trash is different to moving it
> in this regard.

Where trash is just another directory, you are right.  But that's just
one variety.

> On GNU systems, the only relevant mechanism is the freedesktop trash
> spec that move-file-to-trash implements. It looks like it would be
> straightforward for someone who wanted to to write a
> move-file-from-trash that restores files according to the trashinfo
> file, and this could be hooked into dired.

This won't work on MS-Windows, where trash is a special directory, and
restoring files from there is a special operation, not just moving a
file.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#33336; Package emacs. (Sun, 11 Nov 2018 15:29:02 GMT) Full text and rfc822 format available.

Message #17 received at 33336 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: rgm <at> gnu.org
Cc: 33336 <at> debbugs.gnu.org
Subject: Re: bug#33336: 26; Document how to restore trashed files
Date: Sun, 11 Nov 2018 17:28:37 +0200
> Date: Sun, 11 Nov 2018 05:35:18 +0200
> From: Eli Zaretskii <eliz <at> gnu.org>
> Cc: 33336 <at> debbugs.gnu.org
> 
> > From: Glenn Morris <rgm <at> gnu.org>
> > Cc: Drew Adams <drew.adams <at> oracle.com>,  33336 <at> debbugs.gnu.org
> > Date: Sat, 10 Nov 2018 16:26:07 -0500
> > 
> > Eli Zaretskii wrote:
> > 
> > > This is a system facility, Emacs just uses it.  Restoring files from
> > > there is something specific to each system, and is not for Emacs to
> > > provide or document.
> > 
> > I don't see how moving something out of trash is different to moving it
> > in this regard.
> 
> Where trash is just another directory, you are right.  But that's just
> one variety.

Actually, I take that back: even if trash is a directory that uses the
freedesktop trash spec, undeleting a file via Dired is not entirely
straightforward, for at least two reasons:

  . Dired is based on parsing the output of 'ls', and AFAIK GNU 'ls'
    isn't yet capable of displaying trash directories in useful,
    human-readable ways (we'd probably need to reuse/reinvent portions
    of ls-lisp?)
  . Trash directories routinely have several versions of the same
    file, and AFAIK Dired doesn't have capabilities for presenting
    several versions of the same file in a way that would facilitate
    the decision whether and which version to restore




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#33336; Package emacs. (Sun, 11 Nov 2018 16:48:02 GMT) Full text and rfc822 format available.

Message #20 received at 33336 <at> debbugs.gnu.org (full text, mbox):

From: Drew Adams <drew.adams <at> oracle.com>
To: Eli Zaretskii <eliz <at> gnu.org>, Glenn Morris <rgm <at> gnu.org>
Cc: 33336 <at> debbugs.gnu.org, drew.adams <at> oracle.com
Subject: RE: bug#33336: 26; Document how to restore trashed files
Date: Sun, 11 Nov 2018 08:47:28 -0800 (PST)
> > > This is a system facility, Emacs just uses it.  Restoring files
> from
> > > there is something specific to each system, and is not for Emacs to
> > > provide or document.
> >
> > I don't see how moving something out of trash is different to moving
> it
> > in this regard.
> 
> Where trash is just another directory, you are right.  But that's just
> one variety.
> 
> > On GNU systems, the only relevant mechanism is the freedesktop trash
> > spec that move-file-to-trash implements. It looks like it would be
> > straightforward for someone who wanted to to write a
> > move-file-from-trash that restores files according to the trashinfo
> > file, and this could be hooked into dired.
> 
> This won't work on MS-Windows, where trash is a special directory, and
> restoring files from there is a special operation, not just moving a
> file.

I addressed this possibility at the outset:

  I can understand that if files are trashed to the system
  recycle bin then perhaps Emacs cannot help users much in
  telling them how to restore trashed files (or can it?).

The bug report asks that we do what we can to help users
in the cases where we can.

  But if `trash-directory' is non-nil then can't (and shouldn't)
  Emacs tell users how to restore files trashed there?

Presumably (?) `trash-directory' is "just another directory".
That's the case (at least) where I was thinking that Emacs
should be able to help.  I was thinking that in this case, at
least, restoring a file from there should be "just moving a file".

But this would presumably require recording the original
directory, to where each file should be restored (by default).
And the "restoring" code would need to, e.g., prompt the user
for some alternative directory if the recorded directory no
longer existed.

The Emacs doc for this can make clear that Emacs may not
be able to help in some cases where the system trash bin
is used, and in such cases users should consult their
system doc for how to restore a file. 

To repeat the last line of the bug report:

  In sum, is there something that Emacs can offer users,
                   ^^^^^^^^^
  in terms of helping them restore trashed files?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#33336; Package emacs. (Sun, 11 Nov 2018 16:54:02 GMT) Full text and rfc822 format available.

Message #23 received at 33336 <at> debbugs.gnu.org (full text, mbox):

From: Drew Adams <drew.adams <at> oracle.com>
To: Eli Zaretskii <eliz <at> gnu.org>, rgm <at> gnu.org
Cc: 33336 <at> debbugs.gnu.org
Subject: RE: bug#33336: 26; Document how to restore trashed files
Date: Sun, 11 Nov 2018 08:52:51 -0800 (PST)
> > Where trash is just another directory, you are right.  But that's
> > just one variety.
> 
> Actually, I take that back: even if trash is a directory that uses the
> freedesktop trash spec, undeleting a file via Dired is not entirely
> straightforward, for at least two reasons:
> 
>   . Dired is based on parsing the output of 'ls', and AFAIK GNU 'ls'
>     isn't yet capable of displaying trash directories in useful,
>     human-readable ways (we'd probably need to reuse/reinvent portions
>     of ls-lisp?)
>   . Trash directories routinely have several versions of the same
>     file, and AFAIK Dired doesn't have capabilities for presenting
>     several versions of the same file in a way that would facilitate
>     the decision whether and which version to restore

But "just another directory" is more general than "directory
that uses the freedesktop trash spec".  At least if it is
an ordinary ("just another") directory, and not a directory
that uses the freedesktop trash spec, can't we help users
wrt restoring files parked there?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#33336; Package emacs. (Sun, 11 Nov 2018 17:23:01 GMT) Full text and rfc822 format available.

Message #26 received at 33336 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Drew Adams <drew.adams <at> oracle.com>
Cc: rgm <at> gnu.org, 33336 <at> debbugs.gnu.org
Subject: Re: bug#33336: 26; Document how to restore trashed files
Date: Sun, 11 Nov 2018 19:22:33 +0200
> Date: Sun, 11 Nov 2018 08:52:51 -0800 (PST)
> From: Drew Adams <drew.adams <at> oracle.com>
> Cc: 33336 <at> debbugs.gnu.org
> 
> > > Where trash is just another directory, you are right.  But that's
> > > just one variety.
> > 
> > Actually, I take that back: even if trash is a directory that uses the
> > freedesktop trash spec, undeleting a file via Dired is not entirely
> > straightforward, for at least two reasons:
> > 
> >   . Dired is based on parsing the output of 'ls', and AFAIK GNU 'ls'
> >     isn't yet capable of displaying trash directories in useful,
> >     human-readable ways (we'd probably need to reuse/reinvent portions
> >     of ls-lisp?)
> >   . Trash directories routinely have several versions of the same
> >     file, and AFAIK Dired doesn't have capabilities for presenting
> >     several versions of the same file in a way that would facilitate
> >     the decision whether and which version to restore
> 
> But "just another directory" is more general than "directory
> that uses the freedesktop trash spec".  At least if it is
> an ordinary ("just another") directory, and not a directory
> that uses the freedesktop trash spec, can't we help users
> wrt restoring files parked there?

I don't know.  I have no idea who would use that option.  I presume
the vast majority leave the default nil setting of trash-directory
intact, and get the freedesktop style trash (and the Recycle Bin on
Windows).  I see no reason to have a feature that is useful for a tiny
minority of users, while the bulk of them need to use system tools
instead.  Besides, if trash-directory is a simple directory, do we
really need to tell users how to move files out of there?

Sorry, makes no sense to me.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#33336; Package emacs. (Sun, 11 Nov 2018 17:26:02 GMT) Full text and rfc822 format available.

Message #29 received at 33336 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Drew Adams <drew.adams <at> oracle.com>
Cc: rgm <at> gnu.org, 33336 <at> debbugs.gnu.org
Subject: Re: bug#33336: 26; Document how to restore trashed files
Date: Sun, 11 Nov 2018 19:24:43 +0200
> Date: Sun, 11 Nov 2018 08:47:28 -0800 (PST)
> From: Drew Adams <drew.adams <at> oracle.com>
> Cc: drew.adams <at> oracle.com, 33336 <at> debbugs.gnu.org
> 
> But this would presumably require recording the original
> directory, to where each file should be restored (by default).
> And the "restoring" code would need to, e.g., prompt the user
> for some alternative directory if the recorded directory no
> longer existed.

That's exactly what the freedesktop spec does, and the side effect is
that the files in the trash don't have their original names.

> The Emacs doc for this can make clear that Emacs may not
> be able to help in some cases where the system trash bin
> is used, and in such cases users should consult their
> system doc for how to restore a file. 

I added there yesterday a sentence saying that restoring files from
trash needs system-dependent tools.  I don't think we need to do more.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#33336; Package emacs. (Sat, 12 Oct 2019 21:27:01 GMT) Full text and rfc822 format available.

Message #32 received at 33336 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 33336 <at> debbugs.gnu.org, Drew Adams <drew.adams <at> oracle.com>
Subject: Re: bug#33336: 26; Document how to restore trashed files
Date: Sat, 12 Oct 2019 23:26:24 +0200
Eli Zaretskii <eliz <at> gnu.org> writes:

> This is a system facility, Emacs just uses it.  Restoring files from
> there is something specific to each system, and is not for Emacs to
> provide or document.
>
> So I don't think we should do anything with this.  Users should read
> their OS documentation about this.

I think this was the conclusion here, so I'm closing this bug report.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




bug closed, send any further explanations to 33336 <at> debbugs.gnu.org and Drew Adams <drew.adams <at> oracle.com> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sat, 12 Oct 2019 21:27:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 10 Nov 2019 12:24:12 GMT) Full text and rfc822 format available.

This bug report was last modified 4 years and 140 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.