GNU bug report logs - #27940
Recursively delete dir34? (yes, no, all, quit)

Previous Next

Package: emacs;

Reported by: 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>

Date: Fri, 4 Aug 2017 00:38:01 UTC

Severity: wishlist

Done: Tino Calancha <tino.calancha <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


Message #8 received at 27940 <at> debbugs.gnu.org (full text, mbox):

From: Tino Calancha <tino.calancha <at> gmail.com>
To: 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>
Cc: 27940 <at> debbugs.gnu.org, Eli Zaretskii <eliz <at> gnu.org>
Subject: Re: bug#27940: Recursively delete dir34? (yes, no, all, quit)
Date: Fri, 04 Aug 2017 17:25:49 +0900
積丹尼 Dan Jacobson <jidanni <at> jidanni.org> 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 <tino.calancha <at> gmail.com>
Date:   Fri Aug 4 17:21:29 2017 +0900

    dired-do-delete: Delete dirs recursively if called w/ 2 prefices
    
    * 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)))
 
 (defvar dired-deletion-confirmer 'yes-or-no-p) ; or y-or-n-p?
 
@@ -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




This bug report was last modified 7 years and 218 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.