On Sat, Oct 7, 2017 at 5:09 PM, Greg Reagle <greg.rea...@umbc.edu> wrote:
> On Sat, Oct 7, 2017, at 17:50, Mark Volkmann wrote:
> > On Sat, Oct 7, 2017 at 3:52 PM, Greg Reagle <greg.rea...@umbc.edu>
> wrote:
> > > As far as I understand, it is not true that it "manage to only recall
> > > commands that belong to the current session". Fish remembers commands
> > > from previous sessions. In your article you have "How does this one
> > > file keep a separate history for each session?" Why do you think that?
> > > I don't think it's true.
> >
> > Here's what I did that made me think this:
> > - open a new fish session
> > - enter commands like "ls" and "date"
> > - open another new fish session from within the first
> > (In my case I did this by creating a new tmux pane, not by just
> > entering
> > "fish".)
> > - press up arrow to recall the last two commands and note that they are
> > the
> > ones from the first session,
> > so the new session is aware of those
> > - enter commands in the second session like "cd foo" and "cd -"
> > - press up arrow to recall the last two commands and note that these cd
> > commands are present
> > - switch to the first session
> > - press up arrow to recall the last command and not that it is not one of
> > the cd commands from the second session
>
> I get the same type of behavior, using separate terminal emulator
> windows in X11 (multiple st windows, where st is like xterm) and not
> using tmux, so I don't think tmux in particular is relevant here. If
> you close both fish sessions and then start a new one, you'll see all
> the commands from both sessions are in the history.
>
Yes, I see that!
> > So it seems that each new session starts with the command history of its
> > parent, but then maintains its own after that.
> > Is this wrong? Perhaps my use of tmux is the key to my misunderstanding.
>
> I think that your conclusion does not follow. I don't know the
> internals of fish session history and how sessions' history interact
> with each other as I am just a fish user, not a fish developer. If you
> examine the fish history file, you'll see that there is no information
> about which session. And if you close all fish sessions and open a new
> one, the history of all sessions will be there and "unified".
Here's another way to test this.
- open two fish sessions
- in the first, enter "echo one"
- in the second, enter "echo two"
- in the first, enter "echo three"
- in the second, enter "echo four"
Enter "tail ~/.local/share/fish/fish_history" in both. Of course they will
be identical (same file) and will contain all four echo commands.
But command recall in either session only recalls the echo commands entered
in that session.
I don't think there is enough information in the fish_history file to
support doing that, so something else must be at play.
Another interesting thing is that if you enter "history -n 5" in both, you
will only see the echo commands entered in the session where that command
is run.
So I'm still wondering how fish is able to keep the commands from each
session separate.
--
R. Mark Volkmann
Object Computing, Inc.
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Fish-users mailing list
Fish-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/fish-users