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: Sat, 31 Dec 2022 10:34:16 -0600 Message-ID: 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="30530"; mail-complaints-to="usenet@ciao.gmane.io" To: 60460@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Jan 01 09:36:52 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 1pBtps-0007mq-DP for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 01 Jan 2023 09:36:52 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pBtp7-0003sI-Sp; Sun, 01 Jan 2023 03:36:05 -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 1pBtp5-0003qo-Hs for bug-gnu-emacs@gnu.org; Sun, 01 Jan 2023 03:36:03 -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 1pBtp5-0005xn-AA for bug-gnu-emacs@gnu.org; Sun, 01 Jan 2023 03:36:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pBtp4-0001Dh-LX for bug-gnu-emacs@gnu.org; Sun, 01 Jan 2023 03:36:02 -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 08:36:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 60460 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.16725621324621 (code B ref -1); Sun, 01 Jan 2023 08:36:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 1 Jan 2023 08:35:32 +0000 Original-Received: from localhost ([127.0.0.1]:40249 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pBtoa-0001CS-5Y for submit@debbugs.gnu.org; Sun, 01 Jan 2023 03:35:32 -0500 Original-Received: from lists.gnu.org ([209.51.188.17]:35688) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pBeof-0007K2-M4 for submit@debbugs.gnu.org; Sat, 31 Dec 2022 11:34:37 -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 1pBeof-0002SZ-Gj for bug-gnu-emacs@gnu.org; Sat, 31 Dec 2022 11:34:37 -0500 Original-Received: from netyu.xyz ([152.44.41.246] helo=mail.netyu.xyz) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pBeod-0007IU-Oc for bug-gnu-emacs@gnu.org; Sat, 31 Dec 2022 11:34:37 -0500 Original-Received: from fw.net.yu.netyu.xyz ( [73.133.126.255]) by netyu.xyz (OpenSMTPD) with ESMTPSA id 5f233fa6 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO) for ; Sat, 31 Dec 2022 16:34:32 +0000 (UTC) Received-SPF: pass client-ip=152.44.41.246; envelope-from=ruijie@netyu.xyz; helo=mail.netyu.xyz X-Spam_score_int: 6 X-Spam_score: 0.6 X-Spam_bar: / X-Spam_report: (0.6 / 5.0 requ) BAYES_00=-1.9, FROM_SUSPICIOUS_NTLD=0.498, FROM_SUSPICIOUS_NTLD_FP=1.997, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Sun, 01 Jan 2023 03:35:31 -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:252225 Archived-At: Hello, I have been organizing my files lately over multiple devices using tramp. One issue I find with my current setup is that since I set `delete-by-moving-to-trash' to t, all files, even the remote ones, are moved to my trash directory. This, unfortunately, harms my workflow because the files I wanted to delete include some random multi-gig files, as well as many .git directories, both of which greatly bottleneck my file-deletion process. I also don't want to disable trashing globally, because I think putting local files to trash (which do not introduce a significant delay) is still a good idea. 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. I imagine this would entail allowing the user to set `delete-by-moving-to-trash' to 'local, and modifying `delete-file', `delete-directory', `dired-internal-do-deletions' among other functions accordingly. Alternatively we can have a dedicated variable for this purpose. In this case, if `delete-by-moving-to-trash' is set to 'local, whenever a user deletes a remote file such as "/sudo::/etc/os-release", it is simply deleted as if via "/sudo:://bin/rm", whereas when the user deletes a local file ".bashrc", it is moved to trash as normal. 2. Use a dedicated local trash directory for each remote, optionally behind a toggle. E.g. for files under "/sudo::" remote, we might have the trash directory as "/sudo::.local/share/Trash". I am not sure how this would interact with `trash-directory', as I have this as nil and simply let Emacs use the XDG path for trash. This might additionally pose some challanges when multiple remotes are aliases to each other, for example, "/sshx:user@localhost:.bashrc" and "/sshx:user@127.0.0.1:.bashrc" logically are the same file, but it might be hard to programmatically check that two hosts are equivalent. Best, RY