GNU bug report logs - #25578
[PATCH] Prompt default extension in dired-mark-extension

Previous Next

Package: emacs;

Reported by: Chunyang Xu <mail <at> xuchunyang.me>

Date: Mon, 30 Jan 2017 13:45:02 UTC

Severity: wishlist

Tags: patch

Done: Juri Linkov <juri <at> linkov.net>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Juri Linkov <juri <at> linkov.net>
To: Chunyang Xu <mail <at> xuchunyang.me>
Cc: 25578 <at> debbugs.gnu.org
Subject: bug#25578: [PATCH] Prompt default extension in dired-mark-extension
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




This bug report was last modified 8 years and 144 days ago.

Previous Next


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