From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Tino Calancha Newsgroups: gmane.emacs.bugs Subject: bug#27940: Recursively delete dir34? (yes, no, all, quit) Date: Fri, 04 Aug 2017 17:25:49 +0900 Message-ID: <87r2wrkacy.fsf@calancha-pc> References: <87o9rwxmfz.fsf@jidanni.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1501835236 1074 195.159.176.226 (4 Aug 2017 08:27:16 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 4 Aug 2017 08:27:16 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) Cc: 27940@debbugs.gnu.org To: =?UTF-8?Q?=E7=A9=8D=E4=B8=B9=E5=B0=BC?= Dan Jacobson Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Aug 04 10:27:10 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ddXwq-0008Jc-0d for geb-bug-gnu-emacs@m.gmane.org; Fri, 04 Aug 2017 10:27:08 +0200 Original-Received: from localhost ([::1]:44858 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ddXww-0000YG-5P for geb-bug-gnu-emacs@m.gmane.org; Fri, 04 Aug 2017 04:27:14 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:47594) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ddXwo-0000Y1-WE for bug-gnu-emacs@gnu.org; Fri, 04 Aug 2017 04:27:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ddXwk-00070m-EJ for bug-gnu-emacs@gnu.org; Fri, 04 Aug 2017 04:27:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:38113) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ddXwk-00070Q-9V for bug-gnu-emacs@gnu.org; Fri, 04 Aug 2017 04:27:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ddXwk-00007P-38 for bug-gnu-emacs@gnu.org; Fri, 04 Aug 2017 04:27:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Tino Calancha Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 04 Aug 2017 08:27:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 27940 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 27940-submit@debbugs.gnu.org id=B27940.1501835164388 (code B ref 27940); Fri, 04 Aug 2017 08:27:02 +0000 Original-Received: (at 27940) by debbugs.gnu.org; 4 Aug 2017 08:26:04 +0000 Original-Received: from localhost ([127.0.0.1]:40790 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ddXvn-00006A-MU for submit@debbugs.gnu.org; Fri, 04 Aug 2017 04:26:03 -0400 Original-Received: from mail-pg0-f65.google.com ([74.125.83.65]:36458) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ddXvl-00005Y-OF for 27940@debbugs.gnu.org; Fri, 04 Aug 2017 04:26:02 -0400 Original-Received: by mail-pg0-f65.google.com with SMTP id y129so1157988pgy.3 for <27940@debbugs.gnu.org>; Fri, 04 Aug 2017 01:26:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-transfer-encoding; bh=suCIfRMJJn/nZjwWN4ks+HCmO3JvO0ieMP2v3Tco4+c=; b=ePGyxbvtDGBUWqSwKCs5CCswS2SeYLVMRfeg/BHe8wMzpTWx9svpXIRxh0CsaIH16/ Naq4aL0fogv15+j6DOS5sP3Bjc+wPn/CtkUPGtPpjXJ+5lOA3CNzXLGtskbnuc0Hok61 INdqmqWQ/gU1uDyXUf7whB6gSI/VefHAXnPNHKFHTCB0vt5SYaxrB4Ao7dlAwXD06LIl Lwx83vceJEp5R+b/KpQbnzeE5fX81iWhTXoAhQeYK+f3asQST4j1OPMHdH2b+9Nrvk8I yGBDHemtbCvzMxWv6xjwhe0ol6TXGIbYNSumQNZ4mO4AooOVOGX3KXuJ1X0G38tiBwdB sLcQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-transfer-encoding; bh=suCIfRMJJn/nZjwWN4ks+HCmO3JvO0ieMP2v3Tco4+c=; b=J6qCICGjgsp+lfoKpMLnvFUwppxgS71AohAIQt3AyPw74DkZWclp4BSV403tL0ceDf CCIK3aQb+I8+h5y3U/MuxheERbldSUPlPjBWFlspO29wMUu422xx+MRxtRKylwv5XZAf rY7V29XUiDEtRYIUNrgGqNEoRWBNpcI+RxcxNIgtkXcrYkxruudk/feg8hXWea+wS7R4 M6J+iNLCbQj0EwDCK0mRkelow5ZPwAMfiMbCkM7URZH9eFsOBfA4byA1fbhGucPd2mUl 0SCBt60tpsxc9G3lTbVE9a+fC+OphH4XClSpekUeL5ydSG8noNu+GX5YeAW7FZdcw8Vi SLwA== X-Gm-Message-State: AIVw1126wgR5tPNEZnuv5d2jknNx+I0iux/DDlVyTECvIG+fiI1r79T5 ns/Jy/raaKehtw== X-Received: by 10.99.66.130 with SMTP id p124mr1510520pga.53.1501835155908; Fri, 04 Aug 2017 01:25:55 -0700 (PDT) Original-Received: from calancha-pc (170.224.128.101.dy.bbexcite.jp. [101.128.224.170]) by smtp.gmail.com with ESMTPSA id h81sm1862223pfj.72.2017.08.04.01.25.53 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 04 Aug 2017 01:25:54 -0700 (PDT) In-Reply-To: <87o9rwxmfz.fsf@jidanni.org> ("=?UTF-8?Q?=E7=A9=8D=E4=B8=B9=E5=B0=BC?= Dan Jacobson"'s message of "Fri, 04 Aug 2017 07:26:24 +0800") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 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.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:135326 Archived-At: =E7=A9=8D=E4=B8=B9=E5=B0=BC Dan Jacobson writes: > dired-do-flagged-delete and me interaction: > Recursively delete dcepc? (yes or no) yes > Recursively delete emmpc? (yes or no) yes > Recursively delete zpspc? (yes or no) yes > Recursively delete dgcpc? (yes or no) yes > > Wouldn't it be nice if there was instead: > Recursively delete dgcpc? (yes, no, all, quit) > > Yes, if before we started we set the variables we needn't be asked all > those questions. > > But now *midway* through the list, we decide we would like no more > question, there should be a way, without needing to quit and start over, > even if doing that isn't so bad. Thanks for the suggestion. You can already quit with '\C-g'. Concerning accept 'all' in the prompt, i am not sure: it's a bit dangerous operation. In the other hand: 1) Customize `dired-recursive-deletes' to value 'always. 2) Do the deletion. 3) Set back `dired-recursive-deletes' to its original value. It looks a little cumbersome. How about if `dired-do-delete' called interactively with 2 prefices performs recursive deletions? Eli? --8<-----------------------------cut here---------------start------------->= 8--- commit 9360866c364f75cac40dc6f91dce93f6a1071f43 Author: Tino Calancha Date: Fri Aug 4 17:21:29 2017 +0900 dired-do-delete: Delete dirs recursively if called w/ 2 prefices =20=20=20=20 * lisp/dired.el (dired-do-delete): Bind dired-recursive-deletes to 'always when called interactively with 2 prefices. (dired-internal-do-deletions): Show in the prompt if we are deleteing directories recursively. diff --git a/lisp/dired.el b/lisp/dired.el index 24759c6c9b..198968361f 100644 --- a/lisp/dired.el +++ b/lisp/dired.el @@ -3031,15 +3031,23 @@ dired-do-flagged-delete (defun dired-do-delete (&optional arg) "Delete all marked (or next ARG) files. `dired-recursive-deletes' controls whether deletion of -non-empty directories is allowed." +non-empty directories is allowed. + +Interactively with 2 prefices, delete recursively non-empty +directories without prompt user." ;; This is more consistent with the file marking feature than ;; dired-do-flagged-delete. (interactive "P") - (dired-internal-do-deletions - ;; this may move point if ARG is an integer - (dired-map-over-marks (cons (dired-get-filename) (point)) - arg) - arg t)) + (let ((dired-recursive-deletes + (pcase arg + ('(16) (setq arg nil) 'always) + (_ dired-recursive-deletes)))) + (message "dired-recursive-deletes %S" dired-recursive-deletes) + (dired-internal-do-deletions + ;; this may move point if ARG is an integer + (dired-map-over-marks (cons (dired-get-filename) (point)) + arg) + arg t))) =20 (defvar dired-deletion-confirmer 'yes-or-no-p) ; or y-or-n-p? =20 @@ -3055,13 +3063,15 @@ dired-internal-do-deletions (let* ((files (mapcar #'car l)) (count (length l)) (succ 0) + (recursive-del-p (eq dired-recursive-deletes 'always)) (trashing (and trash delete-by-moving-to-trash))) ;; canonicalize file list for pop up (setq files (nreverse (mapcar #'dired-make-relative files))) (if (dired-mark-pop-up " *Deletions*" 'delete files dired-deletion-confirmer - (format "%s %s " + (format "%s%s %s" (if trashing "Trash" "Delete") + (if recursive-del-p " recursively" "") (dired-mark-prompt arg files))) (save-excursion (let ((progress-reporter --8<-----------------------------cut here---------------end--------------->= 8--- In GNU Emacs 26.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.22.11) of 2017-08-04 Repository revision: db5d38ddb0de83d8f920b7a128fe3fd5156fdf85