# HG changeset patch # User jwe # Date 1161874297 0 # Node ID 70158d7ab8efb050211a757593f95074c6058543 # Parent d65b53711bb8a88150bb27a0b55266ff2009f876 [project @ 2006-10-26 14:51:36 by jwe] diff --git a/ChangeLog b/ChangeLog --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,21 @@ +2006-10-26 John W. Eaton + + * emacs/octave-inf.el (inferior-octave-has-built-in-variables): + New defvar. + (inferior-octave-resync-dirs): Check to see whether Octave has + built-in variables and set inferior-octave-has-built-in-variables. + Check inferior-octave-has-built-in-variables to decide whether to + send commands that set built-in variables or call functions to + change Octave's behavior. + Send "disp (pwd ())" to Octave instead of just "pwd". + (inferior-octave-startup): Send "more off" to Octave instead of + "page_screen_output = 0". + 2006-10-25 John W. Eaton + * configure.in (RETSIGTYPE_IS_VOID): Define if + "$ac_cv_type_signal" = "void". + * configure.in (*-*-msdosmsvc): Don't check for strftime. * configure.in (INCLUDE_DEPS): Set and substitute. diff --git a/configure.in b/configure.in --- a/configure.in +++ b/configure.in @@ -29,7 +29,7 @@ EXTERN_CXXFLAGS="$CXXFLAGS" AC_INIT -AC_REVISION($Revision: 1.534 $) +AC_REVISION($Revision: 1.535 $) AC_PREREQ(2.57) AC_CONFIG_SRCDIR([src/octave.cc]) AC_CONFIG_HEADER(config.h) @@ -1572,6 +1572,9 @@ ]) OCTAVE_SIGNAL_CHECK OCTAVE_REINSTALL_SIGHANDLERS +if test "$ac_cv_type_signal" = "void"; then + AC_DEFINE(RETSIGTYPE_IS_VOID, 1, [Define if this if RETSIGTYPE is defined to be void. Needed because preprocessor comparisons to void fail on some systems.]) +fi ### A system dependent kluge or two. diff --git a/emacs/octave-inf.el b/emacs/octave-inf.el --- a/emacs/octave-inf.el +++ b/emacs/octave-inf.el @@ -115,6 +115,9 @@ (defvar inferior-octave-complete-impossible nil "Non-nil means that `inferior-octave-complete' is impossible.") +(defvar inferior-octave-has-built-in-variables nil + "Non-nil means that Octave has built-in variables.") + (defvar inferior-octave-dynamic-complete-functions '(inferior-octave-complete comint-dynamic-complete-filename) "List of functions called to perform completion for inferior Octave. @@ -220,12 +223,20 @@ 'identity inferior-octave-output-list "\n") "\n")))) + ;; Find out whether Octave has built-in variables. + (inferior-octave-send-list-and-digest + (list "exist \"LOADPATH\"\n")) + (setq inferior-octave-has-built-in-variables + (string-match "101$" (car inferior-octave-output-list))) + ;; An empty secondary prompt, as e.g. obtained by '--braindead', ;; means trouble. (inferior-octave-send-list-and-digest (list "PS2\n")) - (if (string-match "^PS2 = *$" (car inferior-octave-output-list)) - (inferior-octave-send-list-and-digest - (list "PS2 = \"> \"\n"))) + (if (string-match "\\(PS2\\|ans\\) = *$" (car inferior-octave-output-list)) + (inferior-octave-send-list-and-digest + (list (if inferior-octave-has-built-in-variables + "PS2 = \"> \"\n" + "PS2 (\"> \");\n")))) ;; O.k., now we are ready for the Inferior Octave startup commands. (let* (commands @@ -233,10 +244,12 @@ (file (or inferior-octave-startup-file (concat "~/.emacs-" program)))) (setq commands - (list "page_screen_output = 0;\n" + (list "more off;\n" (if (not (string-equal inferior-octave-output-string ">> ")) - "PS1=\"\\\\s> \";\n") + (if inferior-octave-has-built-in-variables + "PS1=\"\\\\s> \";\n" + "PS1 (\"\\\\s> \");\n")) (if (file-exists-p file) (format "source (\"%s\");\n" file)))) (inferior-octave-send-list-and-digest commands)) @@ -386,7 +399,7 @@ This command queries the inferior Octave process about its current directory and makes this the current buffer's default directory." (interactive) - (inferior-octave-send-list-and-digest '("pwd\n")) + (inferior-octave-send-list-and-digest '("disp (pwd ())\n")) (cd (car inferior-octave-output-list))) ;;; provide ourself diff --git a/src/ChangeLog b/src/ChangeLog --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,8 @@ 2006-10-25 John W. Eaton + * sighandlers.cc: Check defined (RETSIGTYPE_IS_VOID) instead of + RETSIGTYPE == void. + * oct-procbuf.cc (BUFSIZ): Define if not already defined. (octave_procbuf::open): Pass BUFSIZ as size argument to setvbuf. diff --git a/src/oct-prcstrm.cc b/src/oct-prcstrm.cc --- a/src/oct-prcstrm.cc +++ b/src/oct-prcstrm.cc @@ -29,6 +29,9 @@ #include "oct-prcstrm.h" +// FIXME -- perhaps this should be handled more globally. See also +// oct-procbuf.cc. + #if defined (_MSC_VER) #define popen _popen #define pclose _pclose diff --git a/src/oct-procbuf.cc b/src/oct-procbuf.cc --- a/src/oct-procbuf.cc +++ b/src/oct-procbuf.cc @@ -51,6 +51,9 @@ static octave_procbuf *octave_procbuf_list = 0; +// FIXME -- perhaps this should be handled more globally. See also +// oct-prcstrm.cc. + #if defined (__CYGWIN__) #define W32POPEN popen #define W32PCLOSE pclose diff --git a/src/sighandlers.cc b/src/sighandlers.cc --- a/src/sighandlers.cc +++ b/src/sighandlers.cc @@ -72,7 +72,7 @@ // Similar to Vsighup_dumps_octave_core, but for SIGTERM signal. static bool Vsigterm_dumps_octave_core = true; -#if RETSIGTYPE == void +#if defined (RETSIGTYPE_IS_VOID) #define SIGHANDLER_RETURN(status) return #else #define SIGHANDLER_RETURN(status) return status