all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#25665: 26.0.50; [PATCH] Indicate prefix arg in minibuffer prompt for shell-command
@ 2017-02-09 15:10 Chunyang Xu
  2017-02-09 16:53 ` Tino Calancha
  0 siblings, 1 reply; 12+ messages in thread
From: Chunyang Xu @ 2017-02-09 15:10 UTC (permalink / raw)
  To: 25665

[-- 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


^ permalink raw reply related	[flat|nested] 12+ messages in thread
[parent not found: <<m2wpczwgay.fsf@xuchunyang.me>]

end of thread, other threads:[~2019-06-24 23:04 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-02-09 15:10 bug#25665: 26.0.50; [PATCH] Indicate prefix arg in minibuffer prompt for shell-command Chunyang Xu
2017-02-09 16:53 ` 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

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.