diff options
| author | Stefan Kangas | 2019-10-11 13:01:13 +0200 |
|---|---|---|
| committer | Stefan Kangas | 2019-10-11 13:01:13 +0200 |
| commit | 552c20ce39cd513cd6d0c847a1d291554143ba9a (patch) | |
| tree | 09e0c48867e1680faf09530e5f77928b01ab17c9 | |
| parent | 505550ba7b230d90d0b1e622121b3e34a19f7271 (diff) | |
| download | emacs-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.
| -rw-r--r-- | etc/NEWS | 4 | ||||
| -rw-r--r-- | lisp/simple.el | 21 |
2 files changed, 23 insertions, 2 deletions
| @@ -1568,6 +1568,10 @@ variable for remote shells. It still defaults to "/bin/sh". | |||
| 1568 | *** 'async-shell-command-width' defines the number of display columns | 1568 | *** 'async-shell-command-width' defines the number of display columns |
| 1569 | available for output of asynchronous shell commands. | 1569 | available for output of asynchronous shell commands. |
| 1570 | 1570 | ||
| 1571 | +++ | ||
| 1572 | *** Prompt for shell commands can now show the current directory. | ||
| 1573 | Customize 'shell-command-prompt-show-cwd' to enable it. | ||
| 1574 | |||
| 1571 | ** Pcomplete | 1575 | ** Pcomplete |
| 1572 | 1576 | ||
| 1573 | *** The 'pcomplete' command is now obsolete | 1577 | *** The 'pcomplete' command is now obsolete |
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. | ||
| 3389 | This 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. |
| 3389 | Also, a non-nil value sets the point in the output buffer | 3396 | Also, 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 | |||
| 3473 | a shell (with its need to quote arguments)." | 3480 | a 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) |