[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: eshell and eshell-directory-change-hook
From: |
Alexey Lebedeff |
Subject: |
Re: eshell and eshell-directory-change-hook |
Date: |
Tue, 27 Dec 2016 15:42:18 +0300 |
User-agent: |
mu4e 0.9.16; emacs 25.1.1 |
Hi, Michael
Sorry, completely forgot about this - as the necessary hook is already
present in my config =)
I think that 'eshell-first-time-mode-hook is not exactly the right hook
for this issue - as it'll fix the problem only with very specific usage
pattern (when the very first eshell you're opening is on a
PATH-incompatible host). Proper scope would be covered by:
(add-hook 'eshell-mode-hook
'tramp-eshell-directory-change)
Best,
Alexey
Michael Albinus writes:
> 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---
> ***
> /home/albinus/src/tramp/lisp/tramp.el.~e54069ea7fe7aed6310afb5356354ac23a99ea4e~
> 2016-11-19 10:55:53.064320669 +0100
> --- /home/albinus/src/tramp/lisp/tramp.el 2016-11-19 10:51:57.696457682
> +0100
> ***************
> *** 4349,4359 ****
>
> (eval-after-load "esh-util"
> '(progn
> ! (tramp-eshell-directory-change)
> (add-hook 'eshell-directory-change-hook
> 'tramp-eshell-directory-change)
> (add-hook 'tramp-unload-hook
> (lambda ()
> (remove-hook 'eshell-directory-change-hook
> 'tramp-eshell-directory-change)))))
>
> --- 4349,4362 ----
>
> (eval-after-load "esh-util"
> '(progn
> ! (add-hook 'eshell-first-time-mode-hook
> ! 'tramp-eshell-directory-change)
> (add-hook 'eshell-directory-change-hook
> 'tramp-eshell-directory-change)
> (add-hook 'tramp-unload-hook
> (lambda ()
> + (remove-hook 'eshell-first-time-mode-hook
> + 'tramp-eshell-directory-change)
> (remove-hook 'eshell-directory-change-hook
> 'tramp-eshell-directory-change)))))
>
> --8<---------------cut here---------------end--------------->8---
>
>
>> Best,
>> Alexey
>
> Best regards, Michael.
- Re: eshell and eshell-directory-change-hook,
Alexey Lebedeff <=