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 13:09:18 +0100 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1284207033 29393 80.91.229.12 (11 Sep 2010 12:10:33 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 11 Sep 2010 12:10:33 +0000 (UTC) To: bug-gnu-emacs@gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Sep 11 14:10:31 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 1OuOua-0007no-2U for geb-bug-gnu-emacs@m.gmane.org; Sat, 11 Sep 2010 14:10:28 +0200 Original-Received: from localhost ([127.0.0.1]:59980 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OuOuZ-0002Cn-AC for geb-bug-gnu-emacs@m.gmane.org; Sat, 11 Sep 2010 08:10:27 -0400 Original-Received: from [140.186.70.92] (port=37327 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OuOuT-0002Cb-8i for bug-gnu-emacs@gnu.org; Sat, 11 Sep 2010 08:10:22 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OuOuS-0001sm-2S for bug-gnu-emacs@gnu.org; Sat, 11 Sep 2010 08:10:21 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:33778) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OuOuR-0001si-Ve for bug-gnu-emacs@gnu.org; Sat, 11 Sep 2010 08:10:20 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1OuOsE-00089h-8z; Sat, 11 Sep 2010 08:08:02 -0400 X-Loop: help-debbugs@gnu.org In-Reply-To: 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 12:08:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 7011 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by submit@debbugs.gnu.org id=B.128420686431319 (code B ref -1); Sat, 11 Sep 2010 12:08:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 11 Sep 2010 12:07:44 +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 1OuOrv-000896-Pp for submit@debbugs.gnu.org; Sat, 11 Sep 2010 08:07:44 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OuOrt-00088s-Hq for submit@debbugs.gnu.org; Sat, 11 Sep 2010 08:07:42 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OuOtv-0001oj-8t for submit@debbugs.gnu.org; Sat, 11 Sep 2010 08:09:48 -0400 Original-Received: from lists.gnu.org ([199.232.76.165]:40304) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OuOtv-0001of-6d for submit@debbugs.gnu.org; Sat, 11 Sep 2010 08:09:47 -0400 Original-Received: from [140.186.70.92] (port=40435 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OuOtu-0001sK-8i for bug-gnu-emacs@gnu.org; Sat, 11 Sep 2010 08:09:47 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OuOts-0001oO-W0 for bug-gnu-emacs@gnu.org; Sat, 11 Sep 2010 08:09:46 -0400 Original-Received: from lo.gmane.org ([80.91.229.12]:42074) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OuOts-0001oI-K1 for bug-gnu-emacs@gnu.org; Sat, 11 Sep 2010 08:09:44 -0400 Original-Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1OuOtr-0007VJ-UY for bug-gnu-emacs@gnu.org; Sat, 11 Sep 2010 14:09:43 +0200 Original-Received: from cpc1-cmbg13-0-0-cust596.5-4.cable.virginmedia.com ([86.9.122.85]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 11 Sep 2010 14:09:43 +0200 Original-Received: from sdl.web by cpc1-cmbg13-0-0-cust596.5-4.cable.virginmedia.com with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 11 Sep 2010 14:09:43 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 67 Original-X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: cpc1-cmbg13-0-0-cust596.5-4.cable.virginmedia.com Face: iVBORw0KGgoAAAANSUhEUgAAACgAAAAoBAMAAAB+0KVeAAAAGFBMVEUKDAg1NjRWV1V9fnyg op/DxcLk5uP8/voi63ReAAAACXBIWXMAAAWJAAAFiQFtaJ36AAAAB3RJTUUH1goZAgAz00bgXgAA AeVJREFUKM9lk0Fz2jAQhQXJD3CCO70CmcC1YMtcWyTZ14Bl69xats4N9r6/3zWQBlodNKNPu/s0 b1cCQFuZGpfVVh3vAvBJolIXRkapSuoRUtIdFyo1Y5xSdlAj7OtvD1XnXxmWRi+eWgcxyCed1lVV B1CrKyujMoi+eLA5kU1SsjoHlW+nQjTtFxk4MXgrOxvIqzoTZR8XgPaLl419zgsMaSGFPiUOZCIh thsx5Xy9NsK8Kwf/JoQgMxcVJ301HKkcSWaT0O7FY056J4U9xcYfnmVXG4801lW6lqwu2nKFZoHC HuzvaTVndZ+LaRQgZdthXw1cpynEkLEwyFHXk/aIxNQ6QeooJuzPMB+wn+D7JJNsiCcVA13/A3h/ xE9J+WidpAwoYNmRFwyvSRhNVtsdaAewzZZP5uw82QL9+tyNfocyP0McAzICUr5Mk9RdIjWasUNx aIIt6NK4ZtXIMdfMQt3nuMAyWbLI4DqZ4xPq/ag8jPond4XU/cLuOgw6XCFX/YCUfcDAMMH58fD4 G9kDchwfqVefkBwup2uZM+Q4WhJt5jN3AxXCsaS2yXEDuWgS8VOzW0gFjhEPmLyFMKBFaLb1HRwc DiaKwx0EeTMRYnYPQRW3PP4HApvlMv0PttX5v/D6Aws3IOSEwzmLAAAAAElFTkSuQmCC User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (Mac OS X 10.6.4) Cancel-Lock: sha1:QKVt/mRBwqSYw9AGRVMc5ykz9f0= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) 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: Sat, 11 Sep 2010 08:08: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:40085 Archived-At: On 2010-09-11 03:49 +0100, Leo wrote: > 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 Also remove the unused let bound var dir. diff --git a/lisp/eshell/em-unix.el b/lisp/eshell/em-unix.el index e12e03c..f22cc4f 100644 --- a/lisp/eshell/em-unix.el +++ b/lisp/eshell/em-unix.el @@ -203,7 +203,7 @@ Otherwise, Emacs will attempt to use rsh to invoke du on the remote machine." (eshell-error "rm: cannot remove `.' or `..'\n")) (if (and (file-directory-p (car files)) (not (file-symlink-p (car files)))) - (let ((dir (file-name-as-directory (car files)))) + (progn (if verbose (eshell-printn (format "rm: removing directory `%s'" (car files)))) Leo