* bug#4987: 23.1; shell-command: optionally include working dir in prompt @ 2009-11-20 12:57 trentbuck 2009-11-20 17:27 ` Juri Linkov 2019-10-10 23:20 ` Stefan Kangas 0 siblings, 2 replies; 15+ messages in thread From: trentbuck @ 2009-11-20 12:57 UTC (permalink / raw) To: bug-gnu-emacs At http://namazu.org/~tsuchiya/elisp/shell-command.el is an emacs library that "enables tab-completion for `shell-command'". I noticed recently that Emacs does this internally now. Yay! But one thing shell-command.el did that Emacs 23 doesn't appear to do, is to include the working directory in the shell-command and dired-do-shell-command prompts. It'd be neat if Emacs did that, too. In GNU Emacs 23.1.1 (i486-pc-linux-gnu) of 2009-09-14 on raven, modified by Debian configured using `configure '--build=i486-linux-gnu' '--host=i486-linux-gnu' '--prefix=/usr' '--sharedstatedir=/var/lib' '--libexecdir=/usr/lib' '--localstatedir=/var/lib' '--infodir=/usr/share/info' '--mandir=/usr/share/man' '--with-pop=yes' '--enable-locallisppath=/etc/emacs23:/etc/emacs:/usr/local/share/emacs/23.1/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/23.1/site-lisp:/usr/share/emacs/site-lisp:/usr/share/emacs/23.1/leim' '--with-x=no' 'build_alias=i486-linux-gnu' 'host_alias=i486-linux-gnu' 'CFLAGS=-DDEBIAN -g -O2' 'LDFLAGS=-g' 'CPPFLAGS='' Important settings: value of $LC_ALL: nil value of $LC_COLLATE: C value of $LC_CTYPE: nil value of $LC_MESSAGES: nil value of $LC_MONETARY: nil value of $LC_NUMERIC: nil value of $LC_TIME: nil value of $LANG: en_AU.utf8 value of $XMODIFIERS: nil locale-coding-system: utf-8-unix default-enable-multibyte-characters: t Major mode: rcirc Minor modes in effect: shell-dirtrack-mode: t diff-auto-refine-mode: t rcirc-track-minor-mode: t xterm-mouse-mode: t savehist-mode: t icomplete-mode: t partial-completion-mode: t show-paren-mode: t delete-selection-mode: t use-hard-newlines: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t global-auto-composition-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t column-number-mode: t line-number-mode: t transient-mark-mode: t Recent input: ESC O B ESC O B ESC O B ESC O B ESC ! C-g ESC O A ESC O A ESC O A ESC O A ESC O A ESC O A ESC O A ESC O A ESC O A ESC O A ESC O A ESC O A ESC O A ESC O A ESC ! C-g ESC ! C-g ESC ! C-g C-x ESC O C ESC O B C-x ESC O B Y o u ' d SPC t h i n k SPC t h e r e ' s SPC b e SPC a SPC w a y SPC t o SPC g o SPC b a c k SPC r DEL f r m SPC DEL DEL o m SPC a SPC s c r e e n l o g SPC t o SPC t p u t SPC c a l l s ESC b ESC b ESC f ( 1 ) C-e , SPC g i v e n SPC t h e SPC T E R M SPC t y p e RET C-x ESC O D C-x ESC O C C-x ESC O B ESC x r e p o r t b u g DEL DEL DEL SPC e m a c s - b u g C-g C-x ESC O D ESC x f i SPC l i b RET s h e l l - c o m m a n d RET C-x d C-g ESC < C-@ ESC O B ESC O B ESC O B ESC w C-x ESC O C C-x ESC O B ESC x r e p o r t SPC e m a c s SPC b u g RET C-g ESC x ESC O A RET Recent messages: Saving file /home/twb/Preferences/.emacs... Wrote /home/twb/Preferences/.emacs Quit Mark set Saving file /home/twb/Preferences/.emacs... Wrote /home/twb/Preferences/.emacs (No changes need to be saved) Quit [6 times] Mark set Mark activated Quit ^ permalink raw reply [flat|nested] 15+ messages in thread
* bug#4987: 23.1; shell-command: optionally include working dir in prompt 2009-11-20 12:57 bug#4987: 23.1; shell-command: optionally include working dir in prompt trentbuck @ 2009-11-20 17:27 ` Juri Linkov 2009-11-22 10:29 ` Juri Linkov 2019-10-10 23:20 ` Stefan Kangas 1 sibling, 1 reply; 15+ messages in thread From: Juri Linkov @ 2009-11-20 17:27 UTC (permalink / raw) To: trentbuck; +Cc: 4987 > At http://namazu.org/~tsuchiya/elisp/shell-command.el is an emacs > library that "enables tab-completion for `shell-command'". > > I noticed recently that Emacs does this internally now. Yay! But one > thing shell-command.el did that Emacs 23 doesn't appear to do, is to > include the working directory in the shell-command and > dired-do-shell-command prompts. It'd be neat if Emacs did that, too. shell-command.el relies on defadvices to implement this. I think a clean implementation should be designed to work more like minibuf-eldef.el. -- Juri Linkov http://www.jurta.org/emacs/ ^ permalink raw reply [flat|nested] 15+ messages in thread
* bug#4987: 23.1; shell-command: optionally include working dir in prompt 2009-11-20 17:27 ` Juri Linkov @ 2009-11-22 10:29 ` Juri Linkov 2009-11-23 4:27 ` Stefan Monnier 0 siblings, 1 reply; 15+ messages in thread From: Juri Linkov @ 2009-11-22 10:29 UTC (permalink / raw) To: 4987; +Cc: trentbuck > > At http://namazu.org/~tsuchiya/elisp/shell-command.el is an emacs > > library that "enables tab-completion for `shell-command'". > > > > I noticed recently that Emacs does this internally now. Yay! But one > > thing shell-command.el did that Emacs 23 doesn't appear to do, is to > > include the working directory in the shell-command and > > dired-do-shell-command prompts. It'd be neat if Emacs did that, too. > > shell-command.el relies on defadvices to implement this. I think a clean > implementation should be designed to work more like minibuf-eldef.el. On second thought, there is no need to over-complicate this feature. So we could add a new defcustom to define the prompt format and to use it in `read-shell-command' to modify the prompt. -- Juri Linkov http://www.jurta.org/emacs/ ^ permalink raw reply [flat|nested] 15+ messages in thread
* bug#4987: 23.1; shell-command: optionally include working dir in prompt 2009-11-22 10:29 ` Juri Linkov @ 2009-11-23 4:27 ` Stefan Monnier 0 siblings, 0 replies; 15+ messages in thread From: Stefan Monnier @ 2009-11-23 4:27 UTC (permalink / raw) To: Juri Linkov; +Cc: trentbuck, 4987 > On second thought, there is no need to over-complicate this feature. > So we could add a new defcustom to define the prompt format and to > use it in `read-shell-command' to modify the prompt. Yes, that would be much simpler, Stefan ^ permalink raw reply [flat|nested] 15+ messages in thread
* bug#4987: 23.1; shell-command: optionally include working dir in prompt 2009-11-20 12:57 bug#4987: 23.1; shell-command: optionally include working dir in prompt trentbuck 2009-11-20 17:27 ` Juri Linkov @ 2019-10-10 23:20 ` Stefan Kangas 2019-10-11 0:31 ` Trent W. Buck 2019-10-11 8:14 ` Eli Zaretskii 1 sibling, 2 replies; 15+ messages in thread From: Stefan Kangas @ 2019-10-10 23:20 UTC (permalink / raw) To: trentbuck; +Cc: 4987 [-- Attachment #1: Type: text/plain, Size: 422 bytes --] trentbuck@gmail.com writes: > But one thing shell-command.el did that Emacs 23 doesn't appear to do, > is to include the working directory in the shell-command and > dired-do-shell-command prompts. It'd be neat if Emacs did that, too. This is a good idea. How about the attached patch? I didn't bother with dired-do-shell-command since it should be obvious what the working directory is. Best regards, Stefan Kangas [-- Attachment #2: 0001-Support-showing-directory-in-shell-command-prompt.patch --] [-- Type: application/octet-stream, Size: 2810 bytes --] From e126cfb2c605abbef25d1006e266f0aeee5e4ffd Mon Sep 17 00:00:00 2001 From: Stefan Kangas <stefankangas@gmail.com> Date: Thu, 10 Oct 2019 21:30:14 +0200 Subject: [PATCH] Support showing directory in shell command prompt * lisp/simple.el (shell-command-prompt-show-directory): New defcustom. (async-shell-command, shell-command): Show current directory in prompt when above option is non-nil. * etc/NEWS: Announce it. --- etc/NEWS | 4 ++++ lisp/simple.el | 21 +++++++++++++++++++-- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index 3b98ef7d2f..6b32c245f0 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1564,6 +1564,10 @@ variable for remote shells. It still defaults to "/bin/sh". *** 'async-shell-command-width' defines the number of display columns available for output of asynchronous shell commands. ++++ +*** Prompt for shell commands can now show the current directory. +Customize 'shell-command-prompt-show-directory' to enable it. + ** Pcomplete *** The 'pcomplete' command is now obsolete diff --git a/lisp/simple.el b/lisp/simple.el index b5205dd764..713dedbd3a 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -3376,6 +3376,13 @@ async-shell-command-width :group 'shell :version "27.1") +(defcustom shell-command-prompt-show-directory nil + "If non-nil, show current directory when prompting for a shell command. +This affects `shell-command' and `async-shell-command'." + :type 'boolean + :group 'shell + :version "27.1") + (defcustom shell-command-dont-erase-buffer nil "If non-nil, output buffer is not erased between shell commands. Also, a non-nil value sets the point in the output buffer @@ -3465,7 +3472,12 @@ async-shell-command a shell (with its need to quote arguments)." (interactive (list - (read-shell-command "Async shell command: " nil nil + (read-shell-command (if shell-command-prompt-show-directory + (format-message "Async shell command in `%s': " + (abbreviate-file-name + default-directory)) + "Async shell command: ") + nil nil (let ((filename (cond (buffer-file-name) @@ -3538,7 +3550,12 @@ shell-command (interactive (list - (read-shell-command "Shell command: " nil nil + (read-shell-command (if shell-command-prompt-show-directory + (format-message "Shell command in `%s': " + (abbreviate-file-name + default-directory)) + "Shell command: ") + nil nil (let ((filename (cond (buffer-file-name) -- 2.23.0 ^ permalink raw reply related [flat|nested] 15+ messages in thread
* bug#4987: 23.1; shell-command: optionally include working dir in prompt 2019-10-10 23:20 ` Stefan Kangas @ 2019-10-11 0:31 ` Trent W. Buck 2019-10-11 8:14 ` Eli Zaretskii 1 sibling, 0 replies; 15+ messages in thread From: Trent W. Buck @ 2019-10-11 0:31 UTC (permalink / raw) To: Stefan Kangas; +Cc: 4987 Stefan Kangas wrote: > trentbuck@gmail.com writes: >> One thing shell-command.el did, that Emacs 23 doesn't, is include >> the working directory in the prompts. > > This is a good idea. How about the attached patch? Looks good to me :-) ^ permalink raw reply [flat|nested] 15+ messages in thread
* bug#4987: 23.1; shell-command: optionally include working dir in prompt 2019-10-10 23:20 ` Stefan Kangas 2019-10-11 0:31 ` Trent W. Buck @ 2019-10-11 8:14 ` Eli Zaretskii 2019-10-11 11:03 ` Stefan Kangas 1 sibling, 1 reply; 15+ messages in thread From: Eli Zaretskii @ 2019-10-11 8:14 UTC (permalink / raw) To: Stefan Kangas; +Cc: trentbuck, 4987 > From: Stefan Kangas <stefan@marxist.se> > Date: Fri, 11 Oct 2019 01:20:15 +0200 > Cc: 4987@debbugs.gnu.org > > > But one thing shell-command.el did that Emacs 23 doesn't appear to do, > > is to include the working directory in the shell-command and > > dired-do-shell-command prompts. It'd be neat if Emacs did that, too. > > This is a good idea. How about the attached patch? Thanks, LGTM. I would suggest to name the defcustom to shell-command-prompt-show-cwd instead, it sounds more accurate to me. ^ permalink raw reply [flat|nested] 15+ messages in thread
* bug#4987: 23.1; shell-command: optionally include working dir in prompt 2019-10-11 8:14 ` Eli Zaretskii @ 2019-10-11 11:03 ` Stefan Kangas 2019-10-11 12:04 ` Michael Albinus 0 siblings, 1 reply; 15+ messages in thread From: Stefan Kangas @ 2019-10-11 11:03 UTC (permalink / raw) To: Eli Zaretskii; +Cc: trentbuck, 4987 close 4987 27.1 quit Eli Zaretskii <eliz@gnu.org> writes: > Thanks, LGTM. > > I would suggest to name the defcustom to shell-command-prompt-show-cwd > instead, it sounds more accurate to me. Thanks, I made that change and pushed this as commit 552c20ce39. Closing. Best regards, Stefan Kangas ^ permalink raw reply [flat|nested] 15+ messages in thread
* bug#4987: 23.1; shell-command: optionally include working dir in prompt 2019-10-11 11:03 ` Stefan Kangas @ 2019-10-11 12:04 ` Michael Albinus 2019-10-11 13:30 ` Stefan Kangas 0 siblings, 1 reply; 15+ messages in thread From: Michael Albinus @ 2019-10-11 12:04 UTC (permalink / raw) To: Stefan Kangas; +Cc: trentbuck, 4987 Stefan Kangas <stefan@marxist.se> writes: >> I would suggest to name the defcustom to shell-command-prompt-show-cwd >> instead, it sounds more accurate to me. > > Thanks, I made that change and pushed this as commit 552c20ce39. Closing. Shouldn't the user option be mentioned in the docstring and the Emacs manual? etc/NEWS is rarely used on a daily basis. > Best regards, > Stefan Kangas Best regards, Michael. ^ permalink raw reply [flat|nested] 15+ messages in thread
* bug#4987: 23.1; shell-command: optionally include working dir in prompt 2019-10-11 12:04 ` Michael Albinus @ 2019-10-11 13:30 ` Stefan Kangas 2019-10-11 14:26 ` Michael Albinus 2019-10-11 14:35 ` Robert Pluim 0 siblings, 2 replies; 15+ messages in thread From: Stefan Kangas @ 2019-10-11 13:30 UTC (permalink / raw) To: Michael Albinus; +Cc: trentbuck, 4987 [-- Attachment #1: Type: text/plain, Size: 241 bytes --] Michael Albinus <michael.albinus@gmx.de> writes: > Shouldn't the user option be mentioned in the docstring and the Emacs > manual? etc/NEWS is rarely used on a daily basis. Sure. How about the attached patch? Best regards, Stefan Kangas [-- Attachment #2: 0001-Improve-documentation-of-shell-command-prompt-show-c.patch --] [-- Type: application/octet-stream, Size: 1550 bytes --] From b5a8590ed56d19b38846ab88ed0b58e89808ea8f Mon Sep 17 00:00:00 2001 From: Stefan Kangas <stefankangas@gmail.com> Date: Fri, 11 Oct 2019 15:23:56 +0200 Subject: [PATCH] Improve documentation of shell-command-prompt-show-cwd * doc/emacs/misc.texi (Single Shell): * lisp/simple.el (shell-command): Document 'shell-command-prompt-show-cwd'. (Bug#4987) --- doc/emacs/misc.texi | 5 +++++ lisp/simple.el | 2 ++ 2 files changed, 7 insertions(+) diff --git a/doc/emacs/misc.texi b/doc/emacs/misc.texi index 3bfb729dc7..d260dff8de 100644 --- a/doc/emacs/misc.texi +++ b/doc/emacs/misc.texi @@ -787,6 +787,11 @@ Single Shell command output. The default value is @code{nil} that means to use the same number of columns as provided by the shell. +@vindex shell-command-promt-show-cwd + To make the above commands show the current directory in their +prompts, set the variable @code{shell-command-prompt-show-cmd} to a +non-nil value. + @kindex M-| @findex shell-command-on-region @kbd{M-|} (@code{shell-command-on-region}) is like @kbd{M-!}, but diff --git a/lisp/simple.el b/lisp/simple.el index 44ab8e125d..6f57bf15a2 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -3505,6 +3505,8 @@ shell-command With prefix argument, insert the COMMAND's output at point. Interactively, prompt for COMMAND in the minibuffer. +If `shell-command-prompt-show-cwd' is non-nil, show the current +directory in the prompt. If COMMAND ends in `&', execute it asynchronously. The output appears in the buffer `*Async Shell Command*'. -- 2.23.0 ^ permalink raw reply related [flat|nested] 15+ messages in thread
* bug#4987: 23.1; shell-command: optionally include working dir in prompt 2019-10-11 13:30 ` Stefan Kangas @ 2019-10-11 14:26 ` Michael Albinus 2019-10-11 14:35 ` Robert Pluim 1 sibling, 0 replies; 15+ messages in thread From: Michael Albinus @ 2019-10-11 14:26 UTC (permalink / raw) To: Stefan Kangas; +Cc: trentbuck, 4987 Stefan Kangas <stefan@marxist.se> writes: >> Shouldn't the user option be mentioned in the docstring and the Emacs >> manual? etc/NEWS is rarely used on a daily basis. > > Sure. How about the attached patch? LGTM, thanks. > Best regards, > Stefan Kangas Best regards, Michael. ^ permalink raw reply [flat|nested] 15+ messages in thread
* bug#4987: 23.1; shell-command: optionally include working dir in prompt 2019-10-11 13:30 ` Stefan Kangas 2019-10-11 14:26 ` Michael Albinus @ 2019-10-11 14:35 ` Robert Pluim 2019-10-12 8:12 ` Stefan Kangas 1 sibling, 1 reply; 15+ messages in thread From: Robert Pluim @ 2019-10-11 14:35 UTC (permalink / raw) To: Stefan Kangas; +Cc: trentbuck, Michael Albinus, 4987 >>>>> On Fri, 11 Oct 2019 15:30:11 +0200, Stefan Kangas <stefan@marxist.se> said: Stefan> +@vindex shell-command-promt-show-cwd Stefan> + To make the above commands show the current directory in their Stefan> +prompts, set the variable @code{shell-command-prompt-show-cmd} to a ^^^ 'cwd', no? (and it itʼs customizable, I prefer saying 'customize' rather than 'set') Robert ^ permalink raw reply [flat|nested] 15+ messages in thread
* bug#4987: 23.1; shell-command: optionally include working dir in prompt 2019-10-11 14:35 ` Robert Pluim @ 2019-10-12 8:12 ` Stefan Kangas 2019-10-14 9:32 ` Robert Pluim 0 siblings, 1 reply; 15+ messages in thread From: Stefan Kangas @ 2019-10-12 8:12 UTC (permalink / raw) To: Robert Pluim; +Cc: trentbuck, Michael Albinus, 4987 [-- Attachment #1: Type: text/plain, Size: 359 bytes --] Robert Pluim <rpluim@gmail.com> writes: > Stefan> +prompts, set the variable @code{shell-command-prompt-show-cmd} to a > ^^^ > 'cwd', no? > (and it itʼs customizable, I prefer saying 'customize' rather than 'set') Thanks, fixed in attached. Best regards, Stefan Kangas [-- Attachment #2: 0001-Improve-documentation-of-shell-command-prompt-show-c.patch --] [-- Type: application/octet-stream, Size: 1556 bytes --] From f01676ef81ce9a6291646538749ee25c8ddf00f8 Mon Sep 17 00:00:00 2001 From: Stefan Kangas <stefankangas@gmail.com> Date: Fri, 11 Oct 2019 15:23:56 +0200 Subject: [PATCH] Improve documentation of shell-command-prompt-show-cwd * doc/emacs/misc.texi (Single Shell): * lisp/simple.el (shell-command): Document 'shell-command-prompt-show-cwd'. (Bug#4987) --- doc/emacs/misc.texi | 5 +++++ lisp/simple.el | 2 ++ 2 files changed, 7 insertions(+) diff --git a/doc/emacs/misc.texi b/doc/emacs/misc.texi index 3bfb729dc7..3c0809813f 100644 --- a/doc/emacs/misc.texi +++ b/doc/emacs/misc.texi @@ -787,6 +787,11 @@ Single Shell command output. The default value is @code{nil} that means to use the same number of columns as provided by the shell. +@vindex shell-command-promt-show-cwd + To make the above commands show the current directory in their +prompts, customize the variable @code{shell-command-prompt-show-cwd} +to a non-nil value. + @kindex M-| @findex shell-command-on-region @kbd{M-|} (@code{shell-command-on-region}) is like @kbd{M-!}, but diff --git a/lisp/simple.el b/lisp/simple.el index 44ab8e125d..6f57bf15a2 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -3505,6 +3505,8 @@ shell-command With prefix argument, insert the COMMAND's output at point. Interactively, prompt for COMMAND in the minibuffer. +If `shell-command-prompt-show-cwd' is non-nil, show the current +directory in the prompt. If COMMAND ends in `&', execute it asynchronously. The output appears in the buffer `*Async Shell Command*'. -- 2.23.0 ^ permalink raw reply related [flat|nested] 15+ messages in thread
* bug#4987: 23.1; shell-command: optionally include working dir in prompt 2019-10-12 8:12 ` Stefan Kangas @ 2019-10-14 9:32 ` Robert Pluim 2019-10-17 10:57 ` Stefan Kangas 0 siblings, 1 reply; 15+ messages in thread From: Robert Pluim @ 2019-10-14 9:32 UTC (permalink / raw) To: Stefan Kangas; +Cc: trentbuck, Michael Albinus, 4987 >>>>> On Sat, 12 Oct 2019 10:12:36 +0200, Stefan Kangas <stefan@marxist.se> said: Stefan> +@vindex shell-command-promt-show-cwd Thereʼs a 'p' missing in 'prompt'. Robert ^ permalink raw reply [flat|nested] 15+ messages in thread
* bug#4987: 23.1; shell-command: optionally include working dir in prompt 2019-10-14 9:32 ` Robert Pluim @ 2019-10-17 10:57 ` Stefan Kangas 0 siblings, 0 replies; 15+ messages in thread From: Stefan Kangas @ 2019-10-17 10:57 UTC (permalink / raw) To: Robert Pluim; +Cc: trentbuck, Michael Albinus, 4987 Robert Pluim <rpluim@gmail.com> writes: > Thereʼs a 'p' missing in 'prompt'. Fixed and pushed to master as commit 3cf92da6fa. Best regards, Stefan Kangas ^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2019-10-17 10:57 UTC | newest] Thread overview: 15+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2009-11-20 12:57 bug#4987: 23.1; shell-command: optionally include working dir in prompt trentbuck 2009-11-20 17:27 ` Juri Linkov 2009-11-22 10:29 ` Juri Linkov 2009-11-23 4:27 ` Stefan Monnier 2019-10-10 23:20 ` Stefan Kangas 2019-10-11 0:31 ` Trent W. Buck 2019-10-11 8:14 ` Eli Zaretskii 2019-10-11 11:03 ` Stefan Kangas 2019-10-11 12:04 ` Michael Albinus 2019-10-11 13:30 ` Stefan Kangas 2019-10-11 14:26 ` Michael Albinus 2019-10-11 14:35 ` Robert Pluim 2019-10-12 8:12 ` Stefan Kangas 2019-10-14 9:32 ` Robert Pluim 2019-10-17 10:57 ` Stefan Kangas
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.