changeset 73500:d25ce2f322cb

* progmodes/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".
author Chong Yidong <cyd@stupidchicken.com>
date Fri, 27 Oct 2006 14:39:43 +0000
parents 646a9d0f56f2
children 437fb645afb4
files lisp/ChangeLog lisp/progmodes/octave-inf.el
diffstat 2 files changed, 32 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Fri Oct 27 11:58:29 2006 +0000
+++ b/lisp/ChangeLog	Fri Oct 27 14:39:43 2006 +0000
@@ -1,3 +1,16 @@
+2006-10-26  John W. Eaton  <jwe@octave.org>
+
+	* progmodes/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-26  Chong Yidong  <cyd@stupidchicken.com>
 
 	* emacs-lisp/cl-indent.el (lisp-indent-259): Indent nil's in the
--- a/lisp/progmodes/octave-inf.el	Fri Oct 27 11:58:29 2006 +0000
+++ b/lisp/progmodes/octave-inf.el	Fri Oct 27 14:39:43 2006 +0000
@@ -113,6 +113,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.
@@ -218,11 +221,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
@@ -230,10 +242,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))
@@ -383,7 +397,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