unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Ruijie Yu via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Drew Adams <drew.adams@oracle.com>
Cc: "60460@debbugs.gnu.org" <60460@debbugs.gnu.org>
Subject: bug#60460: 30.0.50; [FR] avoid putting remote files to local trash
Date: Sun, 01 Jan 2023 10:47:37 -0600	[thread overview]
Message-ID: <sdvmt726v9j.fsf@fw.net.yu> (raw)
In-Reply-To: <SJ0PR10MB54885DF2AD2368D5588D8F44F3F69@SJ0PR10MB5488.namprd10.prod.outlook.com>


Drew Adams <drew.adams@oracle.com> writes:

>> In response to this, I want to propose a change to the logic under which
>> trashing is performed rather than deletion.  However, I am not sure
>> which one of my following two ideas is more appropriate.
>>
>> 1. Allow the user to disable "moving to local trash" only for remote
>> files....
>> 2. Use a dedicated local trash directory for each remote, optionally
>> behind a toggle.
>
> (Caveat: I'm not knowledgeable about sending
> files to trash.)
>
> I would have thought that we already have a way
> for users to customize which files and dirs get
> sent to trash.
>
> Now I see that option `delete-by-moving-to-trash'
> is just a simple nil/t Boolean, as opposed to
> being nil (for don't trash) and non-nil for the
> possibility of filtering.
>
> Not trashing remote files is just one kind of
> filtering.  And you say that you want to do that
> in particular because some of your remote files
> are large.  Filtering out large files (local or
> remote) is another possibility (logically not
> the same as filtering out remote files).
>
> Users could have any number of criteria they
> want to use, to filter inclusion/exclusion of
> files to move to trash.
>
> Why not use a mechanism similar to what we use
> with `recentf.el'?  There, we have user option
> `recentf-exclude'.  That lets you use multiple
> regexps and predicates to specify the files
> you want to exclude from inclusion in the list
> of recent files.

Yes, that sounds like a good idea as well.  To expand on your idea, here
are my thoughts.

Similar to what we have for "recentf.el" today, we can have two
variables `delete-by-moving-to-trash-include' and
`delete-by-moving-to-trash-exclude', and make
`delete-by-moving-to-trash' a deprecated alias to
`delete-by-moving-to-trash-include'.  In this case, we can have the
following logic:

1. If both variables are nil, disable trashing;

2. If `dbmtt-include' is not a list, issue a warning (because now we
want a list) and enable universal trashing;

3. Handle predicates and regexps in `dbmtt-include' and `dbmtt-exclude'
similar to how these in `recentf-include' and `recentf-exclude' are
handled in "recentf.el".

One concern I have with this approach is the added complexity to file
deletion logic.  That is, whenever a file needs to be deleted with
trashing potential (TRASH is passed in as non-nil for the relevant
functions), the two lists need to be consulted for this file and all
predicates and regexps need to be run against its filename.

Best,


RY





  reply	other threads:[~2023-01-01 16:47 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-31 16:34 bug#60460: 30.0.50; [FR] avoid putting remote files to local trash Ruijie Yu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-01-01 16:41 ` Drew Adams
2023-01-01 16:47   ` Ruijie Yu via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2023-01-01 18:20     ` Drew Adams
2023-01-02  3:40     ` Jean Louis
2023-01-02  9:09 ` Michael Albinus
2023-01-02 10:35   ` Jean Louis
2023-01-02 10:47     ` Michael Albinus
2023-01-02 16:28       ` Jean Louis
2023-01-02 18:30         ` Michael Albinus
2023-01-02 20:37           ` Jean Louis
2023-01-03  8:47             ` Michael Albinus
2023-01-03 13:53               ` Jean Louis
2023-01-07  3:53               ` Ruijie Yu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-01-07 12:48                 ` Michael Albinus
2023-01-08  0:37                   ` Jean Louis
2023-01-08  9:20                     ` Michael Albinus
2023-01-08 18:29               ` Michael Albinus
2023-02-02  8:56                 ` Michael Albinus
  -- strict thread matches above, loose matches on Subject: below --
2023-01-01 14:20 bug#60462: " Ruijie Yu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-12-31 21:46 ` Ruijie Yu via Bug reports for GNU Emacs, the Swiss army knife of text editors
     [not found]   ` <handler.60462.D60462.16726054692608.notifdone@debbugs.gnu.org>
2023-01-02  9:16     ` bug#60460: " Michael Albinus

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=sdvmt726v9j.fsf@fw.net.yu \
    --to=bug-gnu-emacs@gnu.org \
    --cc=60460@debbugs.gnu.org \
    --cc=drew.adams@oracle.com \
    --cc=ruijie@netyu.xyz \
    /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).