tramp-devel
[Top][All Lists]
Advanced

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

Re: tramp (2.2.13.25.2); How to let shell over TRAMP read "~/.bash_histo


From: Michael Albinus
Subject: Re: tramp (2.2.13.25.2); How to let shell over TRAMP read "~/.bash_history" as input ring?
Date: Sat, 20 Jul 2019 10:06:45 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

Fan Yang <address@hidden> writes:

> Hi Bruno,

Hi Fan,

> Thanks for your reply!  Searching command history saves a lot of
> typing and quickens my
> workflows,  I probably will still head for a solution.
>
> Some more questions, if I may,
> 1. Should I attribute this issue to TRAMP or to shell-mode?

It isn't Tramp.

> 2. Where should I start, is there any suggestions?

In shell-mode, always the *local* history file is read:

--8<---------------cut here---------------start------------->8---
      (setq comint-input-ring-file-name
            (or (getenv "HISTFILE")
                (cond ((string-equal shell "bash") "~/.bash_history")
                      ((string-equal shell "ksh") "~/.sh_history")
                      (t "~/.history"))))
--8<---------------cut here---------------end--------------->8---

> I am still going to investigate this issue a little bit, any
> suggestion/solution is appreciated!

The code above must be improved to read the *remote* history
file. Something like this (not tested):

--8<---------------cut here---------------start------------->8---
      (setq comint-input-ring-file-name
            (concat
              (file-remote-p default-directory)
              (or (and (not (file-remote-p default-directory ))
                       (getenv "HISTFILE"))
                  (cond ((string-equal shell "bash") "~/.bash_history")
                        ((string-equal shell "ksh") "~/.sh_history")
                        (t "~/.history")))))
--8<---------------cut here---------------end--------------->8---

> Thanks in advance,
> Fan

Best regards, Michael.



reply via email to

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