From: Chunyang Xu <mail@xuchunyang.me>
To: 25578@debbugs.gnu.org
Subject: bug#25578: [PATCH] Prompt default extension in dired-mark-extension
Date: Mon, 30 Jan 2017 21:44:24 +0800 [thread overview]
Message-ID: <m2y3xsek7b.fsf@xuchunyang.me> (raw)
[-- Attachment #1: Type: text/plain, Size: 324 bytes --]
Hi.
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.
[-- Attachment #2: 0001-Prompt-default-extension-in-dired-mark-extension.patch --]
[-- Type: text/plain, Size: 2546 bytes --]
From 21769fb5b92d19fbc428f8022d2aa3cc81a55db2 Mon Sep 17 00:00:00 2001
From: Chunyang Xu <mail@xuchunyang.me>
Date: Mon, 30 Jan 2017 21:10:37 +0800
Subject: [PATCH] Prompt default extension in dired-mark-extension
* lisp/dired-x.el (dired-mark-extension): Prompt default extension
base on extension of file at point.
Copyright-paperwork-exempt: yes
---
lisp/dired-x.el | 39 +++++++++++++++++++++++----------------
1 file changed, 23 insertions(+), 16 deletions(-)
diff --git a/lisp/dired-x.el b/lisp/dired-x.el
index 86c95372c2..6c8fb0e7da 100644
--- a/lisp/dired-x.el
+++ b/lisp/dired-x.el
@@ -342,22 +342,29 @@ dired-mark-extension
Prefixed with one C-u, unmark files instead.
Prefixed with two C-u's, prompt for MARKER-CHAR and mark files with it."
(interactive
- (let ((suffix
- (read-string (format "%s extension: "
- (if (equal current-prefix-arg '(4))
- "UNmarking"
- "Marking"))))
- (marker
- (pcase current-prefix-arg
- ('(4) ?\s)
- ('(16)
- (let* ((dflt (char-to-string dired-marker-char))
- (input (read-string
- (format
- "Marker character to use (default %s): " dflt)
- nil nil dflt)))
- (aref input 0)))
- (_ dired-marker-char))))
+ (let* ((default
+ (let ((file (dired-get-filename nil t)))
+ (when file
+ (file-name-extension file))))
+ (suffix
+ (read-string (format "%s extension%s: "
+ (if (equal current-prefix-arg '(4))
+ "UNmarking"
+ "Marking")
+ (if default
+ (format " (default %s)" default)
+ "")) nil nil default))
+ (marker
+ (pcase current-prefix-arg
+ ('(4) ?\s)
+ ('(16)
+ (let* ((dflt (char-to-string dired-marker-char))
+ (input (read-string
+ (format
+ "Marker character to use (default %s): " dflt)
+ nil nil dflt)))
+ (aref input 0)))
+ (_ dired-marker-char))))
(list suffix marker)))
(or (listp extension)
(setq extension (list extension)))
--
2.11.0
next reply other threads:[~2017-01-30 13:44 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-30 13:44 Chunyang Xu [this message]
2017-02-05 23:20 ` bug#25578: [PATCH] Prompt default extension in dired-mark-extension Juri Linkov
2017-02-06 13:58 ` Tino Calancha
2017-02-27 22:45 ` Juri Linkov
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=m2y3xsek7b.fsf@xuchunyang.me \
--to=mail@xuchunyang.me \
--cc=25578@debbugs.gnu.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.