Subject: Re: bug#41524: 26.3; Request for 'x' for 'execute' in dired menu

From: Stefan Kangas <[email-masked]>
Date: Sun, 23 Aug 2020 20:26:33 -0400

tags 41524 + patch
thanks

Drew Adams <[email-masked]> writes:

>> I was using dired recently after a very long break from it.
>>
>> I marked some files for deletion, wasn't sure how to actually trigger
>> the delete, had a suspicion it was 'x' but checked the menu anyway (I
>> often use the menu merely as a handy cheat-sheet for the keyboard
>> commands). It appears not to be there.
>>
>> If it is actually missing I request it be added as it makes no sense
>> for
>> beginners, who may actually use the menu with the mouse, to be able to
>> variously mark stuff but then lack a way of carrying them out.
>
> Yes, `x' is not in a menu-bar menu.  It should be.
>
> If you use Dired+, it is.  There, you have submenu
> `Delete', with menu items `Delete Marked (not Flagged)'
> and `Delete Flagged'.  The former has key `D', and the
> latter has key `x'.
>
> (In Dired+, menu-bar menu `Operate' is named `Multiple',
> so submenu `Delete' is `Multiple > Delete', not `Operate
>> Delete'.)

How does the attached patch look?

(I had a look at Dired+ and lifted some help strings from there.
Thanks Drew.)

Best regards,
Stefan Kangas
From 935683608dc3e9ab0d607fb5cdf0eca3d50b280d Mon Sep 17 00:00:00 2001
From: Stefan Kangas <[email-masked]>
Date: Mon, 24 Aug 2020 02:17:52 +0200
Subject: [PATCH] Add "Delete" submenu to Dired "Mark" menu

* lisp/dired.el (dired-mode-map): Add "Delete" submenu.
(Bug#41524)
---
 lisp/dired.el | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/lisp/dired.el b/lisp/dired.el
index aad44a6d69..7d70f4288e 100644
--- a/lisp/dired.el
+++ b/lisp/dired.el
@@ -2065,6 +2065,16 @@ dired-mode-map
 		  :help "Replace marker with another character"))
     (define-key map [menu-bar mark unmark-all]
       '(menu-item "Unmark All" dired-unmark-all-marks))
+    (define-key map [menu-bar mark delete]
+      `(menu-item "Delete"
+                  ,(let ((menu (make-sparse-keymap "Delete")))
+                     (define-key menu [delete-flagged]
+                       '(menu-item "Delete Flagged Files" dired-do-flagged-delete
+                                   :help "Delete all files flagged for deletion (D)"))
+                     (define-key menu [delete-marked]
+                       '(menu-item "Delete Marked (Not Flagged) Files" dired-do-delete
+                                   :help "Delete current file or all marked files (not flagged files)"))
+                     menu)))
     (define-key map [menu-bar mark symlinks]
       '(menu-item "Mark Symlinks" dired-mark-symlinks
 		  :visible (fboundp 'make-symbolic-link)
-- 
2.28.0