diff options
| author | Lars Ingebrigtsen | 2022-05-05 15:04:43 +0200 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2022-05-05 15:06:26 +0200 |
| commit | 6dbbdff281775eb82133fd13edc2ff6b63a97a58 (patch) | |
| tree | 04afb1155baa3d80569e1504705cfa9ef2f1245e | |
| parent | 71de48494e9024243d4c8b8847c50c0b5c0ac16f (diff) | |
| download | emacs-6dbbdff281775eb82133fd13edc2ff6b63a97a58.tar.gz emacs-6dbbdff281775eb82133fd13edc2ff6b63a97a58.zip | |
Advertise OSC directory tracking more
* doc/emacs/misc.texi (Interactive Shell): Document OSC directory
tracking more.
* lisp/shell.el (shell-dirtrack-mode): Link to the OSC directory
tracking function.
| -rw-r--r-- | doc/emacs/misc.texi | 13 | ||||
| -rw-r--r-- | lisp/shell.el | 4 |
2 files changed, 16 insertions, 1 deletions
diff --git a/doc/emacs/misc.texi b/doc/emacs/misc.texi index a0d79711f10..63eb00b2357 100644 --- a/doc/emacs/misc.texi +++ b/doc/emacs/misc.texi | |||
| @@ -896,6 +896,19 @@ also rename the @file{*shell*} buffer using @kbd{M-x rename-uniquely}, | |||
| 896 | then create a new @file{*shell*} buffer using plain @kbd{M-x shell}. | 896 | then create a new @file{*shell*} buffer using plain @kbd{M-x shell}. |
| 897 | Subshells in different buffers run independently and in parallel. | 897 | Subshells in different buffers run independently and in parallel. |
| 898 | 898 | ||
| 899 | Emacs attempts to keep track of what the current directory is by | ||
| 900 | looking at the commands you enter, looking for @samp{cd} commands and | ||
| 901 | the like. This is an error-prone solution, since there are many ways | ||
| 902 | to change the current directory, so Emacs also looks for special | ||
| 903 | @acronym{OSC} (Operating System Commands} escape codes that are | ||
| 904 | designed to convey this information in a more reliable fashion. You | ||
| 905 | should arrange for your shell to print the appropriate escape sequence | ||
| 906 | at each prompt, for instance with the following command: | ||
| 907 | |||
| 908 | @example | ||
| 909 | printf "\e]7;file://%s%s\e\\" "$HOSTNAME" "$PWD" | ||
| 910 | @end example | ||
| 911 | |||
| 899 | @vindex explicit-shell-file-name | 912 | @vindex explicit-shell-file-name |
| 900 | @cindex environment variables for subshells | 913 | @cindex environment variables for subshells |
| 901 | @cindex @env{ESHELL} environment variable | 914 | @cindex @env{ESHELL} environment variable |
diff --git a/lisp/shell.el b/lisp/shell.el index 627c48e35fb..47887433d9f 100644 --- a/lisp/shell.el +++ b/lisp/shell.el | |||
| @@ -1033,7 +1033,9 @@ Environment variables are expanded, see function `substitute-in-file-name'." | |||
| 1033 | "Toggle directory tracking in this shell buffer (Shell Dirtrack mode). | 1033 | "Toggle directory tracking in this shell buffer (Shell Dirtrack mode). |
| 1034 | 1034 | ||
| 1035 | The `dirtrack' package provides an alternative implementation of | 1035 | The `dirtrack' package provides an alternative implementation of |
| 1036 | this feature; see the function `dirtrack-mode'." | 1036 | this feature; see the function `dirtrack-mode'. Also see |
| 1037 | `comint-osc-directory-tracker' for an escape-sequence based | ||
| 1038 | solution." | ||
| 1037 | :lighter nil | 1039 | :lighter nil |
| 1038 | (setq list-buffers-directory (if shell-dirtrack-mode default-directory)) | 1040 | (setq list-buffers-directory (if shell-dirtrack-mode default-directory)) |
| 1039 | (if shell-dirtrack-mode | 1041 | (if shell-dirtrack-mode |