emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 6dbbdff281: Advertise OSC directory tracking more


From: Lars Ingebrigtsen
Subject: master 6dbbdff281: Advertise OSC directory tracking more
Date: Thu, 5 May 2022 09:06:35 -0400 (EDT)

branch: master
commit 6dbbdff281775eb82133fd13edc2ff6b63a97a58
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    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.
---
 doc/emacs/misc.texi | 13 +++++++++++++
 lisp/shell.el       |  4 +++-
 2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/doc/emacs/misc.texi b/doc/emacs/misc.texi
index a0d79711f1..63eb00b235 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},
 then create a new @file{*shell*} buffer using plain @kbd{M-x shell}.
 Subshells in different buffers run independently and in parallel.
 
+  Emacs attempts to keep track of what the current directory is by
+looking at the commands you enter, looking for @samp{cd} commands and
+the like.  This is an error-prone solution, since there are many ways
+to change the current directory, so Emacs also looks for special
+@acronym{OSC} (Operating System Commands} escape codes that are
+designed to convey this information in a more reliable fashion.  You
+should arrange for your shell to print the appropriate escape sequence
+at each prompt, for instance with the following command:
+
+@example
+printf "\e]7;file://%s%s\e\\" "$HOSTNAME" "$PWD"
+@end example
+
 @vindex explicit-shell-file-name
 @cindex environment variables for subshells
 @cindex @env{ESHELL} environment variable
diff --git a/lisp/shell.el b/lisp/shell.el
index 627c48e35f..47887433d9 100644
--- a/lisp/shell.el
+++ b/lisp/shell.el
@@ -1033,7 +1033,9 @@ Environment variables are expanded, see function 
`substitute-in-file-name'."
   "Toggle directory tracking in this shell buffer (Shell Dirtrack mode).
 
 The `dirtrack' package provides an alternative implementation of
-this feature; see the function `dirtrack-mode'."
+this feature; see the function `dirtrack-mode'.  Also see
+`comint-osc-directory-tracker' for an escape-sequence based
+solution."
   :lighter nil
   (setq list-buffers-directory (if shell-dirtrack-mode default-directory))
   (if shell-dirtrack-mode



reply via email to

[Prev in Thread] Current Thread [Next in Thread]