1997-04-20 07:33:52 +00:00
|
|
|
|
;;; octave-inf.el --- running Octave as an inferior Emacs process
|
1997-01-21 00:35:48 +00:00
|
|
|
|
|
2012-02-20 12:24:24 -08:00
|
|
|
|
;; Copyright (C) 1997, 2001-2012 Free Software Foundation, Inc.
|
1997-01-21 00:35:48 +00:00
|
|
|
|
|
2005-08-26 13:42:43 +00:00
|
|
|
|
;; Author: Kurt Hornik <Kurt.Hornik@wu-wien.ac.at>
|
2012-02-20 12:24:24 -08:00
|
|
|
|
;; John Eaton <jwe@bevo.che.wisc.edu>
|
2011-10-25 21:18:13 -04:00
|
|
|
|
;; Maintainer: FSF
|
1997-01-21 00:35:48 +00:00
|
|
|
|
;; Keywords: languages
|
2010-08-29 16:10:43 -04:00
|
|
|
|
;; Package: octave-mod
|
1997-01-21 00:35:48 +00:00
|
|
|
|
|
|
|
|
|
;; This file is part of GNU Emacs.
|
|
|
|
|
|
2008-05-06 07:25:26 +00:00
|
|
|
|
;; GNU Emacs is free software: you can redistribute it and/or modify
|
1997-01-21 00:35:48 +00:00
|
|
|
|
;; it under the terms of the GNU General Public License as published by
|
2008-05-06 07:25:26 +00:00
|
|
|
|
;; the Free Software Foundation, either version 3 of the License, or
|
|
|
|
|
;; (at your option) any later version.
|
1997-01-21 00:35:48 +00:00
|
|
|
|
|
|
|
|
|
;; GNU Emacs is distributed in the hope that it will be useful,
|
|
|
|
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
;; GNU General Public License for more details.
|
|
|
|
|
|
|
|
|
|
;; You should have received a copy of the GNU General Public License
|
2008-05-06 07:25:26 +00:00
|
|
|
|
;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
|
1997-01-21 00:35:48 +00:00
|
|
|
|
|
2001-07-16 12:23:00 +00:00
|
|
|
|
;;; Commentary:
|
|
|
|
|
|
1997-01-21 00:35:48 +00:00
|
|
|
|
;;; Code:
|
|
|
|
|
|
1997-01-21 00:37:59 +00:00
|
|
|
|
(require 'octave-mod)
|
1997-01-21 00:35:48 +00:00
|
|
|
|
(require 'comint)
|
|
|
|
|
|
1998-01-26 11:29:46 +00:00
|
|
|
|
(defgroup octave-inferior nil
|
|
|
|
|
"Running Octave as an inferior Emacs process."
|
|
|
|
|
:group 'octave)
|
1997-01-21 00:35:48 +00:00
|
|
|
|
|
1998-01-26 11:29:46 +00:00
|
|
|
|
(defcustom inferior-octave-program "octave"
|
2006-07-07 14:40:35 +00:00
|
|
|
|
"Program invoked by `inferior-octave'."
|
1998-01-26 11:29:46 +00:00
|
|
|
|
:type 'string
|
|
|
|
|
:group 'octave-inferior)
|
|
|
|
|
|
|
|
|
|
(defcustom inferior-octave-prompt
|
2007-07-23 17:55:00 +00:00
|
|
|
|
"\\(^octave\\(\\|.bin\\|.exe\\)\\(-[.0-9]+\\)?\\(:[0-9]+\\)?\\|^debug\\|^\\)>+ "
|
2006-07-07 14:40:35 +00:00
|
|
|
|
"Regexp to match prompts for the inferior Octave process."
|
1998-01-26 11:29:46 +00:00
|
|
|
|
:type 'regexp
|
|
|
|
|
:group 'octave-inferior)
|
1997-01-21 00:35:48 +00:00
|
|
|
|
|
1998-01-26 11:29:46 +00:00
|
|
|
|
(defcustom inferior-octave-startup-file nil
|
2006-07-07 14:40:35 +00:00
|
|
|
|
"Name of the inferior Octave startup file.
|
1997-01-21 00:35:48 +00:00
|
|
|
|
The contents of this file are sent to the inferior Octave process on
|
1998-01-26 11:29:46 +00:00
|
|
|
|
startup."
|
|
|
|
|
:type '(choice (const :tag "None" nil)
|
|
|
|
|
file)
|
|
|
|
|
:group 'octave-inferior)
|
1997-01-21 00:35:48 +00:00
|
|
|
|
|
1999-09-14 16:57:40 +00:00
|
|
|
|
(defcustom inferior-octave-startup-args nil
|
2006-07-07 14:40:35 +00:00
|
|
|
|
"List of command line arguments for the inferior Octave process.
|
1997-01-21 00:35:48 +00:00
|
|
|
|
For example, for suppressing the startup message and using `traditional'
|
1998-01-26 11:29:46 +00:00
|
|
|
|
mode, set this to (\"-q\" \"--traditional\")."
|
|
|
|
|
:type '(repeat string)
|
|
|
|
|
:group 'octave-inferior)
|
1997-01-21 00:35:48 +00:00
|
|
|
|
|
2006-07-07 14:40:35 +00:00
|
|
|
|
(defvar inferior-octave-mode-map
|
|
|
|
|
(let ((map (make-sparse-keymap)))
|
|
|
|
|
(set-keymap-parent map comint-mode-map)
|
1997-01-21 00:35:48 +00:00
|
|
|
|
(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))
|
2011-10-25 21:18:13 -04:00
|
|
|
|
;; FIXME: free C-h so it can do the describe-prefix-bindings.
|
2011-10-23 22:56:59 -04:00
|
|
|
|
(define-key map "\C-c\C-h" 'info-lookup-symbol)
|
2006-07-07 14:40:35 +00:00
|
|
|
|
map)
|
|
|
|
|
"Keymap used in Inferior Octave mode.")
|
1997-01-21 00:35:48 +00:00
|
|
|
|
|
2006-07-07 14:40:35 +00:00
|
|
|
|
(defvar inferior-octave-mode-syntax-table
|
2011-04-25 13:29:31 -03:00
|
|
|
|
(let ((table (make-syntax-table octave-mode-syntax-table)))
|
2006-07-07 14:40:35 +00:00
|
|
|
|
table)
|
|
|
|
|
"Syntax table in use in inferior-octave-mode buffers.")
|
1997-01-21 00:35:48 +00:00
|
|
|
|
|
1998-01-26 11:29:46 +00:00
|
|
|
|
(defcustom inferior-octave-mode-hook nil
|
2012-04-09 21:05:48 +08:00
|
|
|
|
"Hook to be run when Inferior Octave mode is started."
|
1998-01-26 11:29:46 +00:00
|
|
|
|
:type 'hook
|
|
|
|
|
:group 'octave-inferior)
|
1997-01-21 00:35:48 +00:00
|
|
|
|
|
|
|
|
|
(defvar inferior-octave-font-lock-keywords
|
|
|
|
|
(list
|
|
|
|
|
(cons inferior-octave-prompt 'font-lock-type-face))
|
|
|
|
|
;; Could certainly do more font locking in inferior Octave ...
|
|
|
|
|
"Additional expressions to highlight in Inferior Octave mode.")
|
|
|
|
|
|
2000-08-17 06:25:11 +00:00
|
|
|
|
|
|
|
|
|
;;; Compatibility functions
|
|
|
|
|
(if (not (fboundp 'comint-line-beginning-position))
|
|
|
|
|
;; comint-line-beginning-position is defined in Emacs 21
|
|
|
|
|
(defun comint-line-beginning-position ()
|
|
|
|
|
"Returns the buffer position of the beginning of the line, after any prompt.
|
|
|
|
|
The prompt is assumed to be any text at the beginning of the line matching
|
|
|
|
|
the regular expression `comint-prompt-regexp', a buffer local variable."
|
|
|
|
|
(save-excursion (comint-bol nil) (point))))
|
|
|
|
|
|
|
|
|
|
|
1997-01-21 00:35:48 +00:00
|
|
|
|
(defvar inferior-octave-output-list nil)
|
|
|
|
|
(defvar inferior-octave-output-string nil)
|
|
|
|
|
(defvar inferior-octave-receive-in-progress nil)
|
|
|
|
|
|
|
|
|
|
(defvar inferior-octave-startup-hook nil)
|
|
|
|
|
|
|
|
|
|
(defvar inferior-octave-complete-impossible nil
|
|
|
|
|
"Non-nil means that `inferior-octave-complete' is impossible.")
|
|
|
|
|
|
2006-10-27 14:39:43 +00:00
|
|
|
|
(defvar inferior-octave-has-built-in-variables nil
|
|
|
|
|
"Non-nil means that Octave has built-in variables.")
|
|
|
|
|
|
1997-01-21 00:35:48 +00:00
|
|
|
|
(defvar inferior-octave-dynamic-complete-functions
|
2011-04-25 13:29:31 -03:00
|
|
|
|
'(inferior-octave-completion-at-point comint-filename-completion)
|
1997-01-21 00:35:48 +00:00
|
|
|
|
"List of functions called to perform completion for inferior Octave.
|
|
|
|
|
This variable is used to initialize `comint-dynamic-complete-functions'
|
|
|
|
|
in the Inferior Octave buffer.")
|
|
|
|
|
|
2011-04-25 13:29:31 -03:00
|
|
|
|
(defvar info-lookup-mode)
|
|
|
|
|
|
Derive from prog-mode, use derived-mode-p, and fix up various
minor style issues in lisp/progmodes.
* lisp/progmodes/vhdl-mode.el (vhdl-write-file-hooks-init)
(vhdl-hs-minor-mode, vhdl-ps-print-init): Fix make-local-variable ->
make-local-hook.
* lisp/progmodes/sh-script.el (sh-require-final-newline): Remove.
(sh-set-shell): Don't set require-final-newline since it's already done
by prog-mode.
* lisp/progmodes/modula2.el (m2-mode): Don't make m2-end-comment-column
since we never set it.
* lisp/progmodes/ebrowse.el (ebrowse-set-tree-indentation):
Use read-string and standard prompt.
* lisp/progmodes/dcl-mode.el (dcl-mode-map): Move init into declaration.
* lisp/progmodes/meta-mode.el (meta-mode-abbrev-table): Merge init and decl.
(meta-common-mode-syntax-table): Rename from meta-mode-syntax-table.
(meta-common-mode-map): Rename from meta-mode-map.
Remove C-m binding, which is a user preference, not mode specific.
(meta-common-mode): New major mode; replace meta-common-initialization.
* lisp/progmodes/js.el (js-mode): Call syntax-propertize rather than messing
around with font-lock.
* lisp/progmodes/etags.el (select-tags-table-mode):
Derive from special-mode.
* lisp/progmodes/octave-mod.el (octave-mode):
* lisp/progmodes/gdb-mi.el (gdb-inferior-io-mode, gdb-threads-mode)
(gdb-memory-mode, gdb-disassembly-mode, gdb-breakpoints-mode)
(gdb-frames-mode, gdb-locals-mode, gdb-registers-mode):
Let define-derived-mode do its job.
* lisp/progmodes/cpp.el (cpp-edit-mode-map):
Move initialization into declaration.
(cpp-edit-mode): Use define-derived-mode.
(cpp-edit-load): Use derived-mode-p.
* lisp/progmodes/mixal-mode.el (mixal-mode):
* lisp/progmodes/f90.el (f90-mode):
* lisp/progmodes/cfengine.el (cfengine-mode): Don't bother setting
require-final-newline since prog-mode does it already.
* lisp/progmodes/cc-cmds.el (c-update-modeline): Use match-string.
* lisp/progmodes/asm-mode.el (asm-mode-map): Fix menu setup.
* lisp/progmodes/antlr-mode.el: Require cc-mode upfront.
(antlr-mode-syntax-table, antlr-action-syntax-table): Initialize in
the declaration.
(antlr-directory-dependencies, antlr-show-makefile-rules):
Use derived-mode-p.
(antlr-language-option): Don't assume point-min==1.
(antlr-mode): Use define-derived-mode.
* lisp/progmodes/ada-mode.el: Use derived-mode-p.
(ada-mode): Use define-derived-mode.
Use hack-local-variables-hook.
* lisp/progmodes/vhdl-mode.el (vhdl-mode):
* lisp/progmodes/verilog-mode.el (verilog-mode):
* lisp/progmodes/vera-mode.el (vera-mode):
* lisp/progmodes/sql.el (sql-mode):
* lisp/progmodes/scheme.el (scheme-mode):
* lisp/progmodes/perl-mode.el (perl-mode):
* lisp/progmodes/octave-inf.el (inferior-octave-mode):
* lisp/progmodes/autoconf.el (autoconf-mode):
* lisp/progmodes/m4-mode.el (m4-mode):
* lisp/progmodes/inf-lisp.el (inferior-lisp-mode):
* lisp/progmodes/idlwave.el (idlwave-mode):
* lisp/progmodes/icon.el (icon-mode):
* lisp/progmodes/idlw-help.el (idlwave-help-mode):
* lisp/progmodes/dcl-mode.el (dcl-mode):
* lisp/progmodes/idlw-shell.el (idlwave-shell-mode):
* lisp/progmodes/ebrowse.el (ebrowse-tree-mode, ebrowse-electric-list-mode)
(ebrowse-member-mode, ebrowse-electric-position-mode):
Use define-derived-mode.
* lisp/progmodes/xscheme.el (xscheme-start)
(local-set-scheme-interaction-buffer, scheme-interaction-mode):
* lisp/progmodes/which-func.el (which-function):
* lisp/progmodes/vhdl-mode.el (vhdl-set-style):
* lisp/progmodes/verilog-mode.el (verilog-set-compile-command)
(verilog-modify-compile-command, verilog-error-regexp-add-xemacs)
(verilog-set-define, verilog-auto-reeval-locals):
* lisp/progmodes/sql.el (sql-product-font-lock, sql-interactive-mode):
* lisp/progmodes/simula.el (simula-mode):
* lisp/progmodes/scheme.el (scheme-mode-variables, dsssl-mode):
* lisp/progmodes/python.el (python-check, python-mode):
* lisp/progmodes/prolog.el (prolog-mode-variables):
* lisp/progmodes/gud.el (gud-tooltip-activate-mouse-motions):
* lisp/progmodes/ebrowse.el (ebrowse-view-file-other-frame):
* lisp/progmodes/delphi.el (delphi-mode):
* lisp/progmodes/cc-styles.el (c-setup-paragraph-variables):
* lisp/progmodes/cc-mode.el (c-basic-common-init, c-common-init)
(c-font-lock-init): Move make-local-variable to their setq.
* lisp/progmodes/xscheme.el (exit-scheme-interaction-mode)
(xscheme-enter-interaction-mode, xscheme-enter-debugger-mode)
(xscheme-debugger-mode-p, xscheme-send-string-1):
* lisp/progmodes/tcl.el (inferior-tcl-proc, tcl-current-word)
(tcl-load-file, tcl-restart-with-file):
* lisp/progmodes/ps-mode.el (ps-run-running):
* lisp/progmodes/gdb-mi.el (gud-watch, gdb-mouse-set-clear-breakpoint):
* lisp/progmodes/js.el (js--get-all-known-symbols):
* lisp/progmodes/inf-lisp.el (inferior-lisp-proc):
* lisp/progmodes/idlwave.el (idlwave-beginning-of-statement)
(idlwave-template, idlwave-update-buffer-routine-info)
(idlwave-update-current-buffer-info)
(idlwave-get-routine-info-from-buffers, idlwave-choose)
(idlwave-scan-class-info, idlwave-fix-keywords)
(idlwave-list-buffer-load-path-shadows):
* lisp/progmodes/idlw-toolbar.el (idlwave-toolbar, idlwave-toolbar-add)
(idlwave-toolbar-remove):
* lisp/progmodes/idlw-shell.el (idlwave-shell-save-and-action)
(idlwave-shell-file-name, idlwave-shell-electric-debug-all-off)
(idlwave-shell-menu-def):
* lisp/progmodes/idlw-complete-structtag.el
(idlwave-prepare-structure-tag-completion):
* lisp/progmodes/gud.el (gud-set-buffer):
* lisp/progmodes/f90.el (f90-backslash-not-special):
* lisp/progmodes/delphi.el (delphi-find-unit): Use derived-mode-p.
2010-12-10 15:00:25 -05:00
|
|
|
|
(define-derived-mode inferior-octave-mode comint-mode "Inferior Octave"
|
1997-01-21 00:35:48 +00:00
|
|
|
|
"Major mode for interacting with an inferior Octave process.
|
|
|
|
|
Runs Octave as a subprocess of Emacs, with Octave I/O through an Emacs
|
|
|
|
|
buffer.
|
|
|
|
|
|
|
|
|
|
Entry to this mode successively runs the hooks `comint-mode-hook' and
|
|
|
|
|
`inferior-octave-mode-hook'."
|
|
|
|
|
(setq comint-prompt-regexp inferior-octave-prompt
|
|
|
|
|
mode-line-process '(":%s")
|
|
|
|
|
local-abbrev-table octave-abbrev-table)
|
|
|
|
|
|
Derive from prog-mode, use derived-mode-p, and fix up various
minor style issues in lisp/progmodes.
* lisp/progmodes/vhdl-mode.el (vhdl-write-file-hooks-init)
(vhdl-hs-minor-mode, vhdl-ps-print-init): Fix make-local-variable ->
make-local-hook.
* lisp/progmodes/sh-script.el (sh-require-final-newline): Remove.
(sh-set-shell): Don't set require-final-newline since it's already done
by prog-mode.
* lisp/progmodes/modula2.el (m2-mode): Don't make m2-end-comment-column
since we never set it.
* lisp/progmodes/ebrowse.el (ebrowse-set-tree-indentation):
Use read-string and standard prompt.
* lisp/progmodes/dcl-mode.el (dcl-mode-map): Move init into declaration.
* lisp/progmodes/meta-mode.el (meta-mode-abbrev-table): Merge init and decl.
(meta-common-mode-syntax-table): Rename from meta-mode-syntax-table.
(meta-common-mode-map): Rename from meta-mode-map.
Remove C-m binding, which is a user preference, not mode specific.
(meta-common-mode): New major mode; replace meta-common-initialization.
* lisp/progmodes/js.el (js-mode): Call syntax-propertize rather than messing
around with font-lock.
* lisp/progmodes/etags.el (select-tags-table-mode):
Derive from special-mode.
* lisp/progmodes/octave-mod.el (octave-mode):
* lisp/progmodes/gdb-mi.el (gdb-inferior-io-mode, gdb-threads-mode)
(gdb-memory-mode, gdb-disassembly-mode, gdb-breakpoints-mode)
(gdb-frames-mode, gdb-locals-mode, gdb-registers-mode):
Let define-derived-mode do its job.
* lisp/progmodes/cpp.el (cpp-edit-mode-map):
Move initialization into declaration.
(cpp-edit-mode): Use define-derived-mode.
(cpp-edit-load): Use derived-mode-p.
* lisp/progmodes/mixal-mode.el (mixal-mode):
* lisp/progmodes/f90.el (f90-mode):
* lisp/progmodes/cfengine.el (cfengine-mode): Don't bother setting
require-final-newline since prog-mode does it already.
* lisp/progmodes/cc-cmds.el (c-update-modeline): Use match-string.
* lisp/progmodes/asm-mode.el (asm-mode-map): Fix menu setup.
* lisp/progmodes/antlr-mode.el: Require cc-mode upfront.
(antlr-mode-syntax-table, antlr-action-syntax-table): Initialize in
the declaration.
(antlr-directory-dependencies, antlr-show-makefile-rules):
Use derived-mode-p.
(antlr-language-option): Don't assume point-min==1.
(antlr-mode): Use define-derived-mode.
* lisp/progmodes/ada-mode.el: Use derived-mode-p.
(ada-mode): Use define-derived-mode.
Use hack-local-variables-hook.
* lisp/progmodes/vhdl-mode.el (vhdl-mode):
* lisp/progmodes/verilog-mode.el (verilog-mode):
* lisp/progmodes/vera-mode.el (vera-mode):
* lisp/progmodes/sql.el (sql-mode):
* lisp/progmodes/scheme.el (scheme-mode):
* lisp/progmodes/perl-mode.el (perl-mode):
* lisp/progmodes/octave-inf.el (inferior-octave-mode):
* lisp/progmodes/autoconf.el (autoconf-mode):
* lisp/progmodes/m4-mode.el (m4-mode):
* lisp/progmodes/inf-lisp.el (inferior-lisp-mode):
* lisp/progmodes/idlwave.el (idlwave-mode):
* lisp/progmodes/icon.el (icon-mode):
* lisp/progmodes/idlw-help.el (idlwave-help-mode):
* lisp/progmodes/dcl-mode.el (dcl-mode):
* lisp/progmodes/idlw-shell.el (idlwave-shell-mode):
* lisp/progmodes/ebrowse.el (ebrowse-tree-mode, ebrowse-electric-list-mode)
(ebrowse-member-mode, ebrowse-electric-position-mode):
Use define-derived-mode.
* lisp/progmodes/xscheme.el (xscheme-start)
(local-set-scheme-interaction-buffer, scheme-interaction-mode):
* lisp/progmodes/which-func.el (which-function):
* lisp/progmodes/vhdl-mode.el (vhdl-set-style):
* lisp/progmodes/verilog-mode.el (verilog-set-compile-command)
(verilog-modify-compile-command, verilog-error-regexp-add-xemacs)
(verilog-set-define, verilog-auto-reeval-locals):
* lisp/progmodes/sql.el (sql-product-font-lock, sql-interactive-mode):
* lisp/progmodes/simula.el (simula-mode):
* lisp/progmodes/scheme.el (scheme-mode-variables, dsssl-mode):
* lisp/progmodes/python.el (python-check, python-mode):
* lisp/progmodes/prolog.el (prolog-mode-variables):
* lisp/progmodes/gud.el (gud-tooltip-activate-mouse-motions):
* lisp/progmodes/ebrowse.el (ebrowse-view-file-other-frame):
* lisp/progmodes/delphi.el (delphi-mode):
* lisp/progmodes/cc-styles.el (c-setup-paragraph-variables):
* lisp/progmodes/cc-mode.el (c-basic-common-init, c-common-init)
(c-font-lock-init): Move make-local-variable to their setq.
* lisp/progmodes/xscheme.el (exit-scheme-interaction-mode)
(xscheme-enter-interaction-mode, xscheme-enter-debugger-mode)
(xscheme-debugger-mode-p, xscheme-send-string-1):
* lisp/progmodes/tcl.el (inferior-tcl-proc, tcl-current-word)
(tcl-load-file, tcl-restart-with-file):
* lisp/progmodes/ps-mode.el (ps-run-running):
* lisp/progmodes/gdb-mi.el (gud-watch, gdb-mouse-set-clear-breakpoint):
* lisp/progmodes/js.el (js--get-all-known-symbols):
* lisp/progmodes/inf-lisp.el (inferior-lisp-proc):
* lisp/progmodes/idlwave.el (idlwave-beginning-of-statement)
(idlwave-template, idlwave-update-buffer-routine-info)
(idlwave-update-current-buffer-info)
(idlwave-get-routine-info-from-buffers, idlwave-choose)
(idlwave-scan-class-info, idlwave-fix-keywords)
(idlwave-list-buffer-load-path-shadows):
* lisp/progmodes/idlw-toolbar.el (idlwave-toolbar, idlwave-toolbar-add)
(idlwave-toolbar-remove):
* lisp/progmodes/idlw-shell.el (idlwave-shell-save-and-action)
(idlwave-shell-file-name, idlwave-shell-electric-debug-all-off)
(idlwave-shell-menu-def):
* lisp/progmodes/idlw-complete-structtag.el
(idlwave-prepare-structure-tag-completion):
* lisp/progmodes/gud.el (gud-set-buffer):
* lisp/progmodes/f90.el (f90-backslash-not-special):
* lisp/progmodes/delphi.el (delphi-find-unit): Use derived-mode-p.
2010-12-10 15:00:25 -05:00
|
|
|
|
(set (make-local-variable 'comment-start) octave-comment-start)
|
|
|
|
|
(set (make-local-variable 'comment-end) "")
|
|
|
|
|
(set (make-local-variable 'comment-column) 32)
|
|
|
|
|
(set (make-local-variable 'comment-start-skip) octave-comment-start-skip)
|
1997-01-21 00:35:48 +00:00
|
|
|
|
|
Derive from prog-mode, use derived-mode-p, and fix up various
minor style issues in lisp/progmodes.
* lisp/progmodes/vhdl-mode.el (vhdl-write-file-hooks-init)
(vhdl-hs-minor-mode, vhdl-ps-print-init): Fix make-local-variable ->
make-local-hook.
* lisp/progmodes/sh-script.el (sh-require-final-newline): Remove.
(sh-set-shell): Don't set require-final-newline since it's already done
by prog-mode.
* lisp/progmodes/modula2.el (m2-mode): Don't make m2-end-comment-column
since we never set it.
* lisp/progmodes/ebrowse.el (ebrowse-set-tree-indentation):
Use read-string and standard prompt.
* lisp/progmodes/dcl-mode.el (dcl-mode-map): Move init into declaration.
* lisp/progmodes/meta-mode.el (meta-mode-abbrev-table): Merge init and decl.
(meta-common-mode-syntax-table): Rename from meta-mode-syntax-table.
(meta-common-mode-map): Rename from meta-mode-map.
Remove C-m binding, which is a user preference, not mode specific.
(meta-common-mode): New major mode; replace meta-common-initialization.
* lisp/progmodes/js.el (js-mode): Call syntax-propertize rather than messing
around with font-lock.
* lisp/progmodes/etags.el (select-tags-table-mode):
Derive from special-mode.
* lisp/progmodes/octave-mod.el (octave-mode):
* lisp/progmodes/gdb-mi.el (gdb-inferior-io-mode, gdb-threads-mode)
(gdb-memory-mode, gdb-disassembly-mode, gdb-breakpoints-mode)
(gdb-frames-mode, gdb-locals-mode, gdb-registers-mode):
Let define-derived-mode do its job.
* lisp/progmodes/cpp.el (cpp-edit-mode-map):
Move initialization into declaration.
(cpp-edit-mode): Use define-derived-mode.
(cpp-edit-load): Use derived-mode-p.
* lisp/progmodes/mixal-mode.el (mixal-mode):
* lisp/progmodes/f90.el (f90-mode):
* lisp/progmodes/cfengine.el (cfengine-mode): Don't bother setting
require-final-newline since prog-mode does it already.
* lisp/progmodes/cc-cmds.el (c-update-modeline): Use match-string.
* lisp/progmodes/asm-mode.el (asm-mode-map): Fix menu setup.
* lisp/progmodes/antlr-mode.el: Require cc-mode upfront.
(antlr-mode-syntax-table, antlr-action-syntax-table): Initialize in
the declaration.
(antlr-directory-dependencies, antlr-show-makefile-rules):
Use derived-mode-p.
(antlr-language-option): Don't assume point-min==1.
(antlr-mode): Use define-derived-mode.
* lisp/progmodes/ada-mode.el: Use derived-mode-p.
(ada-mode): Use define-derived-mode.
Use hack-local-variables-hook.
* lisp/progmodes/vhdl-mode.el (vhdl-mode):
* lisp/progmodes/verilog-mode.el (verilog-mode):
* lisp/progmodes/vera-mode.el (vera-mode):
* lisp/progmodes/sql.el (sql-mode):
* lisp/progmodes/scheme.el (scheme-mode):
* lisp/progmodes/perl-mode.el (perl-mode):
* lisp/progmodes/octave-inf.el (inferior-octave-mode):
* lisp/progmodes/autoconf.el (autoconf-mode):
* lisp/progmodes/m4-mode.el (m4-mode):
* lisp/progmodes/inf-lisp.el (inferior-lisp-mode):
* lisp/progmodes/idlwave.el (idlwave-mode):
* lisp/progmodes/icon.el (icon-mode):
* lisp/progmodes/idlw-help.el (idlwave-help-mode):
* lisp/progmodes/dcl-mode.el (dcl-mode):
* lisp/progmodes/idlw-shell.el (idlwave-shell-mode):
* lisp/progmodes/ebrowse.el (ebrowse-tree-mode, ebrowse-electric-list-mode)
(ebrowse-member-mode, ebrowse-electric-position-mode):
Use define-derived-mode.
* lisp/progmodes/xscheme.el (xscheme-start)
(local-set-scheme-interaction-buffer, scheme-interaction-mode):
* lisp/progmodes/which-func.el (which-function):
* lisp/progmodes/vhdl-mode.el (vhdl-set-style):
* lisp/progmodes/verilog-mode.el (verilog-set-compile-command)
(verilog-modify-compile-command, verilog-error-regexp-add-xemacs)
(verilog-set-define, verilog-auto-reeval-locals):
* lisp/progmodes/sql.el (sql-product-font-lock, sql-interactive-mode):
* lisp/progmodes/simula.el (simula-mode):
* lisp/progmodes/scheme.el (scheme-mode-variables, dsssl-mode):
* lisp/progmodes/python.el (python-check, python-mode):
* lisp/progmodes/prolog.el (prolog-mode-variables):
* lisp/progmodes/gud.el (gud-tooltip-activate-mouse-motions):
* lisp/progmodes/ebrowse.el (ebrowse-view-file-other-frame):
* lisp/progmodes/delphi.el (delphi-mode):
* lisp/progmodes/cc-styles.el (c-setup-paragraph-variables):
* lisp/progmodes/cc-mode.el (c-basic-common-init, c-common-init)
(c-font-lock-init): Move make-local-variable to their setq.
* lisp/progmodes/xscheme.el (exit-scheme-interaction-mode)
(xscheme-enter-interaction-mode, xscheme-enter-debugger-mode)
(xscheme-debugger-mode-p, xscheme-send-string-1):
* lisp/progmodes/tcl.el (inferior-tcl-proc, tcl-current-word)
(tcl-load-file, tcl-restart-with-file):
* lisp/progmodes/ps-mode.el (ps-run-running):
* lisp/progmodes/gdb-mi.el (gud-watch, gdb-mouse-set-clear-breakpoint):
* lisp/progmodes/js.el (js--get-all-known-symbols):
* lisp/progmodes/inf-lisp.el (inferior-lisp-proc):
* lisp/progmodes/idlwave.el (idlwave-beginning-of-statement)
(idlwave-template, idlwave-update-buffer-routine-info)
(idlwave-update-current-buffer-info)
(idlwave-get-routine-info-from-buffers, idlwave-choose)
(idlwave-scan-class-info, idlwave-fix-keywords)
(idlwave-list-buffer-load-path-shadows):
* lisp/progmodes/idlw-toolbar.el (idlwave-toolbar, idlwave-toolbar-add)
(idlwave-toolbar-remove):
* lisp/progmodes/idlw-shell.el (idlwave-shell-save-and-action)
(idlwave-shell-file-name, idlwave-shell-electric-debug-all-off)
(idlwave-shell-menu-def):
* lisp/progmodes/idlw-complete-structtag.el
(idlwave-prepare-structure-tag-completion):
* lisp/progmodes/gud.el (gud-set-buffer):
* lisp/progmodes/f90.el (f90-backslash-not-special):
* lisp/progmodes/delphi.el (delphi-find-unit): Use derived-mode-p.
2010-12-10 15:00:25 -05:00
|
|
|
|
(set (make-local-variable 'font-lock-defaults)
|
|
|
|
|
'(inferior-octave-font-lock-keywords nil nil))
|
1997-01-21 00:35:48 +00:00
|
|
|
|
|
2011-04-25 13:29:31 -03:00
|
|
|
|
(set (make-local-variable 'info-lookup-mode) 'octave-mode)
|
|
|
|
|
|
1997-01-21 00:35:48 +00:00
|
|
|
|
(setq comint-input-ring-file-name
|
|
|
|
|
(or (getenv "OCTAVE_HISTFILE") "~/.octave_hist")
|
2007-09-22 20:12:05 +00:00
|
|
|
|
comint-input-ring-size (or (getenv "OCTAVE_HISTSIZE") 1024))
|
2006-07-07 14:40:35 +00:00
|
|
|
|
(set (make-local-variable 'comint-dynamic-complete-functions)
|
|
|
|
|
inferior-octave-dynamic-complete-functions)
|
2007-09-22 20:12:05 +00:00
|
|
|
|
(add-hook 'comint-input-filter-functions
|
|
|
|
|
'inferior-octave-directory-tracker nil t)
|
Derive from prog-mode, use derived-mode-p, and fix up various
minor style issues in lisp/progmodes.
* lisp/progmodes/vhdl-mode.el (vhdl-write-file-hooks-init)
(vhdl-hs-minor-mode, vhdl-ps-print-init): Fix make-local-variable ->
make-local-hook.
* lisp/progmodes/sh-script.el (sh-require-final-newline): Remove.
(sh-set-shell): Don't set require-final-newline since it's already done
by prog-mode.
* lisp/progmodes/modula2.el (m2-mode): Don't make m2-end-comment-column
since we never set it.
* lisp/progmodes/ebrowse.el (ebrowse-set-tree-indentation):
Use read-string and standard prompt.
* lisp/progmodes/dcl-mode.el (dcl-mode-map): Move init into declaration.
* lisp/progmodes/meta-mode.el (meta-mode-abbrev-table): Merge init and decl.
(meta-common-mode-syntax-table): Rename from meta-mode-syntax-table.
(meta-common-mode-map): Rename from meta-mode-map.
Remove C-m binding, which is a user preference, not mode specific.
(meta-common-mode): New major mode; replace meta-common-initialization.
* lisp/progmodes/js.el (js-mode): Call syntax-propertize rather than messing
around with font-lock.
* lisp/progmodes/etags.el (select-tags-table-mode):
Derive from special-mode.
* lisp/progmodes/octave-mod.el (octave-mode):
* lisp/progmodes/gdb-mi.el (gdb-inferior-io-mode, gdb-threads-mode)
(gdb-memory-mode, gdb-disassembly-mode, gdb-breakpoints-mode)
(gdb-frames-mode, gdb-locals-mode, gdb-registers-mode):
Let define-derived-mode do its job.
* lisp/progmodes/cpp.el (cpp-edit-mode-map):
Move initialization into declaration.
(cpp-edit-mode): Use define-derived-mode.
(cpp-edit-load): Use derived-mode-p.
* lisp/progmodes/mixal-mode.el (mixal-mode):
* lisp/progmodes/f90.el (f90-mode):
* lisp/progmodes/cfengine.el (cfengine-mode): Don't bother setting
require-final-newline since prog-mode does it already.
* lisp/progmodes/cc-cmds.el (c-update-modeline): Use match-string.
* lisp/progmodes/asm-mode.el (asm-mode-map): Fix menu setup.
* lisp/progmodes/antlr-mode.el: Require cc-mode upfront.
(antlr-mode-syntax-table, antlr-action-syntax-table): Initialize in
the declaration.
(antlr-directory-dependencies, antlr-show-makefile-rules):
Use derived-mode-p.
(antlr-language-option): Don't assume point-min==1.
(antlr-mode): Use define-derived-mode.
* lisp/progmodes/ada-mode.el: Use derived-mode-p.
(ada-mode): Use define-derived-mode.
Use hack-local-variables-hook.
* lisp/progmodes/vhdl-mode.el (vhdl-mode):
* lisp/progmodes/verilog-mode.el (verilog-mode):
* lisp/progmodes/vera-mode.el (vera-mode):
* lisp/progmodes/sql.el (sql-mode):
* lisp/progmodes/scheme.el (scheme-mode):
* lisp/progmodes/perl-mode.el (perl-mode):
* lisp/progmodes/octave-inf.el (inferior-octave-mode):
* lisp/progmodes/autoconf.el (autoconf-mode):
* lisp/progmodes/m4-mode.el (m4-mode):
* lisp/progmodes/inf-lisp.el (inferior-lisp-mode):
* lisp/progmodes/idlwave.el (idlwave-mode):
* lisp/progmodes/icon.el (icon-mode):
* lisp/progmodes/idlw-help.el (idlwave-help-mode):
* lisp/progmodes/dcl-mode.el (dcl-mode):
* lisp/progmodes/idlw-shell.el (idlwave-shell-mode):
* lisp/progmodes/ebrowse.el (ebrowse-tree-mode, ebrowse-electric-list-mode)
(ebrowse-member-mode, ebrowse-electric-position-mode):
Use define-derived-mode.
* lisp/progmodes/xscheme.el (xscheme-start)
(local-set-scheme-interaction-buffer, scheme-interaction-mode):
* lisp/progmodes/which-func.el (which-function):
* lisp/progmodes/vhdl-mode.el (vhdl-set-style):
* lisp/progmodes/verilog-mode.el (verilog-set-compile-command)
(verilog-modify-compile-command, verilog-error-regexp-add-xemacs)
(verilog-set-define, verilog-auto-reeval-locals):
* lisp/progmodes/sql.el (sql-product-font-lock, sql-interactive-mode):
* lisp/progmodes/simula.el (simula-mode):
* lisp/progmodes/scheme.el (scheme-mode-variables, dsssl-mode):
* lisp/progmodes/python.el (python-check, python-mode):
* lisp/progmodes/prolog.el (prolog-mode-variables):
* lisp/progmodes/gud.el (gud-tooltip-activate-mouse-motions):
* lisp/progmodes/ebrowse.el (ebrowse-view-file-other-frame):
* lisp/progmodes/delphi.el (delphi-mode):
* lisp/progmodes/cc-styles.el (c-setup-paragraph-variables):
* lisp/progmodes/cc-mode.el (c-basic-common-init, c-common-init)
(c-font-lock-init): Move make-local-variable to their setq.
* lisp/progmodes/xscheme.el (exit-scheme-interaction-mode)
(xscheme-enter-interaction-mode, xscheme-enter-debugger-mode)
(xscheme-debugger-mode-p, xscheme-send-string-1):
* lisp/progmodes/tcl.el (inferior-tcl-proc, tcl-current-word)
(tcl-load-file, tcl-restart-with-file):
* lisp/progmodes/ps-mode.el (ps-run-running):
* lisp/progmodes/gdb-mi.el (gud-watch, gdb-mouse-set-clear-breakpoint):
* lisp/progmodes/js.el (js--get-all-known-symbols):
* lisp/progmodes/inf-lisp.el (inferior-lisp-proc):
* lisp/progmodes/idlwave.el (idlwave-beginning-of-statement)
(idlwave-template, idlwave-update-buffer-routine-info)
(idlwave-update-current-buffer-info)
(idlwave-get-routine-info-from-buffers, idlwave-choose)
(idlwave-scan-class-info, idlwave-fix-keywords)
(idlwave-list-buffer-load-path-shadows):
* lisp/progmodes/idlw-toolbar.el (idlwave-toolbar, idlwave-toolbar-add)
(idlwave-toolbar-remove):
* lisp/progmodes/idlw-shell.el (idlwave-shell-save-and-action)
(idlwave-shell-file-name, idlwave-shell-electric-debug-all-off)
(idlwave-shell-menu-def):
* lisp/progmodes/idlw-complete-structtag.el
(idlwave-prepare-structure-tag-completion):
* lisp/progmodes/gud.el (gud-set-buffer):
* lisp/progmodes/f90.el (f90-backslash-not-special):
* lisp/progmodes/delphi.el (delphi-find-unit): Use derived-mode-p.
2010-12-10 15:00:25 -05:00
|
|
|
|
(comint-read-input-ring t))
|
1997-01-21 00:35:48 +00:00
|
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
|
(defun inferior-octave (&optional arg)
|
|
|
|
|
"Run an inferior Octave process, I/O via `inferior-octave-buffer'.
|
|
|
|
|
This buffer is put in Inferior Octave mode. See `inferior-octave-mode'.
|
|
|
|
|
|
|
|
|
|
Unless ARG is non-nil, switches to this buffer.
|
|
|
|
|
|
|
|
|
|
The elements of the list `inferior-octave-startup-args' are sent as
|
|
|
|
|
command line arguments to the inferior Octave process on startup.
|
|
|
|
|
|
|
|
|
|
Additional commands to be executed on startup can be provided either in
|
|
|
|
|
the file specified by `inferior-octave-startup-file' or by the default
|
|
|
|
|
startup file, `~/.emacs-octave'."
|
|
|
|
|
(interactive "P")
|
|
|
|
|
(let ((buffer inferior-octave-buffer))
|
|
|
|
|
(get-buffer-create buffer)
|
|
|
|
|
(if (comint-check-proc buffer)
|
|
|
|
|
()
|
* textmodes/two-column.el (2C-split):
* textmodes/texnfo-upd.el (texinfo-multi-file-included-list):
* textmodes/tex-mode.el (tex-set-buffer-directory):
* textmodes/spell.el (spell-region, spell-string):
* textmodes/reftex.el (reftex-erase-buffer):
(reftex-get-file-buffer-force, reftex-kill-temporary-buffers):
* textmodes/reftex-toc.el (reftex-toc-promote-action):
* textmodes/reftex-sel.el (reftex-get-offset, reftex-insert-docstruct)
(reftex-select-item):
* textmodes/reftex-ref.el (reftex-label-info-update)
(reftex-offer-label-menu):
* textmodes/reftex-index.el (reftex-index-change-entry)
(reftex-index-phrases-info):
* textmodes/reftex-global.el (reftex-create-tags-file)
(reftex-save-all-document-buffers, reftex-ensure-write-access):
* textmodes/reftex-dcr.el (reftex-echo-ref, reftex-echo-cite)
(reftex-view-crossref-from-bibtex):
* textmodes/reftex-cite.el (reftex-bibtex-selection-callback)
(reftex-extract-bib-entries-from-thebibliography)
(reftex-all-used-citation-keys, reftex-create-bibtex-file):
* textmodes/refbib.el (r2b-capitalize-title):
(r2b-convert-buffer, r2b-help):
* textmodes/page-ext.el (pages-directory)
(pages-directory-goto-with-mouse):
* textmodes/bibtex.el (bibtex-validate-globally):
* textmodes/bib-mode.el (bib-capitalize-title):
* textmodes/artist.el (artist-clear-buffer, artist-system):
* progmodes/xscheme.el (global-set-scheme-interaction-buffer):
(local-set-scheme-interaction-buffer, xscheme-process-filter)
(verify-xscheme-buffer, xscheme-enter-interaction-mode)
(xscheme-enter-debugger-mode, xscheme-debugger-mode-p)
(xscheme-send-control-g-interrupt, xscheme-start-process)
(xscheme-process-sentinel, xscheme-cd):
* progmodes/verilog-mode.el (verilog-read-always-signals)
(verilog-set-define, verilog-getopt-file)
(verilog-module-inside-filename-p):
* progmodes/sh-script.el:
* progmodes/python.el (python-pdbtrack-get-source-buffer)
(python-pdbtrack-grub-for-buffer, python-execute-file):
* progmodes/octave-inf.el (inferior-octave):
* progmodes/idlwave.el (idlwave-scan-user-lib-files)
(idlwave-shell-compile-helper-routines, idlwave-set-local)
(idlwave-display-completion-list-xemacs, idlwave-list-abbrevs)
(idlwave-display-completion-list-emacs, idlwave-list-load-path-shadows)
(idlwave-completion-fontify-classes, idlwave-display-calling-sequence):
* progmodes/idlw-shell.el (idlwave-shell-examine-display-clear)
(idlwave-shell-filter, idlwave-shell-examine-highlight)
(idlwave-shell-sentinel, idlwave-shell-filter-directory)
(idlwave-shell-display-line, idlwave-shell-set-bp-in-module)
(idlwave-shell-examine-display, idlwave-shell-run-region)
(idlwave-shell-filter-bp, idlwave-shell-save-and-action)
(idlwave-shell-sources-filter, idlwave-shell-goto-next-error):
* progmodes/idlw-help.el (idlwave-help-get-special-help)
(idlwave-help-get-help-buffer):
* progmodes/gud.el (gud-basic-call, gud-find-class)
(gud-tooltip-activate-mouse-motions-if-enabled):
* progmodes/gdb-mi.el (gdb-mouse-toggle-breakpoint-fringe):
* progmodes/ebrowse.el (ebrowse-member-table, ebrowse-save-tree-as)
(ebrowse-view-exit-fn, ebrowse-tags-list-members-in-file)
(ebrowse-tags-next-file):
* progmodes/ebnf2ps.el (ebnf-generate-eps, ebnf-generate-eps)
(ebnf-eps-production-list, ebnf-begin-file, ebnf-log)
(ebnf-eps-finish-and-write):
* progmodes/cpp.el (cpp-edit-save):
* progmodes/cperl-mode.el (cperl-pod-to-manpage):
* progmodes/cc-defs.el (c-emacs-features):
* progmodes/antlr-mode.el (antlr-invalidate-context-cache)
(antlr-directory-dependencies):
* progmodes/ada-xref.el (ada-gnat-parse-gpr, ada-get-ali-file-name)
(ada-run-application, ada-find-in-src-path, ada-goto-parent)
(ada-find-any-references, ada-make-filename-from-adaname)
(ada-make-body-gnatstub):
* obsolete/rnews.el (news-list-news-groups):
* obsolete/resume.el (resume-suspend-hook,resume-write-buffer-to-file):
* obsolete/iso-acc.el (iso-acc-minibuf-setup):
* net/rcirc.el (rcirc-debug):
* net/newst-treeview.el (newsticker--treeview-list-add-item)
(newsticker--treeview-list-clear, newsticker-treeview-browse-url)
(newsticker--treeview-list-update-faces, newsticker-treeview-save)
(newsticker--treeview-item-show-text, newsticker--treeview-item-show)
(newsticker--treeview-tree-update-tag,newsticker--treeview-buffer-init)
(newsticker-treeview-show-item, newsticker--treeview-unfold-node)
(newsticker--treeview-list-clear-highlight)
(newsticker--treeview-list-update-highlight)
(newsticker--treeview-list-highlight-start)
(newsticker--treeview-tree-update-highlight)
(newsticker--treeview-get-selected-item)
(newsticker-treeview-mark-list-items-old)
(newsticker--treeview-set-current-node):
* net/newst-plainview.el (newsticker--buffer-set-uptodate):
* net/newst-backend.el (newsticker--get-news-by-funcall)
(newsticker--get-news-by-wget, newsticker--image-get)
(newsticker--image-sentinel):
* net/mairix.el (mairix-rmail-fetch-field, mairix-gnus-fetch-field):
* net/eudcb-ph.el (eudc-ph-do-request, eudc-ph-open-session):
(eudc-ph-close-session):
* net/eudc.el (eudc-save-options):
* language/thai-word.el (thai-update-word-table):
* language/japan-util.el (japanese-string-conversion):
* international/titdic-cnv.el (tsang-quick-converter)
(ziranma-converter, ctlau-converter):
* international/mule-cmds.el (describe-language-environment):
* international/ja-dic-cnv.el (skkdic-convert-okuri-ari)
(skkdic-convert-postfix, skkdic-convert-prefix):
(skkdic-convert-okuri-nasi, skkdic-convert):
* emacs-lisp/re-builder.el (reb-update-overlays):
* emacs-lisp/pp.el (pp-to-string, pp-display-expression):
* emacs-lisp/gulp.el (gulp-send-requests):
* emacs-lisp/find-gc.el (trace-call-tree):
* emacs-lisp/eieio-opt.el (eieio-browse, eieio-describe-class)
(eieio-describe-generic):
* emacs-lisp/eieio-base.el (eieio-persistent-read):
* emacs-lisp/edebug.el (edebug-outside-excursion):
* emacs-lisp/debug.el (debugger-make-xrefs):
* emacs-lisp/cust-print.el (custom-prin1-to-string):
* emacs-lisp/chart.el (chart-new-buffer):
* emacs-lisp/authors.el (authors-scan-el, authors-scan-change-log):
Use with-current-buffer.
* textmodes/artist.el (artist-system): Don't call
copy-sequence on a fresh string.
* progmodes/idlw-shell.el (easymenu setup): Use dolist.
2009-10-31 02:38:34 +00:00
|
|
|
|
(with-current-buffer buffer
|
1997-01-21 00:35:48 +00:00
|
|
|
|
(comint-mode)
|
|
|
|
|
(inferior-octave-startup)
|
|
|
|
|
(inferior-octave-mode)))
|
|
|
|
|
(if (not arg)
|
|
|
|
|
(pop-to-buffer buffer))))
|
|
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
|
(defalias 'run-octave 'inferior-octave)
|
|
|
|
|
|
|
|
|
|
(defun inferior-octave-startup ()
|
|
|
|
|
"Start an inferior Octave process."
|
|
|
|
|
(let ((proc (comint-exec-1
|
|
|
|
|
(substring inferior-octave-buffer 1 -1)
|
|
|
|
|
inferior-octave-buffer
|
|
|
|
|
inferior-octave-program
|
1999-09-14 16:57:40 +00:00
|
|
|
|
(append (list "-i" "--no-line-editing")
|
|
|
|
|
inferior-octave-startup-args))))
|
1997-01-21 00:35:48 +00:00
|
|
|
|
(set-process-filter proc 'inferior-octave-output-digest)
|
|
|
|
|
(setq comint-ptyp process-connection-type
|
|
|
|
|
inferior-octave-process proc
|
|
|
|
|
inferior-octave-output-list nil
|
|
|
|
|
inferior-octave-output-string nil
|
|
|
|
|
inferior-octave-receive-in-progress t)
|
|
|
|
|
|
|
|
|
|
;; This may look complicated ... However, we need to make sure that
|
|
|
|
|
;; we additional startup code only AFTER Octave is ready (otherwise,
|
|
|
|
|
;; output may be mixed up). Hence, we need to digest the Octave
|
|
|
|
|
;; output to see when it issues a prompt.
|
|
|
|
|
(while inferior-octave-receive-in-progress
|
|
|
|
|
(accept-process-output inferior-octave-process))
|
|
|
|
|
(goto-char (point-max))
|
|
|
|
|
(set-marker (process-mark proc) (point))
|
|
|
|
|
(insert-before-markers
|
|
|
|
|
(concat
|
|
|
|
|
(if (not (bobp)) "\n")
|
|
|
|
|
(if inferior-octave-output-list
|
|
|
|
|
(concat (mapconcat
|
|
|
|
|
'identity inferior-octave-output-list "\n")
|
|
|
|
|
"\n"))))
|
2005-11-26 10:51:22 +00:00
|
|
|
|
|
2006-10-27 14:39:43 +00:00
|
|
|
|
;; 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)))
|
|
|
|
|
|
2005-11-26 10:51:22 +00:00
|
|
|
|
;; An empty secondary prompt, as e.g. obtained by '--braindead',
|
|
|
|
|
;; means trouble.
|
|
|
|
|
(inferior-octave-send-list-and-digest (list "PS2\n"))
|
2006-10-27 14:39:43 +00:00
|
|
|
|
(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"))))
|
2005-11-26 10:51:22 +00:00
|
|
|
|
|
1997-01-21 00:35:48 +00:00
|
|
|
|
;; O.k., now we are ready for the Inferior Octave startup commands.
|
|
|
|
|
(let* (commands
|
|
|
|
|
(program (file-name-nondirectory inferior-octave-program))
|
|
|
|
|
(file (or inferior-octave-startup-file
|
|
|
|
|
(concat "~/.emacs-" program))))
|
|
|
|
|
(setq commands
|
2006-10-27 14:39:43 +00:00
|
|
|
|
(list "more off;\n"
|
1997-01-21 00:35:48 +00:00
|
|
|
|
(if (not (string-equal
|
2003-02-04 13:24:35 +00:00
|
|
|
|
inferior-octave-output-string ">> "))
|
2006-10-27 14:39:43 +00:00
|
|
|
|
(if inferior-octave-has-built-in-variables
|
|
|
|
|
"PS1=\"\\\\s> \";\n"
|
|
|
|
|
"PS1 (\"\\\\s> \");\n"))
|
1997-01-21 00:35:48 +00:00
|
|
|
|
(if (file-exists-p file)
|
|
|
|
|
(format "source (\"%s\");\n" file))))
|
|
|
|
|
(inferior-octave-send-list-and-digest commands))
|
|
|
|
|
(insert-before-markers
|
|
|
|
|
(concat
|
|
|
|
|
(if inferior-octave-output-list
|
|
|
|
|
(concat (mapconcat
|
|
|
|
|
'identity inferior-octave-output-list "\n")
|
|
|
|
|
"\n"))
|
|
|
|
|
inferior-octave-output-string))
|
|
|
|
|
;; Next, we check whether Octave supports `completion_matches' ...
|
|
|
|
|
(inferior-octave-send-list-and-digest
|
|
|
|
|
(list "exist \"completion_matches\"\n"))
|
|
|
|
|
(setq inferior-octave-complete-impossible
|
|
|
|
|
(not (string-match "5$" (car inferior-octave-output-list))))
|
|
|
|
|
|
|
|
|
|
;; And finally, everything is back to normal.
|
|
|
|
|
(set-process-filter proc 'inferior-octave-output-filter)
|
2005-09-10 15:05:44 +00:00
|
|
|
|
(run-hooks 'inferior-octave-startup-hook)
|
|
|
|
|
(run-hooks 'inferior-octave-startup-hook)
|
|
|
|
|
;; Just in case, to be sure a cd in the startup file
|
|
|
|
|
;; won't have detrimental effects.
|
|
|
|
|
(inferior-octave-resync-dirs)))
|
1997-01-21 00:35:48 +00:00
|
|
|
|
|
|
|
|
|
|
2011-04-25 13:29:31 -03:00
|
|
|
|
(defun inferior-octave-completion-at-point ()
|
|
|
|
|
"Return the data to complete the Octave symbol at point."
|
|
|
|
|
(let* ((end (point))
|
|
|
|
|
(start
|
|
|
|
|
(save-excursion
|
|
|
|
|
(skip-syntax-backward "w_" (comint-line-beginning-position))
|
|
|
|
|
(point))))
|
Use completion-at-point rather than completion-in-region.
* lisp/wid-edit.el: Use lexical scoping and move towards completion-at-point.
(widget-complete): Use new :completion-function property.
(widget-completions-at-point): New function.
(default): Use :completion-function instead of :complete.
(widget-default-completions): Rename from widget-default-complete, rewrite.
(widget-string-complete, widget-file-complete, widget-color-complete):
Remove functions.
(file, symbol, function, variable, coding-system, color):
* lisp/international/mule-cmds.el (default-input-method, charset)
(language-info-custom-alist):
* lisp/cus-edit.el (face): Use new property :completions.
* lisp/progmodes/pascal.el (pascal-completions-at-point): New function.
(pascal-mode): Use it.
(pascal-mode-map): Use completion-at-point.
(pascal-toggle-completions): Make obsolete.
(pascal-complete-word, pascal-show-completions):
* lisp/progmodes/octave-mod.el (octave-complete-symbol):
Redefine as obsolete alias.
* lisp/progmodes/octave-inf.el (inferior-octave-completion-at-point):
Signal absence of completion info for old Octave,
(inferior-octave-complete): Redefine as obsolete alias.
* lisp/progmodes/meta-mode.el: Use lexical-binding and completion-at-point.
(meta-completions-at-point): Rename from meta-complete-symbol and
adapt it for use on completion-at-point-functions.
(meta-common-mode): Use it.
(meta-looking-at-backward, meta-match-buffer): Remove.
(meta-complete-symbol): Redefine as obsolete alias.
(meta-common-mode-map): Use completion-at-point.
* lisp/progmodes/make-mode.el: Use lexical-binding and completion-at-point.
(makefile-mode-map): Use completion-at-point.
(makefile-completions-at-point): Rename from makefile-complete and
adapt it for use on completion-at-point-functions.
(makefile-mode): Use it.
(makefile-complete): Redefine as obsolete alias.
2011-06-20 12:02:31 -04:00
|
|
|
|
(cond ((eq start end) nil)
|
|
|
|
|
(inferior-octave-complete-impossible
|
|
|
|
|
(message (concat
|
|
|
|
|
"Your Octave does not have `completion_matches'. "
|
|
|
|
|
"Please upgrade to version 2.X."))
|
|
|
|
|
nil)
|
2011-04-25 13:29:31 -03:00
|
|
|
|
(t
|
|
|
|
|
(list
|
|
|
|
|
start end
|
|
|
|
|
(completion-table-dynamic
|
|
|
|
|
(lambda (command)
|
|
|
|
|
(inferior-octave-send-list-and-digest
|
|
|
|
|
(list (concat "completion_matches (\"" command "\");\n")))
|
|
|
|
|
(sort (delete-dups inferior-octave-output-list)
|
|
|
|
|
'string-lessp))))))))
|
|
|
|
|
|
Use completion-at-point rather than completion-in-region.
* lisp/wid-edit.el: Use lexical scoping and move towards completion-at-point.
(widget-complete): Use new :completion-function property.
(widget-completions-at-point): New function.
(default): Use :completion-function instead of :complete.
(widget-default-completions): Rename from widget-default-complete, rewrite.
(widget-string-complete, widget-file-complete, widget-color-complete):
Remove functions.
(file, symbol, function, variable, coding-system, color):
* lisp/international/mule-cmds.el (default-input-method, charset)
(language-info-custom-alist):
* lisp/cus-edit.el (face): Use new property :completions.
* lisp/progmodes/pascal.el (pascal-completions-at-point): New function.
(pascal-mode): Use it.
(pascal-mode-map): Use completion-at-point.
(pascal-toggle-completions): Make obsolete.
(pascal-complete-word, pascal-show-completions):
* lisp/progmodes/octave-mod.el (octave-complete-symbol):
Redefine as obsolete alias.
* lisp/progmodes/octave-inf.el (inferior-octave-completion-at-point):
Signal absence of completion info for old Octave,
(inferior-octave-complete): Redefine as obsolete alias.
* lisp/progmodes/meta-mode.el: Use lexical-binding and completion-at-point.
(meta-completions-at-point): Rename from meta-complete-symbol and
adapt it for use on completion-at-point-functions.
(meta-common-mode): Use it.
(meta-looking-at-backward, meta-match-buffer): Remove.
(meta-complete-symbol): Redefine as obsolete alias.
(meta-common-mode-map): Use completion-at-point.
* lisp/progmodes/make-mode.el: Use lexical-binding and completion-at-point.
(makefile-mode-map): Use completion-at-point.
(makefile-completions-at-point): Rename from makefile-complete and
adapt it for use on completion-at-point-functions.
(makefile-mode): Use it.
(makefile-complete): Redefine as obsolete alias.
2011-06-20 12:02:31 -04:00
|
|
|
|
(define-obsolete-function-alias 'inferior-octave-complete
|
|
|
|
|
'completion-at-point "24.1")
|
1997-01-21 00:35:48 +00:00
|
|
|
|
|
|
|
|
|
(defun inferior-octave-dynamic-list-input-ring ()
|
2006-07-07 14:40:35 +00:00
|
|
|
|
"List the buffer's input history in a help buffer."
|
1997-01-21 00:35:48 +00:00
|
|
|
|
;; We cannot use `comint-dynamic-list-input-ring', because it replaces
|
|
|
|
|
;; "completion" by "history reference" ...
|
|
|
|
|
(interactive)
|
|
|
|
|
(if (or (not (ring-p comint-input-ring))
|
|
|
|
|
(ring-empty-p comint-input-ring))
|
|
|
|
|
(message "No history")
|
|
|
|
|
(let ((history nil)
|
|
|
|
|
(history-buffer " *Input History*")
|
|
|
|
|
(index (1- (ring-length comint-input-ring)))
|
|
|
|
|
(conf (current-window-configuration)))
|
|
|
|
|
;; We have to build up a list ourselves from the ring vector.
|
|
|
|
|
(while (>= index 0)
|
|
|
|
|
(setq history (cons (ring-ref comint-input-ring index) history)
|
|
|
|
|
index (1- index)))
|
|
|
|
|
;; Change "completion" to "history reference"
|
|
|
|
|
;; to make the display accurate.
|
|
|
|
|
(with-output-to-temp-buffer history-buffer
|
|
|
|
|
(display-completion-list history)
|
|
|
|
|
(set-buffer history-buffer))
|
|
|
|
|
(message "Hit space to flush")
|
|
|
|
|
(let ((ch (read-event)))
|
|
|
|
|
(if (eq ch ?\ )
|
|
|
|
|
(set-window-configuration conf)
|
|
|
|
|
(setq unread-command-events (list ch)))))))
|
|
|
|
|
|
|
|
|
|
(defun inferior-octave-strip-ctrl-g (string)
|
|
|
|
|
"Strip leading `^G' character.
|
|
|
|
|
If STRING starts with a `^G', ring the bell and strip it."
|
|
|
|
|
(if (string-match "^\a" string)
|
|
|
|
|
(progn
|
|
|
|
|
(ding)
|
|
|
|
|
(setq string (substring string 1))))
|
|
|
|
|
string)
|
|
|
|
|
|
|
|
|
|
(defun inferior-octave-output-filter (proc string)
|
|
|
|
|
"Standard output filter for the inferior Octave process.
|
|
|
|
|
Ring Emacs bell if process output starts with an ASCII bell, and pass
|
|
|
|
|
the rest to `comint-output-filter'."
|
|
|
|
|
(comint-output-filter proc (inferior-octave-strip-ctrl-g string)))
|
|
|
|
|
|
2011-04-22 20:44:26 +02:00
|
|
|
|
(defun inferior-octave-output-digest (_proc string)
|
1997-01-21 00:35:48 +00:00
|
|
|
|
"Special output filter for the inferior Octave process.
|
|
|
|
|
Save all output between newlines into `inferior-octave-output-list', and
|
|
|
|
|
the rest to `inferior-octave-output-string'."
|
|
|
|
|
(setq string (concat inferior-octave-output-string string))
|
|
|
|
|
(while (string-match "\n" string)
|
|
|
|
|
(setq inferior-octave-output-list
|
|
|
|
|
(append inferior-octave-output-list
|
|
|
|
|
(list (substring string 0 (match-beginning 0))))
|
|
|
|
|
string (substring string (match-end 0))))
|
|
|
|
|
(if (string-match inferior-octave-prompt string)
|
|
|
|
|
(setq inferior-octave-receive-in-progress nil))
|
|
|
|
|
(setq inferior-octave-output-string string))
|
|
|
|
|
|
|
|
|
|
(defun inferior-octave-send-list-and-digest (list)
|
|
|
|
|
"Send LIST to the inferior Octave process and digest the output.
|
|
|
|
|
The elements of LIST have to be strings and are sent one by one. All
|
|
|
|
|
output is passed to the filter `inferior-octave-output-digest'."
|
|
|
|
|
(let* ((proc inferior-octave-process)
|
|
|
|
|
(filter (process-filter proc))
|
|
|
|
|
string)
|
|
|
|
|
(set-process-filter proc 'inferior-octave-output-digest)
|
|
|
|
|
(setq inferior-octave-output-list nil)
|
|
|
|
|
(unwind-protect
|
|
|
|
|
(while (setq string (car list))
|
|
|
|
|
(setq inferior-octave-output-string nil
|
|
|
|
|
inferior-octave-receive-in-progress t)
|
|
|
|
|
(comint-send-string proc string)
|
|
|
|
|
(while inferior-octave-receive-in-progress
|
|
|
|
|
(accept-process-output proc))
|
|
|
|
|
(setq list (cdr list)))
|
|
|
|
|
(set-process-filter proc filter))))
|
|
|
|
|
|
|
|
|
|
(defun inferior-octave-directory-tracker (string)
|
|
|
|
|
"Tracks `cd' commands issued to the inferior Octave process.
|
|
|
|
|
Use \\[inferior-octave-resync-dirs] to resync if Emacs gets confused."
|
1999-07-07 20:49:12 +00:00
|
|
|
|
(cond
|
|
|
|
|
((string-match "^[ \t]*cd[ \t;]*$" string)
|
|
|
|
|
(cd "~"))
|
|
|
|
|
((string-match "^[ \t]*cd[ \t]+\\([^ \t\n;]*\\)[ \t\n;]*" string)
|
|
|
|
|
(cd (substring string (match-beginning 1) (match-end 1))))))
|
1997-01-21 00:35:48 +00:00
|
|
|
|
|
|
|
|
|
(defun inferior-octave-resync-dirs ()
|
|
|
|
|
"Resync the buffer's idea of the current directory.
|
|
|
|
|
This command queries the inferior Octave process about its current
|
|
|
|
|
directory and makes this the current buffer's default directory."
|
|
|
|
|
(interactive)
|
2006-10-27 14:39:43 +00:00
|
|
|
|
(inferior-octave-send-list-and-digest '("disp (pwd ())\n"))
|
1997-01-21 00:35:48 +00:00
|
|
|
|
(cd (car inferior-octave-output-list)))
|
|
|
|
|
|
1997-03-12 00:34:25 +00:00
|
|
|
|
;;; provide ourself
|
|
|
|
|
|
|
|
|
|
(provide 'octave-inf)
|
|
|
|
|
|
1997-01-21 00:40:35 +00:00
|
|
|
|
;;; octave-inf.el ends here
|