changeset 27547:56e8c41fb6d3

maint: merge stable to default.
author Rik <rik@octave.org>
date Wed, 23 Oct 2019 08:19:45 -0700
parents 397ba0a8d732 (current diff) 8c9924a425db (diff)
children 35f9ffb13fd6
files libinterp/corefcn/oct-hist.cc
diffstat 1 files changed, 27 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/oct-hist.cc	Tue Oct 22 23:13:50 2019 -0400
+++ b/libinterp/corefcn/oct-hist.cc	Wed Oct 23 08:19:45 2019 -0700
@@ -809,12 +809,36 @@
        doc: /* -*- texinfo -*-
 @deftypefn  {} {@var{val} =} history_file ()
 @deftypefnx {} {@var{old_val} =} history_file (@var{new_val})
-Query or set the internal variable that specifies the name of the
-file used to store command history.
+Query or set the internal variable that specifies the name of the file used to
+store command history.
+
+All future commands issued during the current Octave session will be written to
+this new file (if the current setting of @code{history_save} allows for this).
 
 The default value is @file{~/.octave_hist}, but may be overridden by the
 environment variable @w{@env{OCTAVE_HISTFILE}}.
-@seealso{history_size, history_save, history_timestamp_format_string}
+
+Programming Notes:
+
+If you want to permanently change the location of Octave's history file you
+need to issue the @code{history_file} command in every new Octave session.
+This can be achieved by using Octave's @file{.octaverc} startup file.
+
+If you also want to read the saved history commands of past Octave sessions
+from this different history file, then you need to use the additional command
+@code{history -r} after setting the new value of the history file.  Example
+code in Octave's startup file to do this might look like this:
+
+@example
+@group
+history_file ("~/new/.octave_hist");
+if (exist (history_file ()))
+  history ("-r", history_file());
+endif
+@end group
+@end example
+
+@seealso{history, history_control, history_save, history_size, history_timestamp_format_string}
 @end deftypefn */)
 {
   octave_value retval;