[Top][All Lists]

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

Re: eshell and eshell-directory-change-hook

From: Michael Albinus
Subject: Re: eshell and eshell-directory-change-hook
Date: Sat, 19 Nov 2016 11:00:09 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux)

Alexey Lebedeff <address@hidden> writes:

> Hi Michael,

Hi Alexey,

>>> Running remote commands through eshell starts to work only after doing
>>> "cd" at least once. This is because some tramp setup happens in
>>> eshell-directory-change-hook.
>>> I'm not sure whether it should be fixed in tramp, by "(add-hook
>>> 'eshell-mode-hook 'tramp-eshell-directory-change)". Or in eshell, by
>>> teaching it to invoke eshell-directory-change-hook during
>>> initialization. And it's arguable whether eshell initialization can be
>>> considered as a directory change or not =)
> This happens when local and remote PATHs are completely incompatible. In
> my case emacs runs on NixOS and remote host is Debian. On NixOS PATH
> (and thus eshell-path-env) doesn't contain any standard directories like
> '/bin' or '/usr/bin'. So right after eshell to remote host is opened,
> this incompatible eshell-path-env is inherited - and command execution
> is broken until I do some "cd" (at which point
> "tramp-eshell-directory-change" does its magic).

Finally, I could reproduce it. I tend to agree with you that we shall
add another call to `tramp-eshell-directory-change' in eshell. I would
prefer to do it in `eshell-first-time-mode-hook'. Does the following
patch work for you?

--8<---------------cut here---------------start------------->8---
    2016-11-19 10:55:53.064320669 +0100
--- /home/albinus/src/tramp/lisp/tramp.el       2016-11-19 10:51:57.696457682 
*** 4349,4359 ****
  (eval-after-load "esh-util"
!      (tramp-eshell-directory-change)
       (add-hook 'eshell-directory-change-hook
       (add-hook 'tramp-unload-hook
               (lambda ()
                 (remove-hook 'eshell-directory-change-hook
--- 4349,4362 ----
  (eval-after-load "esh-util"
!      (add-hook 'eshell-first-time-mode-hook
!              'tramp-eshell-directory-change)
       (add-hook 'eshell-directory-change-hook
       (add-hook 'tramp-unload-hook
               (lambda ()
+                (remove-hook 'eshell-first-time-mode-hook
+                             'tramp-eshell-directory-change)
                 (remove-hook 'eshell-directory-change-hook
--8<---------------cut here---------------end--------------->8---

> Best,
> Alexey

Best regards, Michael.

reply via email to

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