From: Chunyang Xu <mail@xuchunyang.me>
To: 25665@debbugs.gnu.org
Subject: bug#25665: 26.0.50; [PATCH] Indicate prefix arg in minibuffer prompt for shell-command
Date: Thu, 09 Feb 2017 23:10:45 +0800 [thread overview]
Message-ID: <m2wpczwgay.fsf@xuchunyang.me> (raw)
[-- Attachment #1: Type: text/plain, Size: 331 bytes --]
Hi,
When using 'C-u M-!' ('shell-command') I feel confident if the
minibuffer prompt becomes
Shell command and insert output:
since it explains the purpose of the prefix argument. The same thing
goes for 'M-&' ('async-shell-command') and 'M-|'
('shell-command-on-region'). I have attached a patch which implements
this idea.
[-- Attachment #2: 0001-Indicate-prefix-arg-in-minibuffer-prompt-for-shell-c.patch --]
[-- Type: text/plain, Size: 3424 bytes --]
From e395aa9e601bb8071b53704b7aa27b8b28ac22b1 Mon Sep 17 00:00:00 2001
From: Chunyang Xu <mail@xuchunyang.me>
Date: Thu, 9 Feb 2017 22:47:40 +0800
Subject: [PATCH] Indicate prefix arg in minibuffer prompt for shell-command
* lisp/simple.el (async-shell-command, shell-command)
(shell-command-on-region): Show purpose of prefix argument in
the minibuffer prompt.
Copyright-paperwork-exempt: yes
---
lisp/simple.el | 42 +++++++++++++++++++++++++++---------------
1 file changed, 27 insertions(+), 15 deletions(-)
diff --git a/lisp/simple.el b/lisp/simple.el
index 441713a18b..9720a8935c 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -3311,13 +3311,17 @@ async-shell-command
shell (with its need to quote arguments)."
(interactive
(list
- (read-shell-command "Async shell command: " nil nil
- (let ((filename
- (cond
- (buffer-file-name)
- ((eq major-mode 'dired-mode)
- (dired-get-filename nil t)))))
- (and filename (file-relative-name filename))))
+ (read-shell-command (format "Async shell command%s: "
+ (if current-prefix-arg
+ " and insert output"
+ ""))
+ nil nil
+ (let ((filename
+ (cond
+ (buffer-file-name)
+ ((eq major-mode 'dired-mode)
+ (dired-get-filename nil t)))))
+ (and filename (file-relative-name filename))))
current-prefix-arg
shell-command-default-error-buffer))
(unless (string-match "&[ \t]*\\'" command)
@@ -3382,13 +3386,17 @@ shell-command
(interactive
(list
- (read-shell-command "Shell command: " nil nil
- (let ((filename
- (cond
- (buffer-file-name)
- ((eq major-mode 'dired-mode)
- (dired-get-filename nil t)))))
- (and filename (file-relative-name filename))))
+ (read-shell-command (format "Shell command%s: "
+ (if current-prefix-arg
+ " and insert output"
+ ""))
+ nil nil
+ (let ((filename
+ (cond
+ (buffer-file-name)
+ ((eq major-mode 'dired-mode)
+ (dired-get-filename nil t)))))
+ (and filename (file-relative-name filename))))
current-prefix-arg
shell-command-default-error-buffer))
;; Look for a handler in case default-directory is a remote file name.
@@ -3640,7 +3648,11 @@ shell-command-on-region
;; Do this before calling region-beginning
;; and region-end, in case subprocess output
;; relocates them while we are in the minibuffer.
- (setq string (read-shell-command "Shell command on region: "))
+ (setq string (read-shell-command
+ (format "Shell command on region%s: "
+ (if current-prefix-arg
+ " and replace with output"
+ ""))))
;; call-interactively recognizes region-beginning and
;; region-end specially, leaving them in the history.
(list (region-beginning) (region-end)
--
2.11.0
next reply other threads:[~2017-02-09 15:10 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-09 15:10 Chunyang Xu [this message]
2017-02-09 16:53 ` bug#25665: 26.0.50; [PATCH] Indicate prefix arg in minibuffer prompt for shell-command Tino Calancha
2017-02-09 18:08 ` Drew Adams
2017-02-09 20:31 ` Eli Zaretskii
2017-02-10 4:23 ` Chunyang Xu
2017-02-09 22:54 ` npostavs
2017-02-10 3:05 ` Tino Calancha
2017-02-10 4:16 ` npostavs
2017-02-10 7:13 ` Tino Calancha
2017-02-10 16:19 ` Noam Postavsky
2019-06-24 23:04 ` Lars Ingebrigtsen
[not found] <<m2wpczwgay.fsf@xuchunyang.me>
[not found] ` <<8760kjz4nv.fsf@calancha-pc>
[not found] ` <<83r3373y3f.fsf@gnu.org>
2017-02-09 21:00 ` Drew Adams
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=m2wpczwgay.fsf@xuchunyang.me \
--to=mail@xuchunyang.me \
--cc=25665@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.