emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] fix/bug-31355 03697e6: Fix remote-host directory tracking


From: Phil
Subject: [Emacs-diffs] fix/bug-31355 03697e6: Fix remote-host directory tracking for shells in `term' buffers
Date: Sun, 3 Jun 2018 19:12:10 -0400 (EDT)

branch: fix/bug-31355
commit 03697e648c080f6b007b6ef8443fd4448bc52364
Author: Phil Sainty <address@hidden>
Commit: Phil Sainty <address@hidden>

    Fix remote-host directory tracking for shells in `term' buffers
    
    * lisp/term.el (term-handle-ansi-terminal-messages): Use an explicit
    tramp method when constructing the tramp path for a non-local host,
    as this is now mandatory.  "-" is a pseudo-method for the user's
    `tramp-default-method'.  (Bug#31355)
    
    Specify the remote username explicitly in all cases, as
    `tramp-default-user' and `tramp-default-user-alist' could cause the
    previous logic to fail.
    
    Minor related improvements to the commentary.
---
 lisp/term.el | 31 ++++++++++++++++---------------
 1 file changed, 16 insertions(+), 15 deletions(-)

diff --git a/lisp/term.el b/lisp/term.el
index 75c2779..419ddb2 100644
--- a/lisp/term.el
+++ b/lisp/term.el
@@ -233,31 +233,33 @@
 ;;
 ;;  Notice: for directory/host/user tracking you need to have something
 ;; like this in your shell startup script (this is for a POSIXish shell
-;; like Bash but should be quite easy to port to other shells)
+;; like Bash but should be quite easy to port to other shells).
+;;
+;; For troubleshooting in Bash, you can check the definition of the
+;; custom functions with the "type" command.  e.g. "type cd".  If you
+;; do not see the expected definition from the config below, then the
+;; directory tracking will not work.
 ;;
 ;;             ----------------------------------------
 ;;
-;;  # Set HOSTNAME if not already set.
+;;     # Set HOSTNAME if not already set.
 ;;     : ${HOSTNAME=$(uname -n)}
 ;;
-;;  # su does not change this but I'd like it to
-;;
+;;     # su does not change this but I'd like it to
 ;;     USER=$(whoami)
 ;;
-;;  # ...
+;;     # ...
 ;;
 ;;     case $TERM in
 ;;         eterm*)
 ;;
 ;;             printf '%s\n' \
 ;;              -------------------------------------------------------------- 
\
-;;              "Hello $user" \
+;;              "Hello $USER" \
 ;;              "Today is $(date)" \
 ;;              "We are on $HOSTNAME running $(uname) under Emacs term mode" \
 ;;              --------------------------------------------------------------
 ;;
-;;             export EDITOR=emacsclient
-;;
 ;;             # The \033 stands for ESC.
 ;;             # There is a space between "AnSiT?" and $whatever.
 ;;
@@ -269,10 +271,11 @@
 ;;             printf '\033AnSiTh %s\n' "$HOSTNAME"
 ;;             printf '\033AnSiTu %s\n' "$USER"
 ;;
-;;             eval $(dircolors $HOME/.emacs_dircolors)
+;;             # Use custom dircolors in term buffers.
+;;             # eval $(dircolors $HOME/.emacs_dircolors)
 ;;     esac
 ;;
-;;  # ...
+;;     # ...
 ;;
 ;;
 
@@ -2750,12 +2753,10 @@ See `term-prompt-regexp'."
        (setq default-directory
              (file-name-as-directory
               (if (and (string= term-ansi-at-host (system-name))
-                                       (string= term-ansi-at-user 
(user-real-login-name)))
+                        (string= term-ansi-at-user (user-real-login-name)))
                   (expand-file-name term-ansi-at-dir)
-                (if (string= term-ansi-at-user (user-real-login-name))
-                    (concat "/" term-ansi-at-host ":" term-ansi-at-dir)
-                  (concat "/" term-ansi-at-user "@" term-ansi-at-host ":"
-                          term-ansi-at-dir)))))
+                 (concat "/-:" term-ansi-at-user "@" term-ansi-at-host ":"
+                         term-ansi-at-dir))))
 
        ;; I'm not sure this is necessary,
        ;; but it's best to be on the safe side.



reply via email to

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