diff libinterp/corefcn/oct-hist.cc @ 23719:69a111259a2c

eliminate some global variables * environment.h, environment.cc: New files. Move EDITOR, EXEC_PATH, and IMAGE_PATH inside environment class from defaults.h and defaults.cc. Change all uses. * libinterp/corefcn/module.mk: Update.
author John W. Eaton <jwe@octave.org>
date Thu, 29 Jun 2017 10:18:42 -0400
parents f6c5db0a02e7
children ab8831d346c1
line wrap: on
line diff
--- a/libinterp/corefcn/oct-hist.cc	Thu Jun 29 02:40:21 2017 -0400
+++ b/libinterp/corefcn/oct-hist.cc	Thu Jun 29 10:18:42 2017 -0400
@@ -440,7 +440,7 @@
 }
 
 static void
-do_edit_history (const octave_value_list& args)
+do_edit_history (octave::interpreter& interp, const octave_value_list& args)
 {
   std::string name = mk_tmp_hist_file (args, false, "edit_history");
 
@@ -449,7 +449,8 @@
 
   // Call up our favorite editor on the file of commands.
 
-  std::string cmd = VEDITOR;
+  octave::environment& env = interp.get_environment ();
+  std::string cmd = env.editor ();
   cmd.append (" \"" + name + "\"");
 
   // Ignore interrupts while we are off editing commands.  Should we
@@ -551,8 +552,8 @@
       octave_link::append_history (timestamp);
 }
 
-DEFUN (edit_history, args, ,
-       doc: /* -*- texinfo -*-
+DEFMETHOD (edit_history, interp, args, ,
+           doc: /* -*- texinfo -*-
 @deftypefn  {} {} edit_history
 @deftypefnx {} {} edit_history @var{cmd_number}
 @deftypefnx {} {} edit_history @var{first} @var{last}
@@ -589,7 +590,7 @@
   if (args.length () > 2)
     print_usage ();
 
-  do_edit_history (args);
+  do_edit_history (interp, args);
 
   return ovl ();
 }