changeset 7758:8e14a01ffe9f

input.cc (Fre_read_readline_init_file): new function
author John W. Eaton <jwe@octave.org>
date Mon, 05 May 2008 03:21:52 -0400
parents 4ff9a6fdde42
children 84a7f00586aa
files liboctave/ChangeLog liboctave/cmd-edit.cc liboctave/cmd-edit.h liboctave/oct-rl-edit.c liboctave/oct-rl-edit.h src/ChangeLog src/input.cc
diffstat 7 files changed, 58 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/liboctave/ChangeLog	Mon May 05 03:10:16 2008 -0400
+++ b/liboctave/ChangeLog	Mon May 05 03:21:52 2008 -0400
@@ -1,3 +1,12 @@
+2008-05-05  John W. Eaton  <jwe@octave.org>
+
+	* cmd-edit.cc (command_editor::re_read_init_file,
+	gnu_readline::do_re_read_init_file): New functions.
+	* cmd-edit.h (command_editor::re_read_init_file): Provide decl.
+	(command_editor::do_re_read_init_file): New function.
+	* oct-rl-edit.c (octave_rl_re_read_init_file): New function.
+	* oct-rl-edit.h: Provide decl.
+
 2008-05-05  Rafael Laboissiere  <rafael@debian.org>
 
 	* oct-rl-edit.c (octave_read_init_file): Simply call rl_read_init_file.
--- a/liboctave/cmd-edit.cc	Mon May 05 03:10:16 2008 -0400
+++ b/liboctave/cmd-edit.cc	Mon May 05 03:21:52 2008 -0400
@@ -156,6 +156,8 @@
 
   void do_read_init_file (const std::string& file);
 
+  void do_re_read_init_file (void);
+
   bool do_filename_completion_desired (bool);
 
   bool do_filename_quoting_desired (bool);
@@ -560,6 +562,12 @@
   ::octave_rl_read_init_file (file.c_str ());
 }
 
+void
+gnu_readline::do_re_read_init_file (void)
+{
+  ::octave_rl_re_read_init_file ();
+}
+
 bool
 gnu_readline::do_filename_completion_desired (bool arg)
 {
@@ -1186,6 +1194,13 @@
     }
 }
 
+void
+command_editor::re_read_init_file (void)
+{
+  if (instance_ok ())
+    instance->do_re_read_init_file ();
+}
+
 bool
 command_editor::filename_completion_desired (bool arg)
 {
--- a/liboctave/cmd-edit.h	Mon May 05 03:10:16 2008 -0400
+++ b/liboctave/cmd-edit.h	Mon May 05 03:21:52 2008 -0400
@@ -138,6 +138,8 @@
 
   static void read_init_file (const std::string& file = std::string ());
 
+  static void re_read_init_file (void);
+
   static bool filename_completion_desired (bool);
 
   static bool filename_quoting_desired (bool);
@@ -270,6 +272,8 @@
 
   virtual void do_read_init_file (const std::string&) { }
 
+  virtual void do_re_read_init_file (void) { }
+
   virtual bool do_filename_completion_desired (bool) { return false; }
 
   virtual bool do_filename_quoting_desired (bool) { return false; }
--- a/liboctave/oct-rl-edit.c	Mon May 05 03:10:16 2008 -0400
+++ b/liboctave/oct-rl-edit.c	Mon May 05 03:21:52 2008 -0400
@@ -197,6 +197,12 @@
   rl_read_init_file (f);
 }
 
+void
+octave_rl_re_read_init_file (void)
+{
+  rl_re_read_init_file (0, 0);
+}
+
 int
 octave_rl_filename_completion_desired (int arg)
 {
--- a/liboctave/oct-rl-edit.h	Mon May 05 03:10:16 2008 -0400
+++ b/liboctave/oct-rl-edit.h	Mon May 05 03:21:52 2008 -0400
@@ -84,6 +84,8 @@
 
 extern void octave_rl_read_init_file (const char *);
 
+extern void octave_rl_re_read_init_file (void);
+
 extern int octave_rl_filename_completion_desired (int);
 
 extern int octave_rl_filename_quoting_desired (int);
--- a/src/ChangeLog	Mon May 05 03:10:16 2008 -0400
+++ b/src/ChangeLog	Mon May 05 03:21:52 2008 -0400
@@ -1,3 +1,7 @@
+2008-05-05  John W. Eaton  <jwe@octave.org>
+
+	* input.cc (Fre_read_readline_init_file): New function.
+
 2008-05-04  John W. Eaton  <jwe@octave.org>
 
 	* ov-fcn-handle.cc (Ffunctions): Pass octave_value object instead
--- a/src/input.cc	Mon May 05 03:10:16 2008 -0400
+++ b/src/input.cc	Mon May 05 03:21:52 2008 -0400
@@ -1133,6 +1133,24 @@
   return retval;
 }
 
+DEFUN (re_read_readline_init_file, args, ,
+  "-*- texinfo -*-\n\
+@deftypefn {Built-in Function} {} re_read_readline_init_file ()\n\
+Re-read the last readline library initialization file that was read.\n\
+@xref{Readline Init File, , , readline, GNU Readline Library},\n\
+for details.\n\
+@end deftypefn")
+{
+  octave_value_list retval;
+
+  if (args.length () == 0)
+    command_editor::re_read_init_file ();
+  else
+    print_usage ();
+
+  return retval;
+}
+
 static std::string hook_fcn;
 static octave_value user_data;