From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#5436: 23.1.91; Deleting directories causes unusable file layout in freedesktop trashcan Date: Sun, 24 Jan 2010 20:24:37 +0200 Organization: Message-ID: <83y6jn5pju.fsf@gnu.org> References: <87ljfqkt6e.fsf@stupidchicken.com> <4B5BC912.3050409@harpegolden.net> NNTP-Posting-Host: lo.gmane.org X-Trace: ger.gmane.org 1264358477 7258 80.91.229.12 (24 Jan 2010 18:41:17 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 24 Jan 2010 18:41:17 +0000 (UTC) Cc: cyd@stupidchicken.com, tassilo@member.fsf.org, 5436@debbugs.gnu.org To: David De La Harpe Golden Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Jan 24 19:41:09 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.50) id 1NZ7OW-0004c4-AU for geb-bug-gnu-emacs@m.gmane.org; Sun, 24 Jan 2010 19:41:08 +0100 Original-Received: from localhost ([127.0.0.1]:43180 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NZ7OX-0000uq-Cn for geb-bug-gnu-emacs@m.gmane.org; Sun, 24 Jan 2010 13:41:09 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NZ7NH-0007iq-5T for bug-gnu-emacs@gnu.org; Sun, 24 Jan 2010 13:39:51 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NZ7NC-0007dL-3V for bug-gnu-emacs@gnu.org; Sun, 24 Jan 2010 13:39:50 -0500 Original-Received: from [199.232.76.173] (port=40452 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NZ7NB-0007dE-Un for bug-gnu-emacs@gnu.org; Sun, 24 Jan 2010 13:39:45 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:45224) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1NZ7NB-00039j-IR for bug-gnu-emacs@gnu.org; Sun, 24 Jan 2010 13:39:45 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1NZ79u-0007Yr-3k; Sun, 24 Jan 2010 13:26:02 -0500 X-Loop: bug-gnu-emacs@gnu.org Resent-From: Eli Zaretskii Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 24 Jan 2010 18:26:02 +0000 Resent-Message-ID: Resent-Sender: bug-gnu-emacs@gnu.org X-Emacs-PR-Message: followup 5436 X-Emacs-PR-Package: emacs X-Emacs-PR-Keywords: Original-Received: via spool by 5436-submit@debbugs.gnu.org id=B5436.126435751029048 (code B ref 5436); Sun, 24 Jan 2010 18:26:02 +0000 Original-Received: (at 5436) by debbugs.gnu.org; 24 Jan 2010 18:25:10 +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 1NZ793-0007YT-9d for submit@debbugs.gnu.org; Sun, 24 Jan 2010 13:25:09 -0500 Original-Received: from mtaout20.012.net.il ([80.179.55.166]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NZ791-0007Y4-13 for 5436@debbugs.gnu.org; Sun, 24 Jan 2010 13:25:07 -0500 Original-Received: from conversion-daemon.a-mtaout20.012.net.il by a-mtaout20.012.net.il (HyperSendmail v2007.08) id <0KWR00100JFHC200@a-mtaout20.012.net.il> for 5436@debbugs.gnu.org; Sun, 24 Jan 2010 20:24:40 +0200 (IST) Original-Received: from HOME-C4E4A596F7 ([84.228.141.118]) by a-mtaout20.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0KWR002GKKH01H00@a-mtaout20.012.net.il>; Sun, 24 Jan 2010 20:24:37 +0200 (IST) In-reply-to: <4B5BC912.3050409@harpegolden.net> X-012-Sender: halo1@inter.net.il X-Spam-Score: -1.7 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list X-Spam-Score: -1.7 (-) Resent-Date: Sun, 24 Jan 2010 13:26:02 -0500 X-detected-operating-system: by monty-python.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:34680 Archived-At: > Date: Sun, 24 Jan 2010 04:14:10 +0000 > From: David De La Harpe Golden > Cc: Tassilo Horn , 5436@debbugs.gnu.org > > Please find attached small* patch that should address this (and Bug#3353). Thanks. > - ;; We do not want to delete "." and "..". This comment was not added to the new code. I think it's useful, even though the name directory-files-no-dot-files-regexp hints about the intent. > + ;; move-file-to-trash moves directories, empty or > + ;; otherwise, into the trash as a unit. So if the directory is > + ;; non-empty, only call move-file-to-trash here if recursive is non-nil, > + ;; so that having delete-by-moving-trash non-nil doesn't cause "greedier" > + ;; (pseudo-)deletion behaviour. Looks like this comment was not filled (via M-q). Also, please always leave two blanks after the period that ends a sentence. > + (if delete-by-moving-to-trash > + (if (and (not recursive) > + (directory-files > + directory 'full directory-files-no-dot-files-regexp)) > + (error "Directory is not empty, not moving to trash.") > + (move-file-to-trash directory)) Why error out here? Isn't it better to display a message and continue (with other potential moves)? I'm frequently annoyed by a tool's tendency to give up early leaving me in the middle of a partly done job. > + ;; do recursion if necessary if we're not moving to trash Full sentences beginning with a capital letter, please. > +deleting files outright. If FILENAME is a directory, it ^^ One more space. > +/* Lisp function for recursively copying directories. */ ^ Two spaces here. > + if (!NILP (Ffile_directory_p (file))) > + { > + newname = Fexpand_file_name (Ffile_name_nondirectory (Fdirectory_file_name (file)), newname); > + } > + else > + { > + newname = Fexpand_file_name (Ffile_name_nondirectory (file), newname); > + } No need for braces if there's only one line in the clause. Thanks again for working on this.