Subject: Re: bug#25578: [PATCH] Prompt default extension in dired-mark-extension

From: Juri Linkov <[email-masked]>
Date: Mon, 06 Feb 2017 01:20:23 +0200

> I want 'M-x dired-mark-extension' (from dired-x) in Dired to use the
> extension of the file at point as default extension, when it is
> possible. Because, in this way, I usually no longer need to type the
> extension manually, which saves some time for me–someone can't type
> English words quickly and accurately.

Thanks, I think your patch is a useful addition.

Also I'm using a similar feature for another Dired command
‘dired-mark-files-regexp’ that could provide similar defaults
based on the current file and its extension:

diff --git a/lisp/dired.el b/lisp/dired.el
index 2733372..7d7af0b 100644
--- a/lisp/dired.el
+++ b/lisp/dired.el
@@ -3361,7 +3361,12 @@ (defun dired-mark-files-regexp (regexp &optional marker-char)
   (interactive
    (list (read-regexp (concat (if current-prefix-arg "Unmark" "Mark")
                               " files (regexp): ")
-                      nil 'dired-regexp-history)
+                      (delq nil (list (dired-get-filename t t)
+                                      (and (dired-get-filename nil t)
+                                           (concat (regexp-quote (file-name-extension
+                                                                  (dired-get-filename nil t) t))
+                                                   "\\'"))))
+                      'dired-regexp-history)
 	 (if current-prefix-arg ?\040)))
   (let ((dired-marker-char (or marker-char dired-marker-char)))
     (dired-mark-if