aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorStefan Kangas2019-10-11 13:01:13 +0200
committerStefan Kangas2019-10-11 13:01:13 +0200
commit552c20ce39cd513cd6d0c847a1d291554143ba9a (patch)
tree09e0c48867e1680faf09530e5f77928b01ab17c9 /lisp
parent505550ba7b230d90d0b1e622121b3e34a19f7271 (diff)
downloademacs-552c20ce39cd513cd6d0c847a1d291554143ba9a.tar.gz
emacs-552c20ce39cd513cd6d0c847a1d291554143ba9a.zip
Support showing directory in shell command prompt
* lisp/simple.el (shell-command-prompt-show-cwd): New defcustom. (async-shell-command, shell-command): Show current directory in prompt when above option is non-nil. (Bug#4987) * etc/NEWS: Announce it.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/simple.el21
1 files changed, 19 insertions, 2 deletions
diff --git a/lisp/simple.el b/lisp/simple.el
index 597278ae2b4..44ab8e125d6 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -3384,6 +3384,13 @@ command output."
3384 :group 'shell 3384 :group 'shell
3385 :version "27.1") 3385 :version "27.1")
3386 3386
3387(defcustom shell-command-prompt-show-cwd nil
3388 "If non-nil, show current directory when prompting for a shell command.
3389This affects `shell-command' and `async-shell-command'."
3390 :type 'boolean
3391 :group 'shell
3392 :version "27.1")
3393
3387(defcustom shell-command-dont-erase-buffer nil 3394(defcustom shell-command-dont-erase-buffer nil
3388 "If non-nil, output buffer is not erased between shell commands. 3395 "If non-nil, output buffer is not erased between shell commands.
3389Also, a non-nil value sets the point in the output buffer 3396Also, a non-nil value sets the point in the output buffer
@@ -3473,7 +3480,12 @@ directly, since it offers more control and does not impose the use of
3473a shell (with its need to quote arguments)." 3480a shell (with its need to quote arguments)."
3474 (interactive 3481 (interactive
3475 (list 3482 (list
3476 (read-shell-command "Async shell command: " nil nil 3483 (read-shell-command (if shell-command-prompt-show-cwd
3484 (format-message "Async shell command in `%s': "
3485 (abbreviate-file-name
3486 default-directory))
3487 "Async shell command: ")
3488 nil nil
3477 (let ((filename 3489 (let ((filename
3478 (cond 3490 (cond
3479 (buffer-file-name) 3491 (buffer-file-name)
@@ -3546,7 +3558,12 @@ impose the use of a shell (with its need to quote arguments)."
3546 3558
3547 (interactive 3559 (interactive
3548 (list 3560 (list
3549 (read-shell-command "Shell command: " nil nil 3561 (read-shell-command (if shell-command-prompt-show-cwd
3562 (format-message "Shell command in `%s': "
3563 (abbreviate-file-name
3564 default-directory))
3565 "Shell command: ")
3566 nil nil
3550 (let ((filename 3567 (let ((filename
3551 (cond 3568 (cond
3552 (buffer-file-name) 3569 (buffer-file-name)