From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Leo Newsgroups: gmane.emacs.bugs Subject: bug#7011: 24.1; [PATCH] improve eshell-remove-entries Date: Sat, 11 Sep 2010 03:49:04 +0100 Message-ID: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1284174633 990 80.91.229.12 (11 Sep 2010 03:10:33 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 11 Sep 2010 03:10:33 +0000 (UTC) Cc: John Wiegley To: 7011@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Sep 11 05:10:29 2010 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1OuGTx-000082-OT for geb-bug-gnu-emacs@m.gmane.org; Sat, 11 Sep 2010 05:10:26 +0200 Original-Received: from localhost ([127.0.0.1]:60393 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OuGTw-0008F8-PT for geb-bug-gnu-emacs@m.gmane.org; Fri, 10 Sep 2010 23:10:24 -0400 Original-Received: from [140.186.70.92] (port=47575 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OuGTs-0008F3-2j for bug-gnu-emacs@gnu.org; Fri, 10 Sep 2010 23:10:21 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OuGTq-0007AK-QD for bug-gnu-emacs@gnu.org; Fri, 10 Sep 2010 23:10:19 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:36902) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OuGTq-0007AG-L9 for bug-gnu-emacs@gnu.org; Fri, 10 Sep 2010 23:10:18 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1OuGOk-00082z-9T; Fri, 10 Sep 2010 23:05:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Leo Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 11 Sep 2010 03:05:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 7011 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.128417429330907 (code B ref -1); Sat, 11 Sep 2010 03:05:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 11 Sep 2010 03:04:53 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OuGOb-00082S-7i for submit@debbugs.gnu.org; Fri, 10 Sep 2010 23:04:53 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OuGOY-00082J-3f for submit@debbugs.gnu.org; Fri, 10 Sep 2010 23:04:50 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OuG9P-0004Tj-Ge for submit@debbugs.gnu.org; Fri, 10 Sep 2010 22:49:12 -0400 Original-Received: from lists.gnu.org ([199.232.76.165]:41646) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OuG9P-0004Te-Cv for submit@debbugs.gnu.org; Fri, 10 Sep 2010 22:49:11 -0400 Original-Received: from [140.186.70.92] (port=48314 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OuG9O-00013g-8k for bug-gnu-emacs@gnu.org; Fri, 10 Sep 2010 22:49:11 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OuG9M-0004T3-CX for bug-gnu-emacs@gnu.org; Fri, 10 Sep 2010 22:49:10 -0400 Original-Received: from ppsw-30.csi.cam.ac.uk ([131.111.8.130]:46170) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OuG9M-0004Sd-8h for bug-gnu-emacs@gnu.org; Fri, 10 Sep 2010 22:49:08 -0400 X-Cam-AntiVirus: no malware found X-Cam-SpamDetails: not scanned X-Cam-ScannerInfo: http://www.cam.ac.uk/cs/email/scanner/ Original-Received: from cpc1-cmbg13-0-0-cust596.5-4.cable.virginmedia.com ([86.9.122.85]:61474 helo=Victoria.local) by ppsw-30.csi.cam.ac.uk (smtp.hermes.cam.ac.uk [131.111.8.156]:587) with esmtpsa (PLAIN:sl392) (TLSv1:DHE-RSA-AES128-SHA:128) id 1OuG9J-0001Fn-fc (Exim 4.72) (return-path ); Sat, 11 Sep 2010 03:49:06 +0100 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Fri, 10 Sep 2010 23:05:02 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) 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: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:40077 Archived-At: eshell-remove-entries implements its own recursive delete of files in a directory and this does not play well with the move-to-trash feature. For example, if you use 'rm -rf' in eshell to delete a dir with hundreds of files in it (eg .git), you will get hundreds of files at the top level of the Trash bin. The following patch enables eshell-remove-entries to support move-to-trash feature and use delete-directory's RECURSIVE arg instead. diff --git a/lisp/eshell/em-unix.el b/lisp/eshell/em-unix.el index 6ceb591..e12e03c 100644 --- a/lisp/eshell/em-unix.el +++ b/lisp/eshell/em-unix.el @@ -204,12 +204,6 @@ Otherwise, Emacs will attempt to use rsh to invoke du on the remote machine." (if (and (file-directory-p (car files)) (not (file-symlink-p (car files)))) (let ((dir (file-name-as-directory (car files)))) - (eshell-remove-entries dir - (mapcar - (function - (lambda (file) - (concat dir file))) - (directory-files dir))) (if verbose (eshell-printn (format "rm: removing directory `%s'" (car files)))) @@ -219,7 +213,7 @@ Otherwise, Emacs will attempt to use rsh to invoke du on the remote machine." (not (y-or-n-p (format "rm: remove directory `%s'? " (car files)))))) - (eshell-funcalln 'delete-directory (car files)))) + (eshell-funcalln 'delete-directory (car files) t t))) (if verbose (eshell-printn (format "rm: removing file `%s'" (car files)))) @@ -228,7 +222,7 @@ Otherwise, Emacs will attempt to use rsh to invoke du on the remote machine." (not (y-or-n-p (format "rm: remove `%s'? " (car files)))))) - (eshell-funcalln 'delete-file (car files))))) + (eshell-funcalln 'delete-file (car files) t)))) (setq files (cdr files)))) (defun eshell/rm (&rest args) Leo