aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChong Yidong2006-10-27 14:39:43 +0000
committerChong Yidong2006-10-27 14:39:43 +0000
commitd32f600dfcda95e50f6966d38a1d9c239902fb85 (patch)
tree1f22f0fc2d4764daa001b19ffc4bf1eb50dd4000
parent04a623aac6c05b968557c441bae5b0eb3871940a (diff)
downloademacs-d32f600dfcda95e50f6966d38a1d9c239902fb85.tar.gz
emacs-d32f600dfcda95e50f6966d38a1d9c239902fb85.zip
* 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".
-rw-r--r--lisp/ChangeLog13
-rw-r--r--lisp/progmodes/octave-inf.el24
2 files changed, 32 insertions, 5 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index ad36d29542c..661a54aa4cb 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,16 @@
12006-10-26 John W. Eaton <jwe@octave.org>
2
3 * progmodes/octave-inf.el (inferior-octave-has-built-in-variables):
4 New defvar.
5 (inferior-octave-resync-dirs): Check to see whether Octave has
6 built-in variables and set inferior-octave-has-built-in-variables.
7 Check inferior-octave-has-built-in-variables to decide whether to
8 send commands that set built-in variables or call functions to
9 change Octave's behavior.
10 Send "disp (pwd ())" to Octave instead of just "pwd".
11 (inferior-octave-startup): Send "more off" to Octave instead of
12 "page_screen_output = 0".
13
12006-10-26 Chong Yidong <cyd@stupidchicken.com> 142006-10-26 Chong Yidong <cyd@stupidchicken.com>
2 15
3 * emacs-lisp/cl-indent.el (lisp-indent-259): Indent nil's in the 16 * emacs-lisp/cl-indent.el (lisp-indent-259): Indent nil's in the
diff --git a/lisp/progmodes/octave-inf.el b/lisp/progmodes/octave-inf.el
index 863f972086e..0f20626c9b9 100644
--- a/lisp/progmodes/octave-inf.el
+++ b/lisp/progmodes/octave-inf.el
@@ -113,6 +113,9 @@ the regular expression `comint-prompt-regexp', a buffer local variable."
113(defvar inferior-octave-complete-impossible nil 113(defvar inferior-octave-complete-impossible nil
114 "Non-nil means that `inferior-octave-complete' is impossible.") 114 "Non-nil means that `inferior-octave-complete' is impossible.")
115 115
116(defvar inferior-octave-has-built-in-variables nil
117 "Non-nil means that Octave has built-in variables.")
118
116(defvar inferior-octave-dynamic-complete-functions 119(defvar inferior-octave-dynamic-complete-functions
117 '(inferior-octave-complete comint-dynamic-complete-filename) 120 '(inferior-octave-complete comint-dynamic-complete-filename)
118 "List of functions called to perform completion for inferior Octave. 121 "List of functions called to perform completion for inferior Octave.
@@ -218,11 +221,20 @@ startup file, `~/.emacs-octave'."
218 'identity inferior-octave-output-list "\n") 221 'identity inferior-octave-output-list "\n")
219 "\n")))) 222 "\n"))))
220 223
224 ;; Find out whether Octave has built-in variables.
225 (inferior-octave-send-list-and-digest
226 (list "exist \"LOADPATH\"\n"))
227 (setq inferior-octave-has-built-in-variables
228 (string-match "101$" (car inferior-octave-output-list)))
229
221 ;; An empty secondary prompt, as e.g. obtained by '--braindead', 230 ;; An empty secondary prompt, as e.g. obtained by '--braindead',
222 ;; means trouble. 231 ;; means trouble.
223 (inferior-octave-send-list-and-digest (list "PS2\n")) 232 (inferior-octave-send-list-and-digest (list "PS2\n"))
224 (if (string-match "^PS2 = *$" (car inferior-octave-output-list)) 233 (if (string-match "\\(PS2\\|ans\\) = *$" (car inferior-octave-output-list))
225 (inferior-octave-send-list-and-digest (list "PS2 = \"> \"\n"))) 234 (inferior-octave-send-list-and-digest
235 (list (if inferior-octave-has-built-in-variables
236 "PS2 = \"> \"\n"
237 "PS2 (\"> \");\n"))))
226 238
227 ;; O.k., now we are ready for the Inferior Octave startup commands. 239 ;; O.k., now we are ready for the Inferior Octave startup commands.
228 (let* (commands 240 (let* (commands
@@ -230,10 +242,12 @@ startup file, `~/.emacs-octave'."
230 (file (or inferior-octave-startup-file 242 (file (or inferior-octave-startup-file
231 (concat "~/.emacs-" program)))) 243 (concat "~/.emacs-" program))))
232 (setq commands 244 (setq commands
233 (list "page_screen_output = 0;\n" 245 (list "more off;\n"
234 (if (not (string-equal 246 (if (not (string-equal
235 inferior-octave-output-string ">> ")) 247 inferior-octave-output-string ">> "))
236 "PS1=\"\\\\s> \";\n") 248 (if inferior-octave-has-built-in-variables
249 "PS1=\"\\\\s> \";\n"
250 "PS1 (\"\\\\s> \");\n"))
237 (if (file-exists-p file) 251 (if (file-exists-p file)
238 (format "source (\"%s\");\n" file)))) 252 (format "source (\"%s\");\n" file))))
239 (inferior-octave-send-list-and-digest commands)) 253 (inferior-octave-send-list-and-digest commands))
@@ -383,7 +397,7 @@ Use \\[inferior-octave-resync-dirs] to resync if Emacs gets confused."
383This command queries the inferior Octave process about its current 397This command queries the inferior Octave process about its current
384directory and makes this the current buffer's default directory." 398directory and makes this the current buffer's default directory."
385 (interactive) 399 (interactive)
386 (inferior-octave-send-list-and-digest '("pwd\n")) 400 (inferior-octave-send-list-and-digest '("disp (pwd ())\n"))
387 (cd (car inferior-octave-output-list))) 401 (cd (car inferior-octave-output-list)))
388 402
389;;; provide ourself 403;;; provide ourself