From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Chunyang Xu Newsgroups: gmane.emacs.bugs 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 Message-ID: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: blaine.gmane.org 1486653140 31034 195.159.176.226 (9 Feb 2017 15:12:20 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 9 Feb 2017 15:12:20 +0000 (UTC) To: 25665@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Feb 09 16:12:14 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cbqOL-0007lU-OS for geb-bug-gnu-emacs@m.gmane.org; Thu, 09 Feb 2017 16:12:13 +0100 Original-Received: from localhost ([::1]:38436 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cbqOR-0003VM-B7 for geb-bug-gnu-emacs@m.gmane.org; Thu, 09 Feb 2017 10:12:19 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:45543) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cbqOF-0003TC-Ak for bug-gnu-emacs@gnu.org; Thu, 09 Feb 2017 10:12:08 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cbqOA-0007Bh-D9 for bug-gnu-emacs@gnu.org; Thu, 09 Feb 2017 10:12:07 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:35156) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cbqOA-0007Bd-9U for bug-gnu-emacs@gnu.org; Thu, 09 Feb 2017 10:12:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1cbqOA-0003iX-2G for bug-gnu-emacs@gnu.org; Thu, 09 Feb 2017 10:12:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Chunyang Xu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 09 Feb 2017 15:12:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 25665 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.148665307514229 (code B ref -1); Thu, 09 Feb 2017 15:12:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 9 Feb 2017 15:11:15 +0000 Original-Received: from localhost ([127.0.0.1]:33355 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cbqNO-0003hR-V8 for submit@debbugs.gnu.org; Thu, 09 Feb 2017 10:11:15 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:53044) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cbqNM-0003hB-Dx for submit@debbugs.gnu.org; Thu, 09 Feb 2017 10:11:14 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cbqNG-0006ba-04 for submit@debbugs.gnu.org; Thu, 09 Feb 2017 10:11:07 -0500 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:48225) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cbqNF-0006bW-TX for submit@debbugs.gnu.org; Thu, 09 Feb 2017 10:11:05 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:44004) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cbqNE-0002T5-NT for bug-gnu-emacs@gnu.org; Thu, 09 Feb 2017 10:11:05 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cbqN9-0006Zg-O6 for bug-gnu-emacs@gnu.org; Thu, 09 Feb 2017 10:11:04 -0500 Original-Received: from smtpbg65.qq.com ([103.7.28.233]:4790) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cbqN9-0006Z2-4E for bug-gnu-emacs@gnu.org; Thu, 09 Feb 2017 10:10:59 -0500 X-QQ-mid: bizesmtp1t1486653045twpn2r7hl Original-Received: from Chunyangs-MacBook-Air.local (unknown [114.236.198.223]) by esmtp4.qq.com (ESMTP) with SMTP id 0 for ; Thu, 09 Feb 2017 23:10:44 +0800 (CST) X-QQ-SSF: 0110000000200040F410000A0000000 X-QQ-FEAT: PH6C0OPhr9FdXYvebuEoA/Qq3KBSvFVBE/Mia7noYyMEm57UEsGO8TS29VU9/ 0IeZbv9nBiWYBHrr20GTJw1d0QkJgeQfwp6To90e3jHHQBBW9BtI/mTwBINXQyekKXpFxyP ssro/O2pKfKVNRE2uiW2FLRs0xs1t/w+vwY2koAYfzZ2Mz3j88rVQ7Tz61u+sNeu3pL42au y3/NE5whtPCEKL0Ba8BMSLx4PTVj3BGZt6tmdQXjCKUUvFMlBLC/HVShnEIZ+iXXNY76zMn kxow== X-QQ-GoodBg: 0 X-QQ-SENDSIZE: 520 X-QQ-Bgrelay: 1 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x [fuzzy] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:129150 Archived-At: --=-=-= Content-Type: text/plain 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. --=-=-= Content-Type: text/plain Content-Disposition: inline; filename=0001-Indicate-prefix-arg-in-minibuffer-prompt-for-shell-c.patch >From e395aa9e601bb8071b53704b7aa27b8b28ac22b1 Mon Sep 17 00:00:00 2001 From: Chunyang Xu 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 --=-=-=--