From: Stefan Kangas <stefan@marxist.se>
To: trentbuck@gmail.com
Cc: 4987@debbugs.gnu.org
Subject: bug#4987: 23.1; shell-command: optionally include working dir in prompt
Date: Fri, 11 Oct 2019 01:20:15 +0200 [thread overview]
Message-ID: <CADwFkm=jnnn9biHPxCppmAk-0LgrS6jev4SW4zQY8A7roNEk9Q@mail.gmail.com> (raw)
In-Reply-To: <4b069223.0703c00a.066f.3a01@mx.google.com>
[-- 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
next prev parent reply other threads:[~2019-10-10 23:20 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
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
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='CADwFkm=jnnn9biHPxCppmAk-0LgrS6jev4SW4zQY8A7roNEk9Q@mail.gmail.com' \
--to=stefan@marxist.se \
--cc=4987@debbugs.gnu.org \
--cc=trentbuck@gmail.com \
/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.