-;; Copyright (C) 1997, 2001, 2002, 2003, 2004, 2005
+;; Copyright (C) 1997, 2001, 2002, 2003, 2004, 2005, 2006, 2007
;; Free Software Foundation, Inc.
;; Author: Kurt Hornik <Kurt.Hornik@wu-wien.ac.at>
;; Free Software Foundation, Inc.
;; Author: Kurt Hornik <Kurt.Hornik@wu-wien.ac.at>
;; GNU Emacs is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; GNU Emacs is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
- "\\(^octave\\(\\|.bin\\)\\(-[.0-9]+\\)?\\(:[0-9]+\\)?\\|^debug\\|^\\)>+ "
- "*Regexp to match prompts for the inferior Octave process."
+ "\\(^octave\\(\\|.bin\\|.exe\\)\\(-[.0-9]+\\)?\\(:[0-9]+\\)?\\|^debug\\|^\\)>+ "
+ "Regexp to match prompts for the inferior Octave process."
The contents of this file are sent to the inferior Octave process on
startup."
:type '(choice (const :tag "None" nil)
The contents of this file are sent to the inferior Octave process on
startup."
:type '(choice (const :tag "None" nil)
For example, for suppressing the startup message and using `traditional'
mode, set this to (\"-q\" \"--traditional\")."
:type '(repeat string)
:group 'octave-inferior)
For example, for suppressing the startup message and using `traditional'
mode, set this to (\"-q\" \"--traditional\")."
:type '(repeat string)
:group 'octave-inferior)
-(defvar inferior-octave-mode-map nil
- "Keymap used in Inferior Octave mode.")
-(if inferior-octave-mode-map
- ()
- (let ((map (copy-keymap comint-mode-map)))
+(defvar inferior-octave-mode-map
+ (let ((map (make-sparse-keymap)))
+ (set-keymap-parent map comint-mode-map)
(define-key map "\t" 'comint-dynamic-complete)
(define-key map "\M-?" 'comint-dynamic-list-filename-completions)
(define-key map "\C-c\C-l" 'inferior-octave-dynamic-list-input-ring)
(define-key map [menu-bar inout list-history]
'("List Input History" . inferior-octave-dynamic-list-input-ring))
(define-key map "\C-c\C-h" 'octave-help)
(define-key map "\t" 'comint-dynamic-complete)
(define-key map "\M-?" 'comint-dynamic-list-filename-completions)
(define-key map "\C-c\C-l" 'inferior-octave-dynamic-list-input-ring)
(define-key map [menu-bar inout list-history]
'("List Input History" . inferior-octave-dynamic-list-input-ring))
(define-key map "\C-c\C-h" 'octave-help)
(let ((table (make-syntax-table)))
(modify-syntax-entry ?\` "w" table)
(modify-syntax-entry ?\# "<" table)
(modify-syntax-entry ?\n ">" table)
(let ((table (make-syntax-table)))
(modify-syntax-entry ?\` "w" table)
(modify-syntax-entry ?\# "<" table)
(modify-syntax-entry ?\n ">" table)
(defvar inferior-octave-complete-impossible nil
"Non-nil means that `inferior-octave-complete' is impossible.")
(defvar inferior-octave-complete-impossible nil
"Non-nil means that `inferior-octave-complete' is impossible.")
(defvar inferior-octave-dynamic-complete-functions
'(inferior-octave-complete comint-dynamic-complete-filename)
"List of functions called to perform completion for inferior Octave.
(defvar inferior-octave-dynamic-complete-functions
'(inferior-octave-complete comint-dynamic-complete-filename)
"List of functions called to perform completion for inferior Octave.
- comint-input-ring-size (or (getenv "OCTAVE_HISTSIZE") 1024)
- comint-input-filter-functions '(inferior-octave-directory-tracker)
- comint-dynamic-complete-functions
- inferior-octave-dynamic-complete-functions)
+ comint-input-ring-size (or (getenv "OCTAVE_HISTSIZE") 1024))
+ (set (make-local-variable 'comint-dynamic-complete-functions)
+ inferior-octave-dynamic-complete-functions)
+ (add-hook 'comint-input-filter-functions
+ 'inferior-octave-directory-tracker nil t)
+ ;; 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"))
;; 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"))))
(save-excursion
(skip-syntax-backward "w_" (comint-line-beginning-position))
(buffer-substring-no-properties (point) end)))
(save-excursion
(skip-syntax-backward "w_" (comint-line-beginning-position))
(buffer-substring-no-properties (point) end)))
;; We cannot use `comint-dynamic-list-input-ring', because it replaces
;; "completion" by "history reference" ...
(interactive)
;; We cannot use `comint-dynamic-list-input-ring', because it replaces
;; "completion" by "history reference" ...
(interactive)
This command queries the inferior Octave process about its current
directory and makes this the current buffer's default directory."
(interactive)
This command queries the inferior Octave process about its current
directory and makes this the current buffer's default directory."
(interactive)