[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#9647: dirtrack.el patch to support prefixed paths, e.g. tramp remote
bug#9647: dirtrack.el patch to support prefixed paths, e.g. tramp remote shells
Sat, 1 Oct 2011 14:09:41 -0700
hi! i've attached a small patch to dirtrack.el that makes it support
shell buffers with path prefixes, e.g. tramp-based remote shells.
without this patch, it uses the local filesystem, which can be
particularly confusing because the local and remote filesystems
usually have some paths in common, but not all.
here are reproduction instructions (fill in [HOST] and [REGEX]):
(let ((default-directory "/ssh:[HOST]:")) (shell))
;; run these with M-x eval-expression
(set-variable 'dirtrack-list "[REGEX]")
now, in the remote shell, cd to a directory that doesn't exist on the
local filesystem. you'll see warnings like this:
Warning (emacs): Directory ... does not exist
and file completion won't work. this patch fixes that.
here's the proposed ChangeLog entry:
dirtrack-mode bugfix to support shell buffers with path prefixes, e.g.
tramp-based remote shells
i've attached a bzr bundle, and here's a diff:
--- lisp/dirtrack.el 2011-04-19 13:44:55 +0000
+++ lisp/dirtrack.el 2011-10-01 20:48:21 +0000
@@ -243,8 +243,9 @@
(if (not (> (length prompt-path) 0))
(dirtrack-debug-message "Match is empty string")
;; Transform prompts into canonical forms
- (setq prompt-path (funcall dirtrack-directory-function
+ (setq orig-prompt-path (funcall dirtrack-directory-function
+ prompt-path (shell-prefixed-directory-name orig-prompt-path)
current-dir (funcall dirtrack-canonicalize-function
@@ -257,8 +258,9 @@
;; It's possible that Emacs will think the directory
;; won't exist (eg, rlogin buffers)
(if (file-accessible-directory-p prompt-path)
- ;; Change directory
- (and (shell-process-cd prompt-path)
+ ;; Change directory. shell-process-cd adds the prefix, so we
+ ;; need to give it the original (un-prefixed) path.
+ (and (shell-process-cd orig-prompt-path)
(format "Changing directory to %s" prompt-path)))
thanks in advance!
Description: Text document
- bug#9647: dirtrack.el patch to support prefixed paths, e.g. tramp remote shells,
Ryan Barrett <=