unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#33336: 26; Document how to restore trashed files
@ 2018-11-10 19:31 Drew Adams
  2018-11-10 20:00 ` Eli Zaretskii
  0 siblings, 1 reply; 10+ messages in thread
From: Drew Adams @ 2018-11-10 19:31 UTC (permalink / raw)
  To: 33336

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''





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#33336: 26; Document how to restore trashed files
  2018-11-10 19:31 bug#33336: 26; Document how to restore trashed files Drew Adams
@ 2018-11-10 20:00 ` Eli Zaretskii
  2018-11-10 21:26   ` Glenn Morris
                     ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Eli Zaretskii @ 2018-11-10 20:00 UTC (permalink / raw)
  To: Drew Adams; +Cc: 33336

> Date: Sat, 10 Nov 2018 11:31:48 -0800 (PST)
> From: Drew Adams <drew.adams@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.





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#33336: 26; Document how to restore trashed files
  2018-11-10 20:00 ` Eli Zaretskii
@ 2018-11-10 21:26   ` Glenn Morris
  2018-11-11  3:35     ` Eli Zaretskii
       [not found]   ` <<pzr2fs39qo.fsf@fencepost.gnu.org>
  2019-10-12 21:26   ` Lars Ingebrigtsen
  2 siblings, 1 reply; 10+ messages in thread
From: Glenn Morris @ 2018-11-10 21:26 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 33336

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.





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#33336: 26; Document how to restore trashed files
  2018-11-10 21:26   ` Glenn Morris
@ 2018-11-11  3:35     ` Eli Zaretskii
  2018-11-11 15:28       ` Eli Zaretskii
       [not found]       ` <<83o9avab16.fsf@gnu.org>
  0 siblings, 2 replies; 10+ messages in thread
From: Eli Zaretskii @ 2018-11-11  3:35 UTC (permalink / raw)
  To: Glenn Morris; +Cc: 33336

> From: Glenn Morris <rgm@gnu.org>
> Cc: Drew Adams <drew.adams@oracle.com>,  33336@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.





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#33336: 26; Document how to restore trashed files
  2018-11-11  3:35     ` Eli Zaretskii
@ 2018-11-11 15:28       ` Eli Zaretskii
       [not found]       ` <<83o9avab16.fsf@gnu.org>
  1 sibling, 0 replies; 10+ messages in thread
From: Eli Zaretskii @ 2018-11-11 15:28 UTC (permalink / raw)
  To: rgm; +Cc: 33336

> Date: Sun, 11 Nov 2018 05:35:18 +0200
> From: Eli Zaretskii <eliz@gnu.org>
> Cc: 33336@debbugs.gnu.org
> 
> > From: Glenn Morris <rgm@gnu.org>
> > Cc: Drew Adams <drew.adams@oracle.com>,  33336@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





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#33336: 26; Document how to restore trashed files
       [not found]     ` <<83pnvc9thl.fsf@gnu.org>
@ 2018-11-11 16:47       ` Drew Adams
  2018-11-11 17:24         ` Eli Zaretskii
  0 siblings, 1 reply; 10+ messages in thread
From: Drew Adams @ 2018-11-11 16:47 UTC (permalink / raw)
  To: Eli Zaretskii, Glenn Morris; +Cc: 33336

> > > 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?





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#33336: 26; Document how to restore trashed files
       [not found]       ` <<83o9avab16.fsf@gnu.org>
@ 2018-11-11 16:52         ` Drew Adams
  2018-11-11 17:22           ` Eli Zaretskii
  0 siblings, 1 reply; 10+ messages in thread
From: Drew Adams @ 2018-11-11 16:52 UTC (permalink / raw)
  To: Eli Zaretskii, rgm; +Cc: 33336

> > 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?





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#33336: 26; Document how to restore trashed files
  2018-11-11 16:52         ` Drew Adams
@ 2018-11-11 17:22           ` Eli Zaretskii
  0 siblings, 0 replies; 10+ messages in thread
From: Eli Zaretskii @ 2018-11-11 17:22 UTC (permalink / raw)
  To: Drew Adams; +Cc: 33336

> Date: Sun, 11 Nov 2018 08:52:51 -0800 (PST)
> From: Drew Adams <drew.adams@oracle.com>
> Cc: 33336@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.





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#33336: 26; Document how to restore trashed files
  2018-11-11 16:47       ` Drew Adams
@ 2018-11-11 17:24         ` Eli Zaretskii
  0 siblings, 0 replies; 10+ messages in thread
From: Eli Zaretskii @ 2018-11-11 17:24 UTC (permalink / raw)
  To: Drew Adams; +Cc: 33336

> Date: Sun, 11 Nov 2018 08:47:28 -0800 (PST)
> From: Drew Adams <drew.adams@oracle.com>
> Cc: drew.adams@oracle.com, 33336@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.





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#33336: 26; Document how to restore trashed files
  2018-11-10 20:00 ` Eli Zaretskii
  2018-11-10 21:26   ` Glenn Morris
       [not found]   ` <<pzr2fs39qo.fsf@fencepost.gnu.org>
@ 2019-10-12 21:26   ` Lars Ingebrigtsen
  2 siblings, 0 replies; 10+ messages in thread
From: Lars Ingebrigtsen @ 2019-10-12 21:26 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 33336

Eli Zaretskii <eliz@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





^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2019-10-12 21:26 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-11-10 19:31 bug#33336: 26; Document how to restore trashed files Drew Adams
2018-11-10 20:00 ` Eli Zaretskii
2018-11-10 21:26   ` Glenn Morris
2018-11-11  3:35     ` Eli Zaretskii
2018-11-11 15:28       ` Eli Zaretskii
     [not found]       ` <<83o9avab16.fsf@gnu.org>
2018-11-11 16:52         ` Drew Adams
2018-11-11 17:22           ` Eli Zaretskii
     [not found]   ` <<pzr2fs39qo.fsf@fencepost.gnu.org>
     [not found]     ` <<83pnvc9thl.fsf@gnu.org>
2018-11-11 16:47       ` Drew Adams
2018-11-11 17:24         ` Eli Zaretskii
2019-10-12 21:26   ` Lars Ingebrigtsen

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).