help-octave
[Top][All Lists]
Advanced

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

Re: Creating Local History Files


From: Ted Harding
Subject: Re: Creating Local History Files
Date: Tue, 8 Oct 1996 21:57:38 +0100 (GMT+0100)

> On  4-Oct-1996, Ted Harding <address@hidden> wrote:
> 
> : Using octave-1.1.1, I would like to be able to start up octave in any
> : chosen directory and have the history file for that session in the
> : directory I start from (or a related one).
> 
> With 1.1.1 you can use `history -r FILE' to read the commands from
> FILE into the history list, and `history -w FILE' to write them back
> out.  Automating reading a local history file should be easy to do in
> the .octaverc file, but you have to remember to write the commands
> back out to the same file before you exit.
> 
> The next release (someday, really!) will include a new built-in
> variable `history_file' that should make this sort of thing somewhat
> easier.
> 
> jwe

Thanks for the reply, John.

"history -r FILE" does not seem to do quite what I want. Although the 1.1
documentation says

-r file   Read the named file, replacing the current history list with its
          contents.

it in fact appends, rather than replaces, according to my experiments
(even when placed in the octaverc file). And "history -w FILE" will
therefore write back not only the commands from the session, but also
commands left over from other sessions before the "append", with the
result that a series of short sessions on different projects will end up
mixing the commands from these projects anyway, with mixed histories being
written back to each of the projects.

If "history -r" really did replace, I'd be quite happy to do it the way
you suggest. (One could, of course, start up octave after deleting
~/.octave_hist, but that's not something I favour doing "blind").

It also seems that the result goes into the global ~/.octave_hist at the
end of the day, but that's less of an issue.

Mario Storti's script suggestion
===========================================
if exists ./.octave_hist
    cp ./.octave_hist ~/octave_hist
endif
octave
if exists ./.octave_hist
    cp ~/octave_hist ./.octave_hist
endif
==============================================
is clean in this respect, though a bit cumbersome, and liable to cause
interference between simultaneous octave sessions under the same userid.

It looks as if "the next release" is going to prove even more worth while
waiting for than we had thought!

This discussion prompts me to propose: as well as octaverc (to define the
startup configuration), how about also an "octavecd" (octave_close_down)
file which would define any cleanups to be carried out when "quit" is
executed within octave? (One could put your
 "history -w ./.local_octave_hist"
in there, for instance).

Thanks, and best wishes,
Ted.                                    (address@hidden)

reply via email to

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