From: Tino Calancha <tino.calancha@gmail.com>
To: "積丹尼 Dan Jacobson" <jidanni@jidanni.org>
Cc: 27940@debbugs.gnu.org
Subject: bug#27940: Recursively delete dir34? (yes, no, all, quit)
Date: Fri, 04 Aug 2017 17:25:49 +0900 [thread overview]
Message-ID: <87r2wrkacy.fsf@calancha-pc> (raw)
In-Reply-To: <87o9rwxmfz.fsf@jidanni.org> ("積丹尼 Dan Jacobson"'s message of "Fri, 04 Aug 2017 07:26:24 +0800")
積丹尼 Dan Jacobson <jidanni@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@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
next prev parent reply other threads:[~2017-08-04 8:25 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-03 23:26 bug#27940: Recursively delete dir34? (yes, no, all, quit) 積丹尼 Dan Jacobson
2017-08-04 8:25 ` Tino Calancha [this message]
2017-08-04 8:31 ` Eli Zaretskii
2017-08-04 9:29 ` Tino Calancha
2017-08-04 9:37 ` Tino Calancha
2017-08-04 12:46 ` Eli Zaretskii
2017-08-04 14:33 ` Tino Calancha
2017-08-04 14:54 ` Eli Zaretskii
2017-08-06 4:52 ` Tino Calancha
[not found] ` <87k22e9obk.fsf@ctlt579.codethink.co.uk>
2017-08-09 5:54 ` Tino Calancha
2017-10-15 14:17 ` Noam Postavsky
2017-10-16 5:20 ` Tino Calancha
2017-10-16 10:36 ` Noam Postavsky
2017-10-16 10:43 ` Tino Calancha
2017-10-17 12:40 ` Noam Postavsky
[not found] ` <<871sorz9kg.fsf@calancha-pc>
[not found] ` <<83tw1nwfhp.fsf@gnu.org>
2017-08-04 15:51 ` Drew Adams
2017-08-04 16:18 ` Tino Calancha
2017-08-04 16:22 ` Drew Adams
2017-08-04 16:34 ` Tino Calancha
[not found] <<87o9rwxmfz.fsf@jidanni.org>
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87r2wrkacy.fsf@calancha-pc \
--to=tino.calancha@gmail.com \
--cc=27940@debbugs.gnu.org \
--cc=jidanni@jidanni.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.