From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Ruijie Yu via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#60460: 30.0.50; [FR] avoid putting remote files to local trash Date: Sun, 01 Jan 2023 10:47:37 -0600 Message-ID: References: Reply-To: Ruijie Yu Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="22696"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: mu4e 1.8.13; emacs 30.0.50 Cc: "60460@debbugs.gnu.org" <60460@debbugs.gnu.org> To: Drew Adams Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Jan 01 21:38:45 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pC56S-0005fy-I2 for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 01 Jan 2023 21:38:44 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pC55z-00055x-M7; Sun, 01 Jan 2023 15:38:15 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pC55o-000520-RN for bug-gnu-emacs@gnu.org; Sun, 01 Jan 2023 15:38:06 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pC55o-0005rn-Jl for bug-gnu-emacs@gnu.org; Sun, 01 Jan 2023 15:38:04 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pC55o-0000ho-FN for bug-gnu-emacs@gnu.org; Sun, 01 Jan 2023 15:38:04 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Ruijie Yu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 01 Jan 2023 20:38:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60460 X-GNU-PR-Package: emacs Original-Received: via spool by 60460-submit@debbugs.gnu.org id=B60460.16726054712632 (code B ref 60460); Sun, 01 Jan 2023 20:38:04 +0000 Original-Received: (at 60460) by debbugs.gnu.org; 1 Jan 2023 20:37:51 +0000 Original-Received: from localhost ([127.0.0.1]:41851 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pC55b-0000gG-6T for submit@debbugs.gnu.org; Sun, 01 Jan 2023 15:37:51 -0500 Original-Received: from netyu.xyz ([152.44.41.246]:57248 helo=mail.netyu.xyz) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pC1lf-0003KH-28 for 60460@debbugs.gnu.org; Sun, 01 Jan 2023 12:05:04 -0500 Original-Received: from fw.net.yu.netyu.xyz ( [73.133.126.255]) by netyu.xyz (OpenSMTPD) with ESMTPSA id ba3e1d51 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Sun, 1 Jan 2023 17:05:02 +0000 (UTC) In-reply-to: X-Mailman-Approved-At: Sun, 01 Jan 2023 15:37:46 -0500 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:252285 Archived-At: Drew Adams 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