Mercurial > emacs
annotate lisp/progmodes/octave-mod.el @ 54457:ba16dd8bb815
*** empty log message ***
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Sun, 21 Mar 2004 14:31:42 +0000 |
parents | 069cb76731fd |
children | f2892faa87d4 |
rev | line source |
---|---|
17517 | 1 ;;; octave-mod.el --- editing Octave source files under Emacs |
16901 | 2 |
52930
069cb76731fd
(octave-comment-start): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52401
diff
changeset
|
3 ;; Copyright (C) 1997, 2003 Free Software Foundation, Inc. |
16901 | 4 |
5 ;; Author: Kurt Hornik <Kurt.Hornik@ci.tuwien.ac.at> | |
6 ;; Author: John Eaton <jwe@bevo.che.wisc.edu> | |
7 ;; Maintainer: Kurt Hornik <Kurt.Hornik@ci.tuwien.ac.at> | |
8 ;; Keywords: languages | |
9 | |
10 ;; This file is part of GNU Emacs. | |
11 | |
12 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
13 ;; it under the terms of the GNU General Public License as published by | |
14 ;; the Free Software Foundation; either version 2, or (at your option) | |
15 ;; any later version. | |
16 | |
17 ;; GNU Emacs is distributed in the hope that it will be useful, | |
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
20 ;; GNU General Public License for more details. | |
21 | |
22 ;; You should have received a copy of the GNU General Public License | |
23 ;; along with GNU Emacs; see the file COPYING. If not, write to the | |
24 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
25 ;; Boston, MA 02111-1307, USA. | |
26 | |
27 ;;; Commentary: | |
28 | |
16905
a93836c8b52b
Merge in octave.el; don't require octave.el.
Richard M. Stallman <rms@gnu.org>
parents:
16902
diff
changeset
|
29 ;; This package provides Emacs support for Octave. |
a93836c8b52b
Merge in octave.el; don't require octave.el.
Richard M. Stallman <rms@gnu.org>
parents:
16902
diff
changeset
|
30 ;; It defines Octave mode, a major mode for editing |
a93836c8b52b
Merge in octave.el; don't require octave.el.
Richard M. Stallman <rms@gnu.org>
parents:
16902
diff
changeset
|
31 ;; Octave code. |
a93836c8b52b
Merge in octave.el; don't require octave.el.
Richard M. Stallman <rms@gnu.org>
parents:
16902
diff
changeset
|
32 |
a93836c8b52b
Merge in octave.el; don't require octave.el.
Richard M. Stallman <rms@gnu.org>
parents:
16902
diff
changeset
|
33 ;; The file octave-hlp.el provides `octave-help', a facility for looking up |
a93836c8b52b
Merge in octave.el; don't require octave.el.
Richard M. Stallman <rms@gnu.org>
parents:
16902
diff
changeset
|
34 ;; documentation on a symbol in the Octave info files. |
16901 | 35 |
16905
a93836c8b52b
Merge in octave.el; don't require octave.el.
Richard M. Stallman <rms@gnu.org>
parents:
16902
diff
changeset
|
36 ;; The file octave-inf.el contains code for interacting with an inferior |
a93836c8b52b
Merge in octave.el; don't require octave.el.
Richard M. Stallman <rms@gnu.org>
parents:
16902
diff
changeset
|
37 ;; Octave process using comint. |
16901 | 38 |
16905
a93836c8b52b
Merge in octave.el; don't require octave.el.
Richard M. Stallman <rms@gnu.org>
parents:
16902
diff
changeset
|
39 ;; See the documentation of `octave-mode', `octave-help' and |
a93836c8b52b
Merge in octave.el; don't require octave.el.
Richard M. Stallman <rms@gnu.org>
parents:
16902
diff
changeset
|
40 ;; `run-octave' for further information on usage and customization. |
a93836c8b52b
Merge in octave.el; don't require octave.el.
Richard M. Stallman <rms@gnu.org>
parents:
16902
diff
changeset
|
41 |
a93836c8b52b
Merge in octave.el; don't require octave.el.
Richard M. Stallman <rms@gnu.org>
parents:
16902
diff
changeset
|
42 ;;; Code: |
26157
313a03652df3
Added (require 'custom) and deleted :version line from
Stephen Eglen <stephen@gnu.org>
parents:
25277
diff
changeset
|
43 (require 'custom) |
16901 | 44 |
20781 | 45 (defgroup octave nil |
46 "Major mode for editing Octave source files." | |
47 :group 'languages) | |
48 | |
17533
997e9c9b618b
(inferior-octave-output-list): Declare here
Richard M. Stallman <rms@gnu.org>
parents:
17517
diff
changeset
|
49 (defvar inferior-octave-output-list nil) |
997e9c9b618b
(inferior-octave-output-list): Declare here
Richard M. Stallman <rms@gnu.org>
parents:
17517
diff
changeset
|
50 (defvar inferior-octave-output-string nil) |
997e9c9b618b
(inferior-octave-output-list): Declare here
Richard M. Stallman <rms@gnu.org>
parents:
17517
diff
changeset
|
51 (defvar inferior-octave-receive-in-progress nil) |
997e9c9b618b
(inferior-octave-output-list): Declare here
Richard M. Stallman <rms@gnu.org>
parents:
17517
diff
changeset
|
52 |
16911
123d19079d9f
Delete explicit autoload calls.
Richard M. Stallman <rms@gnu.org>
parents:
16905
diff
changeset
|
53 (defconst octave-maintainer-address |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49334
diff
changeset
|
54 "Kurt Hornik <Kurt.Hornik@ci.tuwien.ac.at>, bug-gnu-emacs@gnu.org" |
16911
123d19079d9f
Delete explicit autoload calls.
Richard M. Stallman <rms@gnu.org>
parents:
16905
diff
changeset
|
55 "Current maintainer of the Emacs Octave package.") |
123d19079d9f
Delete explicit autoload calls.
Richard M. Stallman <rms@gnu.org>
parents:
16905
diff
changeset
|
56 |
123d19079d9f
Delete explicit autoload calls.
Richard M. Stallman <rms@gnu.org>
parents:
16905
diff
changeset
|
57 (defvar octave-abbrev-table nil |
123d19079d9f
Delete explicit autoload calls.
Richard M. Stallman <rms@gnu.org>
parents:
16905
diff
changeset
|
58 "Abbrev table for Octave's reserved words. |
42445
3dbc8d04a492
(octave-abbrev-table): Mark all the predefined abbrevs as "system" abbrevs.
Pavel Janík <Pavel@Janik.cz>
parents:
42205
diff
changeset
|
59 Used in `octave-mode' and inferior-octave-mode buffers. |
16911
123d19079d9f
Delete explicit autoload calls.
Richard M. Stallman <rms@gnu.org>
parents:
16905
diff
changeset
|
60 All Octave abbrevs start with a grave accent (`).") |
42445
3dbc8d04a492
(octave-abbrev-table): Mark all the predefined abbrevs as "system" abbrevs.
Pavel Janík <Pavel@Janik.cz>
parents:
42205
diff
changeset
|
61 (unless octave-abbrev-table |
16911
123d19079d9f
Delete explicit autoload calls.
Richard M. Stallman <rms@gnu.org>
parents:
16905
diff
changeset
|
62 (let ((ac abbrevs-changed)) |
123d19079d9f
Delete explicit autoload calls.
Richard M. Stallman <rms@gnu.org>
parents:
16905
diff
changeset
|
63 (define-abbrev-table 'octave-abbrev-table ()) |
42445
3dbc8d04a492
(octave-abbrev-table): Mark all the predefined abbrevs as "system" abbrevs.
Pavel Janík <Pavel@Janik.cz>
parents:
42205
diff
changeset
|
64 (define-abbrev octave-abbrev-table "`a" "all_va_args" nil 0 t) |
3dbc8d04a492
(octave-abbrev-table): Mark all the predefined abbrevs as "system" abbrevs.
Pavel Janík <Pavel@Janik.cz>
parents:
42205
diff
changeset
|
65 (define-abbrev octave-abbrev-table "`b" "break" nil 0 t) |
3dbc8d04a492
(octave-abbrev-table): Mark all the predefined abbrevs as "system" abbrevs.
Pavel Janík <Pavel@Janik.cz>
parents:
42205
diff
changeset
|
66 (define-abbrev octave-abbrev-table "`cs" "case" nil 0 t) |
3dbc8d04a492
(octave-abbrev-table): Mark all the predefined abbrevs as "system" abbrevs.
Pavel Janík <Pavel@Janik.cz>
parents:
42205
diff
changeset
|
67 (define-abbrev octave-abbrev-table "`ca" "catch" nil 0 t) |
3dbc8d04a492
(octave-abbrev-table): Mark all the predefined abbrevs as "system" abbrevs.
Pavel Janík <Pavel@Janik.cz>
parents:
42205
diff
changeset
|
68 (define-abbrev octave-abbrev-table "`c" "continue" nil 0 t) |
3dbc8d04a492
(octave-abbrev-table): Mark all the predefined abbrevs as "system" abbrevs.
Pavel Janík <Pavel@Janik.cz>
parents:
42205
diff
changeset
|
69 (define-abbrev octave-abbrev-table "`el" "else" nil 0 t) |
3dbc8d04a492
(octave-abbrev-table): Mark all the predefined abbrevs as "system" abbrevs.
Pavel Janík <Pavel@Janik.cz>
parents:
42205
diff
changeset
|
70 (define-abbrev octave-abbrev-table "`eli" "elseif" nil 0 t) |
3dbc8d04a492
(octave-abbrev-table): Mark all the predefined abbrevs as "system" abbrevs.
Pavel Janík <Pavel@Janik.cz>
parents:
42205
diff
changeset
|
71 (define-abbrev octave-abbrev-table "`et" "end_try_catch" nil 0 t) |
3dbc8d04a492
(octave-abbrev-table): Mark all the predefined abbrevs as "system" abbrevs.
Pavel Janík <Pavel@Janik.cz>
parents:
42205
diff
changeset
|
72 (define-abbrev octave-abbrev-table "`eu" "end_unwind_protect" nil 0 t) |
3dbc8d04a492
(octave-abbrev-table): Mark all the predefined abbrevs as "system" abbrevs.
Pavel Janík <Pavel@Janik.cz>
parents:
42205
diff
changeset
|
73 (define-abbrev octave-abbrev-table "`ef" "endfor" nil 0 t) |
3dbc8d04a492
(octave-abbrev-table): Mark all the predefined abbrevs as "system" abbrevs.
Pavel Janík <Pavel@Janik.cz>
parents:
42205
diff
changeset
|
74 (define-abbrev octave-abbrev-table "`efu" "endfunction" nil 0 t) |
3dbc8d04a492
(octave-abbrev-table): Mark all the predefined abbrevs as "system" abbrevs.
Pavel Janík <Pavel@Janik.cz>
parents:
42205
diff
changeset
|
75 (define-abbrev octave-abbrev-table "`ei" "endif" nil 0 t) |
3dbc8d04a492
(octave-abbrev-table): Mark all the predefined abbrevs as "system" abbrevs.
Pavel Janík <Pavel@Janik.cz>
parents:
42205
diff
changeset
|
76 (define-abbrev octave-abbrev-table "`es" "endswitch" nil 0 t) |
3dbc8d04a492
(octave-abbrev-table): Mark all the predefined abbrevs as "system" abbrevs.
Pavel Janík <Pavel@Janik.cz>
parents:
42205
diff
changeset
|
77 (define-abbrev octave-abbrev-table "`ew" "endwhile" nil 0 t) |
3dbc8d04a492
(octave-abbrev-table): Mark all the predefined abbrevs as "system" abbrevs.
Pavel Janík <Pavel@Janik.cz>
parents:
42205
diff
changeset
|
78 (define-abbrev octave-abbrev-table "`f" "for" nil 0 t) |
3dbc8d04a492
(octave-abbrev-table): Mark all the predefined abbrevs as "system" abbrevs.
Pavel Janík <Pavel@Janik.cz>
parents:
42205
diff
changeset
|
79 (define-abbrev octave-abbrev-table "`fu" "function" nil 0 t) |
3dbc8d04a492
(octave-abbrev-table): Mark all the predefined abbrevs as "system" abbrevs.
Pavel Janík <Pavel@Janik.cz>
parents:
42205
diff
changeset
|
80 (define-abbrev octave-abbrev-table "`gl" "global" nil 0 t) |
3dbc8d04a492
(octave-abbrev-table): Mark all the predefined abbrevs as "system" abbrevs.
Pavel Janík <Pavel@Janik.cz>
parents:
42205
diff
changeset
|
81 (define-abbrev octave-abbrev-table "`gp" "gplot" nil 0 t) |
3dbc8d04a492
(octave-abbrev-table): Mark all the predefined abbrevs as "system" abbrevs.
Pavel Janík <Pavel@Janik.cz>
parents:
42205
diff
changeset
|
82 (define-abbrev octave-abbrev-table "`gs" "gsplot" nil 0 t) |
3dbc8d04a492
(octave-abbrev-table): Mark all the predefined abbrevs as "system" abbrevs.
Pavel Janík <Pavel@Janik.cz>
parents:
42205
diff
changeset
|
83 (define-abbrev octave-abbrev-table "`if" "if ()" nil 0 t) |
3dbc8d04a492
(octave-abbrev-table): Mark all the predefined abbrevs as "system" abbrevs.
Pavel Janík <Pavel@Janik.cz>
parents:
42205
diff
changeset
|
84 (define-abbrev octave-abbrev-table "`o" "otherwise" nil 0 t) |
3dbc8d04a492
(octave-abbrev-table): Mark all the predefined abbrevs as "system" abbrevs.
Pavel Janík <Pavel@Janik.cz>
parents:
42205
diff
changeset
|
85 (define-abbrev octave-abbrev-table "`rp" "replot" nil 0 t) |
3dbc8d04a492
(octave-abbrev-table): Mark all the predefined abbrevs as "system" abbrevs.
Pavel Janík <Pavel@Janik.cz>
parents:
42205
diff
changeset
|
86 (define-abbrev octave-abbrev-table "`r" "return" nil 0 t) |
3dbc8d04a492
(octave-abbrev-table): Mark all the predefined abbrevs as "system" abbrevs.
Pavel Janík <Pavel@Janik.cz>
parents:
42205
diff
changeset
|
87 (define-abbrev octave-abbrev-table "`s" "switch" nil 0 t) |
3dbc8d04a492
(octave-abbrev-table): Mark all the predefined abbrevs as "system" abbrevs.
Pavel Janík <Pavel@Janik.cz>
parents:
42205
diff
changeset
|
88 (define-abbrev octave-abbrev-table "`t" "try" nil 0 t) |
3dbc8d04a492
(octave-abbrev-table): Mark all the predefined abbrevs as "system" abbrevs.
Pavel Janík <Pavel@Janik.cz>
parents:
42205
diff
changeset
|
89 (define-abbrev octave-abbrev-table "`up" "unwind_protect" nil 0 t) |
3dbc8d04a492
(octave-abbrev-table): Mark all the predefined abbrevs as "system" abbrevs.
Pavel Janík <Pavel@Janik.cz>
parents:
42205
diff
changeset
|
90 (define-abbrev octave-abbrev-table "`upc" "unwind_protect_cleanup" nil 0 t) |
3dbc8d04a492
(octave-abbrev-table): Mark all the predefined abbrevs as "system" abbrevs.
Pavel Janík <Pavel@Janik.cz>
parents:
42205
diff
changeset
|
91 (define-abbrev octave-abbrev-table "`w" "while ()" nil 0 t) |
16911
123d19079d9f
Delete explicit autoload calls.
Richard M. Stallman <rms@gnu.org>
parents:
16905
diff
changeset
|
92 (setq abbrevs-changed ac))) |
123d19079d9f
Delete explicit autoload calls.
Richard M. Stallman <rms@gnu.org>
parents:
16905
diff
changeset
|
93 |
123d19079d9f
Delete explicit autoload calls.
Richard M. Stallman <rms@gnu.org>
parents:
16905
diff
changeset
|
94 (defvar octave-comment-char ?# |
123d19079d9f
Delete explicit autoload calls.
Richard M. Stallman <rms@gnu.org>
parents:
16905
diff
changeset
|
95 "Character to start an Octave comment.") |
123d19079d9f
Delete explicit autoload calls.
Richard M. Stallman <rms@gnu.org>
parents:
16905
diff
changeset
|
96 (defvar octave-comment-start |
52930
069cb76731fd
(octave-comment-start): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52401
diff
changeset
|
97 (string octave-comment-char ?\ ) |
16911
123d19079d9f
Delete explicit autoload calls.
Richard M. Stallman <rms@gnu.org>
parents:
16905
diff
changeset
|
98 "String to insert to start a new Octave in-line comment.") |
123d19079d9f
Delete explicit autoload calls.
Richard M. Stallman <rms@gnu.org>
parents:
16905
diff
changeset
|
99 (defvar octave-comment-start-skip "\\s<+\\s-*" |
123d19079d9f
Delete explicit autoload calls.
Richard M. Stallman <rms@gnu.org>
parents:
16905
diff
changeset
|
100 "Regexp to match the start of an Octave comment up to its body.") |
123d19079d9f
Delete explicit autoload calls.
Richard M. Stallman <rms@gnu.org>
parents:
16905
diff
changeset
|
101 |
123d19079d9f
Delete explicit autoload calls.
Richard M. Stallman <rms@gnu.org>
parents:
16905
diff
changeset
|
102 (defvar octave-begin-keywords |
17151
0663a5ce936c
(octave-abbrev-table): Add abbrevs for switch,
Karl Heuer <kwzh@gnu.org>
parents:
16911
diff
changeset
|
103 '("for" "function" "if" "switch" "try" "unwind_protect" "while")) |
16911
123d19079d9f
Delete explicit autoload calls.
Richard M. Stallman <rms@gnu.org>
parents:
16905
diff
changeset
|
104 (defvar octave-else-keywords |
17151
0663a5ce936c
(octave-abbrev-table): Add abbrevs for switch,
Karl Heuer <kwzh@gnu.org>
parents:
16911
diff
changeset
|
105 '("case" "catch" "else" "elseif" "otherwise" "unwind_protect_cleanup")) |
16911
123d19079d9f
Delete explicit autoload calls.
Richard M. Stallman <rms@gnu.org>
parents:
16905
diff
changeset
|
106 (defvar octave-end-keywords |
17151
0663a5ce936c
(octave-abbrev-table): Add abbrevs for switch,
Karl Heuer <kwzh@gnu.org>
parents:
16911
diff
changeset
|
107 '("end" "endfor" "endfunction" "endif" "endswitch" "end_try_catch" |
16911
123d19079d9f
Delete explicit autoload calls.
Richard M. Stallman <rms@gnu.org>
parents:
16905
diff
changeset
|
108 "end_unwind_protect" "endwhile")) |
123d19079d9f
Delete explicit autoload calls.
Richard M. Stallman <rms@gnu.org>
parents:
16905
diff
changeset
|
109 |
123d19079d9f
Delete explicit autoload calls.
Richard M. Stallman <rms@gnu.org>
parents:
16905
diff
changeset
|
110 (defvar octave-reserved-words |
17151
0663a5ce936c
(octave-abbrev-table): Add abbrevs for switch,
Karl Heuer <kwzh@gnu.org>
parents:
16911
diff
changeset
|
111 (append octave-begin-keywords |
0663a5ce936c
(octave-abbrev-table): Add abbrevs for switch,
Karl Heuer <kwzh@gnu.org>
parents:
16911
diff
changeset
|
112 octave-else-keywords |
0663a5ce936c
(octave-abbrev-table): Add abbrevs for switch,
Karl Heuer <kwzh@gnu.org>
parents:
16911
diff
changeset
|
113 octave-end-keywords |
16911
123d19079d9f
Delete explicit autoload calls.
Richard M. Stallman <rms@gnu.org>
parents:
16905
diff
changeset
|
114 '("all_va_args" "break" "continue" "global" "gplot" "gsplot" |
123d19079d9f
Delete explicit autoload calls.
Richard M. Stallman <rms@gnu.org>
parents:
16905
diff
changeset
|
115 "replot" "return")) |
123d19079d9f
Delete explicit autoload calls.
Richard M. Stallman <rms@gnu.org>
parents:
16905
diff
changeset
|
116 "Reserved words in Octave.") |
123d19079d9f
Delete explicit autoload calls.
Richard M. Stallman <rms@gnu.org>
parents:
16905
diff
changeset
|
117 |
123d19079d9f
Delete explicit autoload calls.
Richard M. Stallman <rms@gnu.org>
parents:
16905
diff
changeset
|
118 (defvar octave-text-functions |
123d19079d9f
Delete explicit autoload calls.
Richard M. Stallman <rms@gnu.org>
parents:
16905
diff
changeset
|
119 '("casesen" "cd" "chdir" "clear" "diary" "dir" "document" "echo" |
123d19079d9f
Delete explicit autoload calls.
Richard M. Stallman <rms@gnu.org>
parents:
16905
diff
changeset
|
120 "edit_history" "format" "gset" "gshow" "help" "history" "hold" |
123d19079d9f
Delete explicit autoload calls.
Richard M. Stallman <rms@gnu.org>
parents:
16905
diff
changeset
|
121 "load" "ls" "more" "run_history" "save" "set" "show" "type" |
123d19079d9f
Delete explicit autoload calls.
Richard M. Stallman <rms@gnu.org>
parents:
16905
diff
changeset
|
122 "which" "who" "whos") |
123d19079d9f
Delete explicit autoload calls.
Richard M. Stallman <rms@gnu.org>
parents:
16905
diff
changeset
|
123 "Text functions in Octave (these names are also reserved).") |
123d19079d9f
Delete explicit autoload calls.
Richard M. Stallman <rms@gnu.org>
parents:
16905
diff
changeset
|
124 |
123d19079d9f
Delete explicit autoload calls.
Richard M. Stallman <rms@gnu.org>
parents:
16905
diff
changeset
|
125 (defvar octave-variables |
123d19079d9f
Delete explicit autoload calls.
Richard M. Stallman <rms@gnu.org>
parents:
16905
diff
changeset
|
126 '("EDITOR" "EXEC_PATH" "F_DUPFD" "F_GETFD" "F_GETFL" "F_SETFD" |
123d19079d9f
Delete explicit autoload calls.
Richard M. Stallman <rms@gnu.org>
parents:
16905
diff
changeset
|
127 "F_SETFL" "I" "IMAGEPATH" "INFO_FILE" "INFO_PROGRAM" "Inf" "J" |
123d19079d9f
Delete explicit autoload calls.
Richard M. Stallman <rms@gnu.org>
parents:
16905
diff
changeset
|
128 "LOADPATH" "NaN" "OCTAVE_VERSION" "O_APPEND" "O_CREAT" "O_EXCL" |
123d19079d9f
Delete explicit autoload calls.
Richard M. Stallman <rms@gnu.org>
parents:
16905
diff
changeset
|
129 "O_NONBLOCK" "O_RDONLY" "O_RDWR" "O_TRUNC" "O_WRONLY" "PAGER" "PS1" |
123d19079d9f
Delete explicit autoload calls.
Richard M. Stallman <rms@gnu.org>
parents:
16905
diff
changeset
|
130 "PS2" "PS4" "PWD" "SEEK_CUR" "SEEK_END" "SEEK_SET" "__F_DUPFD__" |
123d19079d9f
Delete explicit autoload calls.
Richard M. Stallman <rms@gnu.org>
parents:
16905
diff
changeset
|
131 "__F_GETFD__" "__F_GETFL__" "__F_SETFD__" "__F_SETFL__" "__I__" |
123d19079d9f
Delete explicit autoload calls.
Richard M. Stallman <rms@gnu.org>
parents:
16905
diff
changeset
|
132 "__Inf__" "__J__" "__NaN__" "__OCTAVE_VERSION__" "__O_APPEND__" |
123d19079d9f
Delete explicit autoload calls.
Richard M. Stallman <rms@gnu.org>
parents:
16905
diff
changeset
|
133 "__O_CREAT__" "__O_EXCL__" "__O_NONBLOCK__" "__O_RDONLY__" |
123d19079d9f
Delete explicit autoload calls.
Richard M. Stallman <rms@gnu.org>
parents:
16905
diff
changeset
|
134 "__O_RDWR__" "__O_TRUNC__" "__O_WRONLY__" "__PWD__" "__SEEK_CUR__" |
123d19079d9f
Delete explicit autoload calls.
Richard M. Stallman <rms@gnu.org>
parents:
16905
diff
changeset
|
135 "__SEEK_END__" "__SEEK_SET__" "__argv__" "__e__" "__eps__" |
123d19079d9f
Delete explicit autoload calls.
Richard M. Stallman <rms@gnu.org>
parents:
16905
diff
changeset
|
136 "__error_text__" "__i__" "__inf__" "__j__" "__nan__" "__pi__" |
123d19079d9f
Delete explicit autoload calls.
Richard M. Stallman <rms@gnu.org>
parents:
16905
diff
changeset
|
137 "__program_invocation_name__" "__program_name__" "__realmax__" |
123d19079d9f
Delete explicit autoload calls.
Richard M. Stallman <rms@gnu.org>
parents:
16905
diff
changeset
|
138 "__realmin__" "__stderr__" "__stdin__" "__stdout__" "ans" "argv" |
123d19079d9f
Delete explicit autoload calls.
Richard M. Stallman <rms@gnu.org>
parents:
16905
diff
changeset
|
139 "automatic_replot" "beep_on_error" "completion_append_char" |
123d19079d9f
Delete explicit autoload calls.
Richard M. Stallman <rms@gnu.org>
parents:
16905
diff
changeset
|
140 "default_return_value" "default_save_format" |
123d19079d9f
Delete explicit autoload calls.
Richard M. Stallman <rms@gnu.org>
parents:
16905
diff
changeset
|
141 "define_all_return_values" "do_fortran_indexing" "e" |
123d19079d9f
Delete explicit autoload calls.
Richard M. Stallman <rms@gnu.org>
parents:
16905
diff
changeset
|
142 "echo_executing_commands" "empty_list_elements_ok" "eps" |
123d19079d9f
Delete explicit autoload calls.
Richard M. Stallman <rms@gnu.org>
parents:
16905
diff
changeset
|
143 "error_text" "gnuplot_binary" "gnuplot_has_multiplot" "history_file" |
123d19079d9f
Delete explicit autoload calls.
Richard M. Stallman <rms@gnu.org>
parents:
16905
diff
changeset
|
144 "history_size" "ignore_function_time_stamp" "implicit_str_to_num_ok" |
123d19079d9f
Delete explicit autoload calls.
Richard M. Stallman <rms@gnu.org>
parents:
16905
diff
changeset
|
145 "inf" "nan" "nargin" "ok_to_lose_imaginary_part" |
123d19079d9f
Delete explicit autoload calls.
Richard M. Stallman <rms@gnu.org>
parents:
16905
diff
changeset
|
146 "output_max_field_width" "output_precision" |
123d19079d9f
Delete explicit autoload calls.
Richard M. Stallman <rms@gnu.org>
parents:
16905
diff
changeset
|
147 "page_output_immediately" "page_screen_output" "pi" |
123d19079d9f
Delete explicit autoload calls.
Richard M. Stallman <rms@gnu.org>
parents:
16905
diff
changeset
|
148 "prefer_column_vectors" "prefer_zero_one_indexing" |
123d19079d9f
Delete explicit autoload calls.
Richard M. Stallman <rms@gnu.org>
parents:
16905
diff
changeset
|
149 "print_answer_id_name" "print_empty_dimensions" |
123d19079d9f
Delete explicit autoload calls.
Richard M. Stallman <rms@gnu.org>
parents:
16905
diff
changeset
|
150 "program_invocation_name" "program_name" "propagate_empty_matrices" |
123d19079d9f
Delete explicit autoload calls.
Richard M. Stallman <rms@gnu.org>
parents:
16905
diff
changeset
|
151 "realmax" "realmin" "resize_on_range_error" |
123d19079d9f
Delete explicit autoload calls.
Richard M. Stallman <rms@gnu.org>
parents:
16905
diff
changeset
|
152 "return_last_computed_value" "save_precision" "saving_history" |
123d19079d9f
Delete explicit autoload calls.
Richard M. Stallman <rms@gnu.org>
parents:
16905
diff
changeset
|
153 "silent_functions" "split_long_rows" "stderr" "stdin" "stdout" |
123d19079d9f
Delete explicit autoload calls.
Richard M. Stallman <rms@gnu.org>
parents:
16905
diff
changeset
|
154 "string_fill_char" "struct_levels_to_print" |
123d19079d9f
Delete explicit autoload calls.
Richard M. Stallman <rms@gnu.org>
parents:
16905
diff
changeset
|
155 "suppress_verbose_help_message" "treat_neg_dim_as_zero" |
123d19079d9f
Delete explicit autoload calls.
Richard M. Stallman <rms@gnu.org>
parents:
16905
diff
changeset
|
156 "warn_assign_as_truth_value" "warn_comma_in_global_decl" |
123d19079d9f
Delete explicit autoload calls.
Richard M. Stallman <rms@gnu.org>
parents:
16905
diff
changeset
|
157 "warn_divide_by_zero" "warn_function_name_clash" |
123d19079d9f
Delete explicit autoload calls.
Richard M. Stallman <rms@gnu.org>
parents:
16905
diff
changeset
|
158 "warn_missing_semicolon" "whitespace_in_literal_matrix") |
123d19079d9f
Delete explicit autoload calls.
Richard M. Stallman <rms@gnu.org>
parents:
16905
diff
changeset
|
159 "Builtin variables in Octave.") |
123d19079d9f
Delete explicit autoload calls.
Richard M. Stallman <rms@gnu.org>
parents:
16905
diff
changeset
|
160 |
123d19079d9f
Delete explicit autoload calls.
Richard M. Stallman <rms@gnu.org>
parents:
16905
diff
changeset
|
161 (defvar octave-function-header-regexp |
123d19079d9f
Delete explicit autoload calls.
Richard M. Stallman <rms@gnu.org>
parents:
16905
diff
changeset
|
162 (concat "^\\s-*\\<\\(function\\)\\>" |
123d19079d9f
Delete explicit autoload calls.
Richard M. Stallman <rms@gnu.org>
parents:
16905
diff
changeset
|
163 "\\([^=;\n]*=[ \t]*\\|[ \t]*\\)\\(\\w+\\)\\>") |
123d19079d9f
Delete explicit autoload calls.
Richard M. Stallman <rms@gnu.org>
parents:
16905
diff
changeset
|
164 "Regexp to match an Octave function header. |
123d19079d9f
Delete explicit autoload calls.
Richard M. Stallman <rms@gnu.org>
parents:
16905
diff
changeset
|
165 The string `function' and its name are given by the first and third |
123d19079d9f
Delete explicit autoload calls.
Richard M. Stallman <rms@gnu.org>
parents:
16905
diff
changeset
|
166 parenthetical grouping.") |
123d19079d9f
Delete explicit autoload calls.
Richard M. Stallman <rms@gnu.org>
parents:
16905
diff
changeset
|
167 |
123d19079d9f
Delete explicit autoload calls.
Richard M. Stallman <rms@gnu.org>
parents:
16905
diff
changeset
|
168 (defvar octave-font-lock-keywords |
123d19079d9f
Delete explicit autoload calls.
Richard M. Stallman <rms@gnu.org>
parents:
16905
diff
changeset
|
169 (list |
123d19079d9f
Delete explicit autoload calls.
Richard M. Stallman <rms@gnu.org>
parents:
16905
diff
changeset
|
170 ;; Fontify all builtin keywords. |
123d19079d9f
Delete explicit autoload calls.
Richard M. Stallman <rms@gnu.org>
parents:
16905
diff
changeset
|
171 (cons (concat "\\<\\(" |
123d19079d9f
Delete explicit autoload calls.
Richard M. Stallman <rms@gnu.org>
parents:
16905
diff
changeset
|
172 (mapconcat 'identity octave-reserved-words "\\|") |
123d19079d9f
Delete explicit autoload calls.
Richard M. Stallman <rms@gnu.org>
parents:
16905
diff
changeset
|
173 (mapconcat 'identity octave-text-functions "\\|") |
123d19079d9f
Delete explicit autoload calls.
Richard M. Stallman <rms@gnu.org>
parents:
16905
diff
changeset
|
174 "\\)\\>") |
123d19079d9f
Delete explicit autoload calls.
Richard M. Stallman <rms@gnu.org>
parents:
16905
diff
changeset
|
175 'font-lock-keyword-face) |
123d19079d9f
Delete explicit autoload calls.
Richard M. Stallman <rms@gnu.org>
parents:
16905
diff
changeset
|
176 ;; Fontify all builtin operators. |
123d19079d9f
Delete explicit autoload calls.
Richard M. Stallman <rms@gnu.org>
parents:
16905
diff
changeset
|
177 (cons "\\(&\\||\\|<=\\|>=\\|==\\|<\\|>\\|!=\\|!\\)" |
28070
7079931424be
(octave-font-lock-keywords): To font-lock the
Gerd Moellmann <gerd@gnu.org>
parents:
26157
diff
changeset
|
178 (if (boundp 'font-lock-builtin-face) |
7079931424be
(octave-font-lock-keywords): To font-lock the
Gerd Moellmann <gerd@gnu.org>
parents:
26157
diff
changeset
|
179 'font-lock-builtin-face |
7079931424be
(octave-font-lock-keywords): To font-lock the
Gerd Moellmann <gerd@gnu.org>
parents:
26157
diff
changeset
|
180 'font-lock-preprocessor-face)) |
16911
123d19079d9f
Delete explicit autoload calls.
Richard M. Stallman <rms@gnu.org>
parents:
16905
diff
changeset
|
181 ;; Fontify all builtin variables. |
123d19079d9f
Delete explicit autoload calls.
Richard M. Stallman <rms@gnu.org>
parents:
16905
diff
changeset
|
182 (cons (concat "\\<\\(" |
123d19079d9f
Delete explicit autoload calls.
Richard M. Stallman <rms@gnu.org>
parents:
16905
diff
changeset
|
183 (mapconcat 'identity octave-variables "\\|") |
123d19079d9f
Delete explicit autoload calls.
Richard M. Stallman <rms@gnu.org>
parents:
16905
diff
changeset
|
184 "\\)\\>") |
123d19079d9f
Delete explicit autoload calls.
Richard M. Stallman <rms@gnu.org>
parents:
16905
diff
changeset
|
185 'font-lock-variable-name-face) |
123d19079d9f
Delete explicit autoload calls.
Richard M. Stallman <rms@gnu.org>
parents:
16905
diff
changeset
|
186 ;; Fontify all function declarations. |
123d19079d9f
Delete explicit autoload calls.
Richard M. Stallman <rms@gnu.org>
parents:
16905
diff
changeset
|
187 (list octave-function-header-regexp |
123d19079d9f
Delete explicit autoload calls.
Richard M. Stallman <rms@gnu.org>
parents:
16905
diff
changeset
|
188 '(1 font-lock-keyword-face) |
123d19079d9f
Delete explicit autoload calls.
Richard M. Stallman <rms@gnu.org>
parents:
16905
diff
changeset
|
189 '(3 font-lock-function-name-face nil t))) |
123d19079d9f
Delete explicit autoload calls.
Richard M. Stallman <rms@gnu.org>
parents:
16905
diff
changeset
|
190 "Additional Octave expressions to highlight.") |
123d19079d9f
Delete explicit autoload calls.
Richard M. Stallman <rms@gnu.org>
parents:
16905
diff
changeset
|
191 |
20781 | 192 (defcustom inferior-octave-buffer "*Inferior Octave*" |
193 "*Name of buffer for running an inferior Octave process." | |
194 :type 'string | |
195 :group 'octave-inferior) | |
16911
123d19079d9f
Delete explicit autoload calls.
Richard M. Stallman <rms@gnu.org>
parents:
16905
diff
changeset
|
196 |
123d19079d9f
Delete explicit autoload calls.
Richard M. Stallman <rms@gnu.org>
parents:
16905
diff
changeset
|
197 (defvar inferior-octave-process nil) |
123d19079d9f
Delete explicit autoload calls.
Richard M. Stallman <rms@gnu.org>
parents:
16905
diff
changeset
|
198 |
16901 | 199 (defvar octave-mode-map nil |
200 "Keymap used in Octave mode.") | |
201 (if octave-mode-map | |
202 () | |
203 (let ((map (make-sparse-keymap))) | |
204 (define-key map "`" 'octave-abbrev-start) | |
205 (define-key map ";" 'octave-electric-semi) | |
206 (define-key map " " 'octave-electric-space) | |
207 (define-key map "\n" 'octave-reindent-then-newline-and-indent) | |
208 (define-key map "\t" 'indent-according-to-mode) | |
209 (define-key map "\e;" 'octave-indent-for-comment) | |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49334
diff
changeset
|
210 (define-key map "\e\n" 'octave-indent-new-comment-line) |
16901 | 211 (define-key map "\e\t" 'octave-complete-symbol) |
212 (define-key map "\M-\C-a" 'octave-beginning-of-defun) | |
213 (define-key map "\M-\C-e" 'octave-end-of-defun) | |
214 (define-key map "\M-\C-h" 'octave-mark-defun) | |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49334
diff
changeset
|
215 (define-key map "\M-\C-q" 'octave-indent-defun) |
16901 | 216 (define-key map "\C-c;" 'octave-comment-region) |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49334
diff
changeset
|
217 (define-key map "\C-c:" 'octave-uncomment-region) |
16901 | 218 (define-key map "\C-c\C-b" 'octave-submit-bug-report) |
219 (define-key map "\C-c\C-p" 'octave-previous-code-line) | |
220 (define-key map "\C-c\C-n" 'octave-next-code-line) | |
221 (define-key map "\C-c\C-a" 'octave-beginning-of-line) | |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49334
diff
changeset
|
222 (define-key map "\C-c\C-e" 'octave-end-of-line) |
16901 | 223 (define-key map "\C-c\M-\C-n" 'octave-forward-block) |
224 (define-key map "\C-c\M-\C-p" 'octave-backward-block) | |
225 (define-key map "\C-c\M-\C-u" 'octave-backward-up-block) | |
226 (define-key map "\C-c\M-\C-d" 'octave-down-block) | |
227 (define-key map "\C-c\M-\C-h" 'octave-mark-block) | |
228 (define-key map "\C-c]" 'octave-close-block) | |
49334
8dad7ccccdcb
(octave-mode-map): Change C-c i bindings to C-c C-i.
Richard M. Stallman <rms@gnu.org>
parents:
47939
diff
changeset
|
229 (define-key map "\C-c\C-f" 'octave-insert-defun) |
16901 | 230 (define-key map "\C-c\C-h" 'octave-help) |
49334
8dad7ccccdcb
(octave-mode-map): Change C-c i bindings to C-c C-i.
Richard M. Stallman <rms@gnu.org>
parents:
47939
diff
changeset
|
231 (define-key map "\C-c\C-il" 'octave-send-line) |
8dad7ccccdcb
(octave-mode-map): Change C-c i bindings to C-c C-i.
Richard M. Stallman <rms@gnu.org>
parents:
47939
diff
changeset
|
232 (define-key map "\C-c\C-ib" 'octave-send-block) |
8dad7ccccdcb
(octave-mode-map): Change C-c i bindings to C-c C-i.
Richard M. Stallman <rms@gnu.org>
parents:
47939
diff
changeset
|
233 (define-key map "\C-c\C-if" 'octave-send-defun) |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49334
diff
changeset
|
234 (define-key map "\C-c\C-ir" 'octave-send-region) |
49334
8dad7ccccdcb
(octave-mode-map): Change C-c i bindings to C-c C-i.
Richard M. Stallman <rms@gnu.org>
parents:
47939
diff
changeset
|
235 (define-key map "\C-c\C-is" 'octave-show-process-buffer) |
8dad7ccccdcb
(octave-mode-map): Change C-c i bindings to C-c C-i.
Richard M. Stallman <rms@gnu.org>
parents:
47939
diff
changeset
|
236 (define-key map "\C-c\C-ih" 'octave-hide-process-buffer) |
8dad7ccccdcb
(octave-mode-map): Change C-c i bindings to C-c C-i.
Richard M. Stallman <rms@gnu.org>
parents:
47939
diff
changeset
|
237 (define-key map "\C-c\C-ik" 'octave-kill-process) |
8dad7ccccdcb
(octave-mode-map): Change C-c i bindings to C-c C-i.
Richard M. Stallman <rms@gnu.org>
parents:
47939
diff
changeset
|
238 (define-key map "\C-c\C-i\C-l" 'octave-send-line) |
8dad7ccccdcb
(octave-mode-map): Change C-c i bindings to C-c C-i.
Richard M. Stallman <rms@gnu.org>
parents:
47939
diff
changeset
|
239 (define-key map "\C-c\C-i\C-b" 'octave-send-block) |
8dad7ccccdcb
(octave-mode-map): Change C-c i bindings to C-c C-i.
Richard M. Stallman <rms@gnu.org>
parents:
47939
diff
changeset
|
240 (define-key map "\C-c\C-i\C-f" 'octave-send-defun) |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49334
diff
changeset
|
241 (define-key map "\C-c\C-i\C-r" 'octave-send-region) |
49334
8dad7ccccdcb
(octave-mode-map): Change C-c i bindings to C-c C-i.
Richard M. Stallman <rms@gnu.org>
parents:
47939
diff
changeset
|
242 (define-key map "\C-c\C-i\C-s" 'octave-show-process-buffer) |
8dad7ccccdcb
(octave-mode-map): Change C-c i bindings to C-c C-i.
Richard M. Stallman <rms@gnu.org>
parents:
47939
diff
changeset
|
243 (define-key map "\C-c\C-i\C-h" 'octave-hide-process-buffer) |
8dad7ccccdcb
(octave-mode-map): Change C-c i bindings to C-c C-i.
Richard M. Stallman <rms@gnu.org>
parents:
47939
diff
changeset
|
244 (define-key map "\C-c\C-i\C-k" 'octave-kill-process) |
16901 | 245 (setq octave-mode-map map))) |
246 | |
247 (defvar octave-mode-menu | |
248 (list "Octave" | |
249 (list "Lines" | |
250 ["Previous Code Line" octave-previous-code-line t] | |
251 ["Next Code Line" octave-next-code-line t] | |
252 ["Begin of Continuation" octave-beginning-of-line t] | |
253 ["End of Continuation" octave-end-of-line t] | |
254 ["Split Line at Point" octave-indent-new-comment-line t]) | |
255 (list "Blocks" | |
256 ["Next Block" octave-forward-block t] | |
257 ["Previous Block" octave-backward-block t] | |
258 ["Down Block" octave-down-block t] | |
259 ["Up Block" octave-backward-up-block t] | |
260 ["Mark Block" octave-mark-block t] | |
261 ["Close Block" octave-close-block t]) | |
262 (list "Functions" | |
263 ["Begin of Function" octave-beginning-of-defun t] | |
264 ["End of Function" octave-end-of-defun t] | |
265 ["Mark Function" octave-mark-defun t] | |
266 ["Indent Function" octave-indent-defun t] | |
267 ["Insert Function" octave-insert-defun t]) | |
268 "-" | |
269 (list "Debug" | |
270 ["Send Current Line" octave-send-line t] | |
271 ["Send Current Block" octave-send-block t] | |
272 ["Send Current Function" octave-send-defun t] | |
273 ["Send Region" octave-send-region t] | |
274 ["Show Process Buffer" octave-show-process-buffer t] | |
275 ["Hide Process Buffer" octave-hide-process-buffer t] | |
276 ["Kill Process" octave-kill-process t]) | |
277 "-" | |
278 ["Indent Line" indent-according-to-mode t] | |
279 ["Complete Symbol" octave-complete-symbol t] | |
280 "-" | |
281 ["Toggle Abbrev Mode" abbrev-mode t] | |
282 ["Toggle Auto-Fill Mode" auto-fill-mode t] | |
283 "-" | |
284 ["Submit Bug Report" octave-submit-bug-report t] | |
285 "-" | |
286 ["Describe Octave Mode" octave-describe-major-mode t] | |
287 ["Lookup Octave Index" octave-help t]) | |
288 "Menu for Octave mode.") | |
289 | |
52930
069cb76731fd
(octave-comment-start): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52401
diff
changeset
|
290 (defvar octave-mode-syntax-table |
16901 | 291 (let ((table (make-syntax-table))) |
292 (modify-syntax-entry ?\r " " table) | |
293 (modify-syntax-entry ?+ "." table) | |
294 (modify-syntax-entry ?- "." table) | |
295 (modify-syntax-entry ?= "." table) | |
296 (modify-syntax-entry ?* "." table) | |
297 (modify-syntax-entry ?/ "." table) | |
298 (modify-syntax-entry ?> "." table) | |
299 (modify-syntax-entry ?< "." table) | |
300 (modify-syntax-entry ?& "." table) | |
301 (modify-syntax-entry ?| "." table) | |
302 (modify-syntax-entry ?! "." table) | |
303 (modify-syntax-entry ?\\ "\\" table) | |
304 (modify-syntax-entry ?\' "." table) | |
305 (modify-syntax-entry ?\` "w" table) | |
306 (modify-syntax-entry ?\" "\"" table) | |
307 (modify-syntax-entry ?. "w" table) | |
308 (modify-syntax-entry ?_ "w" table) | |
52930
069cb76731fd
(octave-comment-start): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52401
diff
changeset
|
309 (modify-syntax-entry ?\% "<" table) |
16901 | 310 (modify-syntax-entry ?\# "<" table) |
311 (modify-syntax-entry ?\n ">" table) | |
52930
069cb76731fd
(octave-comment-start): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52401
diff
changeset
|
312 table) |
069cb76731fd
(octave-comment-start): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52401
diff
changeset
|
313 "Syntax table in use in `octave-mode' buffers.") |
16901 | 314 |
20781 | 315 (defcustom octave-auto-indent nil |
316 "*Non-nil means indent line after a semicolon or space in Octave mode." | |
317 :type 'boolean | |
26157
313a03652df3
Added (require 'custom) and deleted :version line from
Stephen Eglen <stephen@gnu.org>
parents:
25277
diff
changeset
|
318 :group 'octave) |
20181
fe0f0a9bb43f
(octave-auto-indent): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17533
diff
changeset
|
319 |
20781 | 320 (defcustom octave-auto-newline nil |
321 "*Non-nil means automatically newline after a semicolon in Octave mode." | |
322 :type 'boolean | |
323 :group 'octave) | |
16901 | 324 |
20781 | 325 (defcustom octave-blink-matching-block t |
16901 | 326 "*Control the blinking of matching Octave block keywords. |
327 Non-nil means show matching begin of block when inserting a space, | |
20781 | 328 newline or semicolon after an else or end keyword." |
329 :type 'boolean | |
330 :group 'octave) | |
331 (defcustom octave-block-offset 2 | |
332 "*Extra indentation applied to statements in Octave block structures." | |
333 :type 'integer | |
334 :group 'octave) | |
16901 | 335 |
336 (defvar octave-block-begin-regexp | |
337 (concat "\\<\\(" | |
338 (mapconcat 'identity octave-begin-keywords "\\|") | |
339 "\\)\\>")) | |
340 (defvar octave-block-else-regexp | |
341 (concat "\\<\\(" | |
342 (mapconcat 'identity octave-else-keywords "\\|") | |
343 "\\)\\>")) | |
344 (defvar octave-block-end-regexp | |
345 (concat "\\<\\(" | |
346 (mapconcat 'identity octave-end-keywords "\\|") | |
347 "\\)\\>")) | |
348 (defvar octave-block-begin-or-end-regexp | |
349 (concat octave-block-begin-regexp "\\|" octave-block-end-regexp)) | |
350 (defvar octave-block-else-or-end-regexp | |
351 (concat octave-block-else-regexp "\\|" octave-block-end-regexp)) | |
352 (defvar octave-block-match-alist | |
353 '(("for" . ("end" "endfor")) | |
354 ("function" . ("end" "endfunction")) | |
355 ("if" . ("else" "elseif" "end" "endif")) | |
20181
fe0f0a9bb43f
(octave-auto-indent): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17533
diff
changeset
|
356 ("switch" . ("case" "otherwise" "end" "endswitch")) |
16901 | 357 ("try" . ("catch" "end" "end_try_catch")) |
358 ("unwind_protect" . ("unwind_protect_cleanup" "end" | |
359 "end_unwind_protect")) | |
360 ("while" . ("end" "endwhile"))) | |
361 "Alist with Octave's matching block keywords. | |
362 Has Octave's begin keywords as keys and a list of the matching else or | |
363 end keywords as associated values.") | |
364 | |
365 (defvar octave-block-comment-start | |
366 (concat (make-string 2 octave-comment-char) " ") | |
367 "String to insert to start a new Octave comment on an empty line.") | |
368 | |
20781 | 369 (defcustom octave-continuation-offset 4 |
370 "*Extra indentation applied to Octave continuation lines." | |
371 :type 'integer | |
372 :group 'octave) | |
16901 | 373 (defvar octave-continuation-regexp |
374 "[^#%\n]*\\(\\\\\\|\\.\\.\\.\\)\\s-*\\(\\s<.*\\)?$") | |
20781 | 375 (defcustom octave-continuation-string "\\" |
376 "*Character string used for Octave continuation lines. Normally \\." | |
377 :type 'string | |
378 :group 'octave) | |
16901 | 379 |
380 (defvar octave-completion-alist nil | |
381 "Alist of Octave symbols for completion in Octave mode. | |
382 Each element looks like (VAR . VAR), where the car and cdr are the same | |
383 symbol (an Octave command or variable name). | |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49334
diff
changeset
|
384 Currently, only builtin variables can be completed.") |
16901 | 385 |
386 (defvar octave-mode-imenu-generic-expression | |
387 (list | |
388 ;; Functions | |
389 (list nil octave-function-header-regexp 3)) | |
390 "Imenu expression for Octave mode. See `imenu-generic-expression'.") | |
391 | |
20781 | 392 (defcustom octave-mode-startup-message t |
42205 | 393 "*nil means do not display the Octave mode startup message." |
20781 | 394 :type 'boolean |
395 :group 'octave) | |
16901 | 396 |
20781 | 397 (defcustom octave-mode-hook nil |
398 "*Hook to be run when Octave mode is started." | |
399 :type 'hook | |
400 :group 'octave) | |
16901 | 401 |
20781 | 402 (defcustom octave-send-show-buffer t |
403 "*Non-nil means display `inferior-octave-buffer' after sending to it." | |
404 :type 'boolean | |
405 :group 'octave) | |
406 (defcustom octave-send-line-auto-forward t | |
16901 | 407 "*Control auto-forward after sending to the inferior Octave process. |
20781 | 408 Non-nil means always go to the next Octave code line after sending." |
409 :type 'boolean | |
410 :group 'octave) | |
411 (defcustom octave-send-echo-input t | |
412 "*Non-nil means echo input sent to the inferior Octave process." | |
413 :type 'boolean | |
414 :group 'octave) | |
16901 | 415 |
416 | |
417 ;;;###autoload | |
418 (defun octave-mode () | |
419 "Major mode for editing Octave code. | |
420 | |
421 This mode makes it easier to write Octave code by helping with | |
422 indentation, doing some of the typing for you (with Abbrev mode) and by | |
423 showing keywords, comments, strings, etc. in different faces (with | |
424 Font Lock mode on terminals that support it). | |
425 | |
426 Octave itself is a high-level language, primarily intended for numerical | |
427 computations. It provides a convenient command line interface for | |
428 solving linear and nonlinear problems numerically. Function definitions | |
429 can also be stored in files, and it can be used in a batch mode (which | |
430 is why you need this mode!). | |
431 | |
432 The latest released version of Octave is always available via anonymous | |
433 ftp from bevo.che.wisc.edu in the directory `/pub/octave'. Complete | |
434 source and binaries for several popular systems are available. | |
435 | |
436 Type \\[list-abbrevs] to display the built-in abbrevs for Octave keywords. | |
437 | |
438 Keybindings | |
439 =========== | |
440 | |
441 \\{octave-mode-map} | |
442 | |
443 Variables you can use to customize Octave mode | |
444 ============================================== | |
445 | |
20181
fe0f0a9bb43f
(octave-auto-indent): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17533
diff
changeset
|
446 octave-auto-indent |
fe0f0a9bb43f
(octave-auto-indent): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17533
diff
changeset
|
447 Non-nil means indent current line after a semicolon or space. |
fe0f0a9bb43f
(octave-auto-indent): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17533
diff
changeset
|
448 Default is nil. |
fe0f0a9bb43f
(octave-auto-indent): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17533
diff
changeset
|
449 |
16901 | 450 octave-auto-newline |
451 Non-nil means auto-insert a newline and indent after a semicolon. | |
452 Default is nil. | |
453 | |
454 octave-blink-matching-block | |
455 Non-nil means show matching begin of block when inserting a space, | |
456 newline or semicolon after an else or end keyword. Default is t. | |
457 | |
458 octave-block-offset | |
459 Extra indentation applied to statements in block structures. | |
460 Default is 2. | |
461 | |
462 octave-continuation-offset | |
463 Extra indentation applied to Octave continuation lines. | |
464 Default is 4. | |
465 | |
466 octave-continuation-string | |
467 String used for Octave continuation lines. | |
468 Default is a backslash. | |
469 | |
470 octave-mode-startup-message | |
42205 | 471 nil means do not display the Octave mode startup message. |
16901 | 472 Default is t. |
473 | |
474 octave-send-echo-input | |
475 Non-nil means always display `inferior-octave-buffer' after sending a | |
476 command to the inferior Octave process. | |
477 | |
478 octave-send-line-auto-forward | |
479 Non-nil means always go to the next unsent line of Octave code after | |
480 sending a line to the inferior Octave process. | |
481 | |
482 octave-send-echo-input | |
483 Non-nil means echo input sent to the inferior Octave process. | |
484 | |
485 Turning on Octave mode runs the hook `octave-mode-hook'. | |
486 | |
487 To begin using this mode for all `.m' files that you edit, add the | |
488 following lines to your `.emacs' file: | |
489 | |
490 (autoload 'octave-mode \"octave-mod\" nil t) | |
491 (setq auto-mode-alist | |
492 (cons '(\"\\\\.m$\" . octave-mode) auto-mode-alist)) | |
493 | |
494 To automatically turn on the abbrev, auto-fill and font-lock features, | |
495 add the following lines to your `.emacs' file as well: | |
496 | |
497 (add-hook 'octave-mode-hook | |
498 (lambda () | |
499 (abbrev-mode 1) | |
500 (auto-fill-mode 1) | |
501 (if (eq window-system 'x) | |
502 (font-lock-mode 1)))) | |
503 | |
504 To submit a problem report, enter \\[octave-submit-bug-report] from \ | |
505 an Octave mode buffer. | |
506 This automatically sets up a mail buffer with version information | |
507 already added. You just need to add a description of the problem, | |
508 including a reproducible test case and send the message." | |
509 (interactive) | |
510 (kill-all-local-variables) | |
511 | |
512 (use-local-map octave-mode-map) | |
513 (setq major-mode 'octave-mode) | |
514 (setq mode-name "Octave") | |
515 (setq local-abbrev-table octave-abbrev-table) | |
516 (set-syntax-table octave-mode-syntax-table) | |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49334
diff
changeset
|
517 |
16901 | 518 (make-local-variable 'indent-line-function) |
519 (setq indent-line-function 'octave-indent-line) | |
520 | |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49334
diff
changeset
|
521 (make-local-variable 'comment-start) |
16901 | 522 (setq comment-start octave-comment-start) |
523 (make-local-variable 'comment-end) | |
524 (setq comment-end "") | |
525 (make-local-variable 'comment-column) | |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49334
diff
changeset
|
526 (setq comment-column 32) |
16901 | 527 (make-local-variable 'comment-start-skip) |
528 (setq comment-start-skip "\\s<+\\s-*") | |
529 (make-local-variable 'comment-indent-function) | |
530 (setq comment-indent-function 'octave-comment-indent) | |
531 | |
532 (make-local-variable 'parse-sexp-ignore-comments) | |
533 (setq parse-sexp-ignore-comments t) | |
534 (make-local-variable 'paragraph-start) | |
535 (setq paragraph-start (concat "\\s-*$\\|" page-delimiter)) | |
536 (make-local-variable 'paragraph-separate) | |
537 (setq paragraph-separate paragraph-start) | |
538 (make-local-variable 'paragraph-ignore-fill-prefix) | |
539 (setq paragraph-ignore-fill-prefix t) | |
540 (make-local-variable 'fill-paragraph-function) | |
541 (setq fill-paragraph-function 'octave-fill-paragraph) | |
542 (make-local-variable 'adaptive-fill-regexp) | |
543 (setq adaptive-fill-regexp nil) | |
544 (make-local-variable 'fill-column) | |
545 (setq fill-column 72) | |
546 (make-local-variable 'normal-auto-fill-function) | |
547 (setq normal-auto-fill-function 'octave-auto-fill) | |
548 | |
549 (make-local-variable 'font-lock-defaults) | |
550 (setq font-lock-defaults '(octave-font-lock-keywords nil nil)) | |
551 | |
552 (make-local-variable 'imenu-generic-expression) | |
20459 | 553 (setq imenu-generic-expression octave-mode-imenu-generic-expression |
554 imenu-case-fold-search nil) | |
16901 | 555 |
556 (octave-add-octave-menu) | |
557 (octave-initialize-completions) | |
16902
6a94efd704e6
(octave-mode): Delete the startup message.
Richard M. Stallman <rms@gnu.org>
parents:
16901
diff
changeset
|
558 (run-hooks 'octave-mode-hook)) |
16901 | 559 |
560 ;;; Miscellaneous useful functions | |
561 (defun octave-describe-major-mode () | |
562 "Describe the current major mode." | |
563 (interactive) | |
564 (describe-function major-mode)) | |
565 | |
566 (defsubst octave-in-comment-p () | |
567 "Returns t if point is inside an Octave comment, nil otherwise." | |
568 (interactive) | |
569 (save-excursion | |
52930
069cb76731fd
(octave-comment-start): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52401
diff
changeset
|
570 (nth 4 (parse-partial-sexp (line-beginning-position) (point))))) |
16901 | 571 |
572 (defsubst octave-in-string-p () | |
573 "Returns t if point is inside an Octave string, nil otherwise." | |
574 (interactive) | |
575 (save-excursion | |
52930
069cb76731fd
(octave-comment-start): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52401
diff
changeset
|
576 (nth 3 (parse-partial-sexp (line-beginning-position) (point))))) |
16901 | 577 |
578 (defsubst octave-not-in-string-or-comment-p () | |
579 "Returns t iff point is not inside an Octave string or comment." | |
52930
069cb76731fd
(octave-comment-start): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52401
diff
changeset
|
580 (let ((pps (parse-partial-sexp (line-beginning-position) (point)))) |
16901 | 581 (not (or (nth 3 pps) (nth 4 pps))))) |
582 | |
583 (defun octave-in-block-p () | |
584 "Returns t if point is inside an Octave block, nil otherwise. | |
585 The block is taken to start at the first letter of the begin keyword and | |
586 to end after the end keyword." | |
587 (let ((pos (point))) | |
588 (save-excursion | |
589 (condition-case nil | |
590 (progn | |
591 (skip-syntax-forward "w") | |
592 (octave-up-block -1) | |
593 (octave-forward-block) | |
594 t) | |
595 (error nil)) | |
596 (< pos (point))))) | |
597 | |
598 (defun octave-in-defun-p () | |
599 "Returns t iff point is inside an Octave function declaration. | |
600 The function is taken to start at the `f' of `function' and to end after | |
601 the end keyword." | |
602 (let ((pos (point))) | |
603 (save-excursion | |
604 (or (and (looking-at "\\<function\\>") | |
605 (octave-not-in-string-or-comment-p)) | |
606 (and (octave-beginning-of-defun) | |
607 (condition-case nil | |
608 (progn | |
609 (octave-forward-block) | |
610 t) | |
611 (error nil)) | |
612 (< pos (point))))))) | |
613 | |
20181
fe0f0a9bb43f
(octave-auto-indent): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17533
diff
changeset
|
614 (defun octave-maybe-insert-continuation-string () |
fe0f0a9bb43f
(octave-auto-indent): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17533
diff
changeset
|
615 (if (or (octave-in-comment-p) |
fe0f0a9bb43f
(octave-auto-indent): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17533
diff
changeset
|
616 (save-excursion |
fe0f0a9bb43f
(octave-auto-indent): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17533
diff
changeset
|
617 (beginning-of-line) |
fe0f0a9bb43f
(octave-auto-indent): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17533
diff
changeset
|
618 (looking-at octave-continuation-regexp))) |
fe0f0a9bb43f
(octave-auto-indent): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17533
diff
changeset
|
619 nil |
fe0f0a9bb43f
(octave-auto-indent): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17533
diff
changeset
|
620 (delete-horizontal-space) |
fe0f0a9bb43f
(octave-auto-indent): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17533
diff
changeset
|
621 (insert (concat " " octave-continuation-string)))) |
fe0f0a9bb43f
(octave-auto-indent): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17533
diff
changeset
|
622 |
23848
7896e341d77f
(octave-abbrev-start): Use the correct
Karl Heuer <kwzh@gnu.org>
parents:
21669
diff
changeset
|
623 (defvar octave-xemacs-p |
7896e341d77f
(octave-abbrev-start): Use the correct
Karl Heuer <kwzh@gnu.org>
parents:
21669
diff
changeset
|
624 (string-match "XEmacs\\|Lucid" emacs-version)) |
7896e341d77f
(octave-abbrev-start): Use the correct
Karl Heuer <kwzh@gnu.org>
parents:
21669
diff
changeset
|
625 |
16901 | 626 ;;; Comments |
627 (defun octave-comment-region (beg end &optional arg) | |
628 "Comment or uncomment each line in the region as Octave code. | |
629 See `comment-region'." | |
630 (interactive "r\nP") | |
631 (let ((comment-start (char-to-string octave-comment-char))) | |
632 (comment-region beg end arg))) | |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49334
diff
changeset
|
633 |
16901 | 634 (defun octave-uncomment-region (beg end &optional arg) |
635 "Uncomment each line in the region as Octave code." | |
636 (interactive "r\nP") | |
637 (or arg (setq arg 1)) | |
638 (octave-comment-region beg end (- arg))) | |
639 | |
640 | |
641 ;;; Indentation | |
642 (defun calculate-octave-indent () | |
643 "Return appropriate indentation for current line as Octave code. | |
644 Returns an integer (the column to indent to) unless the line is a | |
645 comment line with fixed goal golumn. In that case, returns a list whose | |
646 car is the column to indent to, and whose cdr is the current indentation | |
647 level." | |
648 (let ((is-continuation-line | |
649 (save-excursion | |
650 (if (zerop (octave-previous-code-line)) | |
651 (looking-at octave-continuation-regexp)))) | |
652 (icol 0)) | |
653 (save-excursion | |
654 (beginning-of-line) | |
655 ;; If we can move backward out one level of parentheses, take 1 | |
656 ;; plus the indentation of that parenthesis. Otherwise, go back | |
657 ;; to the beginning of the previous code line, and compute the | |
658 ;; offset this line gives. | |
659 (if (condition-case nil | |
660 (progn | |
661 (up-list -1) | |
662 t) | |
663 (error nil)) | |
664 (setq icol (+ 1 (current-column))) | |
665 (if (zerop (octave-previous-code-line)) | |
666 (progn | |
667 (octave-beginning-of-line) | |
668 (back-to-indentation) | |
669 (setq icol (current-column)) | |
670 (let ((bot (point)) | |
52930
069cb76731fd
(octave-comment-start): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52401
diff
changeset
|
671 (eol (line-end-position))) |
16901 | 672 (while (< (point) eol) |
673 (if (octave-not-in-string-or-comment-p) | |
674 (cond | |
17151
0663a5ce936c
(octave-abbrev-table): Add abbrevs for switch,
Karl Heuer <kwzh@gnu.org>
parents:
16911
diff
changeset
|
675 ((looking-at "\\<switch\\>") |
0663a5ce936c
(octave-abbrev-table): Add abbrevs for switch,
Karl Heuer <kwzh@gnu.org>
parents:
16911
diff
changeset
|
676 (setq icol (+ icol (* 2 octave-block-offset)))) |
16901 | 677 ((looking-at octave-block-begin-regexp) |
678 (setq icol (+ icol octave-block-offset))) | |
679 ((looking-at octave-block-else-regexp) | |
680 (if (= bot (point)) | |
681 (setq icol (+ icol octave-block-offset)))) | |
682 ((looking-at octave-block-end-regexp) | |
683 (if (not (= bot (point))) | |
17151
0663a5ce936c
(octave-abbrev-table): Add abbrevs for switch,
Karl Heuer <kwzh@gnu.org>
parents:
16911
diff
changeset
|
684 (setq icol (- icol |
0663a5ce936c
(octave-abbrev-table): Add abbrevs for switch,
Karl Heuer <kwzh@gnu.org>
parents:
16911
diff
changeset
|
685 (octave-block-end-offset))))))) |
16901 | 686 (forward-char))) |
687 (if is-continuation-line | |
688 (setq icol (+ icol octave-continuation-offset))))))) | |
689 (save-excursion | |
690 (back-to-indentation) | |
691 (cond | |
17151
0663a5ce936c
(octave-abbrev-table): Add abbrevs for switch,
Karl Heuer <kwzh@gnu.org>
parents:
16911
diff
changeset
|
692 ((and (looking-at octave-block-else-regexp) |
16901 | 693 (octave-not-in-string-or-comment-p)) |
694 (setq icol (- icol octave-block-offset))) | |
17151
0663a5ce936c
(octave-abbrev-table): Add abbrevs for switch,
Karl Heuer <kwzh@gnu.org>
parents:
16911
diff
changeset
|
695 ((and (looking-at octave-block-end-regexp) |
0663a5ce936c
(octave-abbrev-table): Add abbrevs for switch,
Karl Heuer <kwzh@gnu.org>
parents:
16911
diff
changeset
|
696 (octave-not-in-string-or-comment-p)) |
0663a5ce936c
(octave-abbrev-table): Add abbrevs for switch,
Karl Heuer <kwzh@gnu.org>
parents:
16911
diff
changeset
|
697 (setq icol (- icol (octave-block-end-offset)))) |
20181
fe0f0a9bb43f
(octave-auto-indent): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17533
diff
changeset
|
698 ((or (looking-at "\\s<\\s<\\s<\\S<") |
fe0f0a9bb43f
(octave-auto-indent): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17533
diff
changeset
|
699 (octave-before-magic-comment-p)) |
16901 | 700 (setq icol (list 0 icol))) |
701 ((looking-at "\\s<\\S<") | |
702 (setq icol (list comment-column icol))))) | |
703 icol)) | |
704 | |
17151
0663a5ce936c
(octave-abbrev-table): Add abbrevs for switch,
Karl Heuer <kwzh@gnu.org>
parents:
16911
diff
changeset
|
705 (defun octave-block-end-offset () |
0663a5ce936c
(octave-abbrev-table): Add abbrevs for switch,
Karl Heuer <kwzh@gnu.org>
parents:
16911
diff
changeset
|
706 (save-excursion |
0663a5ce936c
(octave-abbrev-table): Add abbrevs for switch,
Karl Heuer <kwzh@gnu.org>
parents:
16911
diff
changeset
|
707 (octave-backward-up-block 1) |
0663a5ce936c
(octave-abbrev-table): Add abbrevs for switch,
Karl Heuer <kwzh@gnu.org>
parents:
16911
diff
changeset
|
708 (* octave-block-offset |
0663a5ce936c
(octave-abbrev-table): Add abbrevs for switch,
Karl Heuer <kwzh@gnu.org>
parents:
16911
diff
changeset
|
709 (if (string-match (match-string 0) "switch") 2 1)))) |
0663a5ce936c
(octave-abbrev-table): Add abbrevs for switch,
Karl Heuer <kwzh@gnu.org>
parents:
16911
diff
changeset
|
710 |
20181
fe0f0a9bb43f
(octave-auto-indent): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17533
diff
changeset
|
711 (defun octave-before-magic-comment-p () |
fe0f0a9bb43f
(octave-auto-indent): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17533
diff
changeset
|
712 (save-excursion |
fe0f0a9bb43f
(octave-auto-indent): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17533
diff
changeset
|
713 (beginning-of-line) |
fe0f0a9bb43f
(octave-auto-indent): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17533
diff
changeset
|
714 (and (bobp) (looking-at "\\s-*#!")))) |
fe0f0a9bb43f
(octave-auto-indent): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17533
diff
changeset
|
715 |
16901 | 716 (defun octave-comment-indent () |
20181
fe0f0a9bb43f
(octave-auto-indent): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17533
diff
changeset
|
717 (if (or (looking-at "\\s<\\s<\\s<") |
fe0f0a9bb43f
(octave-auto-indent): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17533
diff
changeset
|
718 (octave-before-magic-comment-p)) |
16901 | 719 0 |
720 (if (looking-at "\\s<\\s<") | |
721 (calculate-octave-indent) | |
722 (skip-syntax-backward " ") | |
17151
0663a5ce936c
(octave-abbrev-table): Add abbrevs for switch,
Karl Heuer <kwzh@gnu.org>
parents:
16911
diff
changeset
|
723 (max (if (bolp) 0 (+ 1 (current-column))) |
16901 | 724 comment-column)))) |
725 | |
726 (defun octave-indent-for-comment () | |
727 "Maybe insert and indent an Octave comment. | |
728 If there is no comment already on this line, create a code-level comment | |
41773 | 729 \(started by two comment characters) if the line is empty, or an in-line |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49334
diff
changeset
|
730 comment (started by one comment character) otherwise. |
16901 | 731 Point is left after the start of the comment which is properly aligned." |
732 (interactive) | |
733 (indent-for-comment) | |
734 (indent-according-to-mode)) | |
735 | |
736 (defun octave-indent-line (&optional arg) | |
737 "Indent current line as Octave code. | |
738 With optional ARG, use this as offset unless this line is a comment with | |
739 fixed goal column." | |
740 (interactive) | |
741 (or arg (setq arg 0)) | |
742 (let ((icol (calculate-octave-indent)) | |
743 (relpos (- (current-column) (current-indentation)))) | |
744 (if (listp icol) | |
745 (setq icol (car icol)) | |
746 (setq icol (+ icol arg))) | |
747 (if (< icol 0) | |
748 (error "Unmatched end keyword") | |
749 (indent-line-to icol) | |
750 (if (> relpos 0) | |
751 (move-to-column (+ icol relpos)))))) | |
752 | |
753 (defun octave-indent-new-comment-line () | |
754 "Break Octave line at point, continuing comment if within one. | |
755 If within code, insert `octave-continuation-string' before breaking the | |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49334
diff
changeset
|
756 line. If within a string, signal an error. |
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49334
diff
changeset
|
757 The new line is properly indented." |
16901 | 758 (interactive) |
759 (delete-horizontal-space) | |
760 (cond | |
761 ((octave-in-comment-p) | |
762 (indent-new-comment-line)) | |
763 ((octave-in-string-p) | |
764 (error "Cannot split a code line inside a string")) | |
765 (t | |
766 (insert (concat " " octave-continuation-string)) | |
767 (octave-reindent-then-newline-and-indent)))) | |
768 | |
769 (defun octave-indent-defun () | |
770 "Properly indents the Octave function which contains point." | |
771 (interactive) | |
772 (save-excursion | |
773 (octave-mark-defun) | |
774 (message "Indenting function...") | |
775 (indent-region (point) (mark) nil)) | |
776 (message "Indenting function...done.")) | |
777 | |
778 | |
779 ;;; Motion | |
780 (defun octave-next-code-line (&optional arg) | |
781 "Move ARG lines of Octave code forward (backward if ARG is negative). | |
782 Skips past all empty and comment lines. Default for ARG is 1. | |
783 | |
784 On success, return 0. Otherwise, go as far as possible and return -1." | |
785 (interactive "p") | |
786 (or arg (setq arg 1)) | |
787 (beginning-of-line) | |
788 (let ((n 0) | |
789 (inc (if (> arg 0) 1 -1))) | |
790 (while (and (/= arg 0) (= n 0)) | |
791 (setq n (forward-line inc)) | |
792 (while (and (= n 0) | |
793 (looking-at "\\s-*\\($\\|\\s<\\)")) | |
794 (setq n (forward-line inc))) | |
795 (setq arg (- arg inc))) | |
796 n)) | |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49334
diff
changeset
|
797 |
16901 | 798 (defun octave-previous-code-line (&optional arg) |
799 "Move ARG lines of Octave code backward (forward if ARG is negative). | |
800 Skips past all empty and comment lines. Default for ARG is 1. | |
801 | |
802 On success, return 0. Otherwise, go as far as possible and return -1." | |
803 (interactive "p") | |
804 (or arg (setq arg 1)) | |
805 (octave-next-code-line (- arg))) | |
806 | |
807 (defun octave-beginning-of-line () | |
808 "Move point to beginning of current Octave line. | |
809 If on an empty or comment line, go to the beginning of that line. | |
810 Otherwise, move backward to the beginning of the first Octave code line | |
811 which is not inside a continuation statement, i.e., which does not | |
812 follow a code line ending in `...' or `\\', or is inside an open | |
813 parenthesis list." | |
814 (interactive) | |
815 (beginning-of-line) | |
816 (if (not (looking-at "\\s-*\\($\\|\\s<\\)")) | |
817 (while (or (condition-case nil | |
818 (progn | |
819 (up-list -1) | |
820 (beginning-of-line) | |
821 t) | |
822 (error nil)) | |
823 (and (or (looking-at "\\s-*\\($\\|\\s<\\)") | |
824 (save-excursion | |
825 (if (zerop (octave-previous-code-line)) | |
826 (looking-at octave-continuation-regexp)))) | |
827 (zerop (forward-line -1))))))) | |
828 | |
829 (defun octave-end-of-line () | |
830 "Move point to end of current Octave line. | |
831 If on an empty or comment line, go to the end of that line. | |
832 Otherwise, move forward to the end of the first Octave code line which | |
833 does not end in `...' or `\\' or is inside an open parenthesis list." | |
834 (interactive) | |
835 (end-of-line) | |
836 (if (save-excursion | |
837 (beginning-of-line) | |
838 (looking-at "\\s-*\\($\\|\\s<\\)")) | |
839 () | |
840 (while (or (condition-case nil | |
841 (progn | |
842 (up-list 1) | |
843 (end-of-line) | |
844 t) | |
845 (error nil)) | |
846 (and (save-excursion | |
847 (beginning-of-line) | |
848 (or (looking-at "\\s-*\\($\\|\\s<\\)") | |
849 (looking-at octave-continuation-regexp))) | |
850 (zerop (forward-line 1))))) | |
851 (end-of-line))) | |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49334
diff
changeset
|
852 |
16901 | 853 (defun octave-scan-blocks (from count depth) |
854 "Scan from character number FROM by COUNT Octave begin-end blocks. | |
855 Returns the character number of the position thus found. | |
856 | |
857 If DEPTH is nonzero, block depth begins counting from that value. | |
858 Only places where the depth in blocks becomes zero are candidates for | |
859 stopping; COUNT such places are counted. | |
860 | |
861 If the beginning or end of the buffer is reached and the depth is wrong, | |
862 an error is signaled." | |
863 (let ((min-depth (if (> depth 0) 0 depth)) | |
864 (inc (if (> count 0) 1 -1))) | |
865 (save-excursion | |
866 (while (/= count 0) | |
867 (catch 'foo | |
868 (while (or (re-search-forward | |
869 octave-block-begin-or-end-regexp nil 'move inc) | |
870 (if (/= depth 0) | |
871 (error "Unbalanced block"))) | |
872 (if (octave-not-in-string-or-comment-p) | |
873 (progn | |
874 (cond | |
875 ((match-end 1) | |
876 (setq depth (+ depth inc))) | |
877 ((match-end 2) | |
878 (setq depth (- depth inc)))) | |
879 (if (< depth min-depth) | |
880 (error "Containing expression ends prematurely")) | |
881 (if (= depth 0) | |
882 (throw 'foo nil)))))) | |
883 (setq count (- count inc))) | |
884 (point)))) | |
885 | |
886 (defun octave-forward-block (&optional arg) | |
887 "Move forward across one balanced Octave begin-end block. | |
888 With argument, do it that many times. | |
889 Negative arg -N means move backward across N blocks." | |
890 (interactive "p") | |
891 (or arg (setq arg 1)) | |
892 (goto-char (or (octave-scan-blocks (point) arg 0) (buffer-end arg)))) | |
893 | |
894 (defun octave-backward-block (&optional arg) | |
895 "Move backward across one balanced Octave begin-end block. | |
896 With argument, do it that many times. | |
897 Negative arg -N means move forward across N blocks." | |
898 (interactive "p") | |
899 (or arg (setq arg 1)) | |
900 (octave-forward-block (- arg))) | |
901 | |
902 (defun octave-down-block (arg) | |
903 "Move forward down one begin-end block level of Octave code. | |
904 With argument, do this that many times. | |
905 A negative argument means move backward but still go down a level. | |
906 In Lisp programs, an argument is required." | |
907 (interactive "p") | |
908 (let ((inc (if (> arg 0) 1 -1))) | |
909 (while (/= arg 0) | |
910 (goto-char (or (octave-scan-blocks (point) inc -1) | |
911 (buffer-end arg))) | |
912 (setq arg (- arg inc))))) | |
913 | |
914 (defun octave-backward-up-block (arg) | |
915 "Move backward out of one begin-end block level of Octave code. | |
916 With argument, do this that many times. | |
917 A negative argument means move forward but still to a less deep spot. | |
918 In Lisp programs, an argument is required." | |
919 (interactive "p") | |
920 (octave-up-block (- arg))) | |
921 | |
922 (defun octave-up-block (arg) | |
923 "Move forward out of one begin-end block level of Octave code. | |
924 With argument, do this that many times. | |
925 A negative argument means move backward but still to a less deep spot. | |
926 In Lisp programs, an argument is required." | |
927 (interactive "p") | |
928 (let ((inc (if (> arg 0) 1 -1))) | |
929 (while (/= arg 0) | |
930 (goto-char (or (octave-scan-blocks (point) inc 1) | |
931 (buffer-end arg))) | |
932 (setq arg (- arg inc))))) | |
933 | |
934 (defun octave-mark-block () | |
935 "Put point at the beginning of this Octave block, mark at the end. | |
936 The block marked is the one that contains point or follows point." | |
937 (interactive) | |
938 (let ((pos (point))) | |
939 (if (or (and (octave-in-block-p) | |
940 (skip-syntax-forward "w")) | |
941 (condition-case nil | |
942 (progn | |
943 (octave-down-block 1) | |
944 (octave-in-block-p)) | |
945 (error nil))) | |
946 (progn | |
947 (octave-up-block -1) | |
948 (push-mark (point)) | |
949 (octave-forward-block) | |
950 (exchange-point-and-mark)) | |
951 (goto-char pos) | |
952 (message "No block to mark found")))) | |
953 | |
954 (defun octave-close-block () | |
955 "Close the current Octave block on a separate line. | |
956 An error is signaled if no block to close is found." | |
957 (interactive) | |
958 (let (bb-keyword) | |
959 (condition-case nil | |
960 (progn | |
961 (save-excursion | |
962 (octave-backward-up-block 1) | |
963 (setq bb-keyword (buffer-substring-no-properties | |
964 (match-beginning 1) (match-end 1)))) | |
965 (if (save-excursion | |
966 (beginning-of-line) | |
967 (looking-at "^\\s-*$")) | |
968 (indent-according-to-mode) | |
969 (octave-reindent-then-newline-and-indent)) | |
970 (insert (car (reverse | |
971 (assoc bb-keyword | |
972 octave-block-match-alist)))) | |
973 (octave-reindent-then-newline-and-indent) | |
974 t) | |
975 (error (message "No block to close found"))))) | |
976 | |
977 (defun octave-blink-matching-block-open () | |
978 "Blink the matching Octave begin block keyword. | |
979 If point is right after an Octave else or end type block keyword, move | |
980 cursor momentarily to the corresponding begin keyword. | |
981 Signal an error if the keywords are incompatible." | |
982 (interactive) | |
983 (let (bb-keyword bb-arg eb-keyword pos eol) | |
984 (if (and (octave-not-in-string-or-comment-p) | |
985 (looking-at "\\>") | |
986 (save-excursion | |
987 (skip-syntax-backward "w") | |
988 (looking-at octave-block-else-or-end-regexp))) | |
989 (save-excursion | |
990 (cond | |
991 ((match-end 1) | |
992 (setq eb-keyword | |
993 (buffer-substring-no-properties | |
994 (match-beginning 1) (match-end 1))) | |
995 (octave-backward-up-block 1)) | |
996 ((match-end 2) | |
997 (setq eb-keyword | |
998 (buffer-substring-no-properties | |
999 (match-beginning 2) (match-end 2))) | |
1000 (octave-backward-block))) | |
1001 (setq pos (match-end 0) | |
1002 bb-keyword | |
1003 (buffer-substring-no-properties | |
1004 (match-beginning 0) pos) | |
1005 pos (+ pos 1) | |
52930
069cb76731fd
(octave-comment-start): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52401
diff
changeset
|
1006 eol (line-end-position) |
16901 | 1007 bb-arg |
1008 (save-excursion | |
1009 (save-restriction | |
1010 (goto-char pos) | |
1011 (while (and (skip-syntax-forward "^<" eol) | |
1012 (octave-in-string-p) | |
1013 (not (forward-char 1)))) | |
1014 (skip-syntax-backward " ") | |
1015 (buffer-substring-no-properties pos (point))))) | |
1016 (if (member eb-keyword | |
1017 (cdr (assoc bb-keyword octave-block-match-alist))) | |
1018 (progn | |
1019 (message "Matches `%s %s'" bb-keyword bb-arg) | |
1020 (if (pos-visible-in-window-p) | |
1021 (sit-for blink-matching-delay))) | |
1022 (error "Block keywords `%s' and `%s' do not match" | |
1023 bb-keyword eb-keyword)))))) | |
1024 | |
1025 (defun octave-beginning-of-defun (&optional arg) | |
1026 "Move backward to the beginning of an Octave function. | |
1027 With positive ARG, do it that many times. Negative argument -N means | |
1028 move forward to Nth following beginning of a function. | |
1029 Returns t unless search stops at the beginning or end of the buffer." | |
1030 (interactive "p") | |
1031 (let* ((arg (or arg 1)) | |
1032 (inc (if (> arg 0) 1 -1)) | |
1033 (found)) | |
1034 (and (not (eobp)) | |
1035 (not (and (> arg 0) (looking-at "\\<function\\>"))) | |
1036 (skip-syntax-forward "w")) | |
1037 (while (and (/= arg 0) | |
1038 (setq found | |
1039 (re-search-backward "\\<function\\>" nil 'move inc))) | |
1040 (if (octave-not-in-string-or-comment-p) | |
1041 (setq arg (- arg inc)))) | |
1042 (if found | |
1043 (progn | |
1044 (and (< inc 0) (goto-char (match-beginning 0))) | |
1045 t)))) | |
1046 | |
1047 (defun octave-end-of-defun (&optional arg) | |
1048 "Move forward to the end of an Octave function. | |
1049 With positive ARG, do it that many times. Negative argument -N means | |
1050 move back to Nth preceding end of a function. | |
1051 | |
1052 An end of a function occurs right after the end keyword matching the | |
1053 `function' keyword that starts the function." | |
1054 (interactive "p") | |
1055 (or arg (setq arg 1)) | |
1056 (and (< arg 0) (skip-syntax-backward "w")) | |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49334
diff
changeset
|
1057 (and (> arg 0) (skip-syntax-forward "w")) |
16901 | 1058 (if (octave-in-defun-p) |
1059 (setq arg (- arg 1))) | |
1060 (if (= arg 0) (setq arg -1)) | |
1061 (if (octave-beginning-of-defun (- arg)) | |
1062 (octave-forward-block))) | |
1063 | |
1064 (defun octave-mark-defun () | |
1065 "Put point at the beginning of this Octave function, mark at its end. | |
1066 The function marked is the one containing point or following point." | |
1067 (interactive) | |
1068 (let ((pos (point))) | |
1069 (if (or (octave-in-defun-p) | |
1070 (and (octave-beginning-of-defun -1) | |
1071 (octave-in-defun-p))) | |
1072 (progn | |
1073 (skip-syntax-forward "w") | |
1074 (octave-beginning-of-defun) | |
1075 (push-mark (point)) | |
1076 (octave-end-of-defun) | |
1077 (exchange-point-and-mark)) | |
1078 (goto-char pos) | |
1079 (message "No function to mark found")))) | |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49334
diff
changeset
|
1080 |
16901 | 1081 |
1082 ;;; Filling | |
1083 (defun octave-auto-fill () | |
20181
fe0f0a9bb43f
(octave-auto-indent): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17533
diff
changeset
|
1084 "Perform auto-fill in Octave mode. |
fe0f0a9bb43f
(octave-auto-indent): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17533
diff
changeset
|
1085 Returns nil if no feasible place to break the line could be found, and t |
fe0f0a9bb43f
(octave-auto-indent): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17533
diff
changeset
|
1086 otherwise." |
fe0f0a9bb43f
(octave-auto-indent): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17533
diff
changeset
|
1087 (let (fc give-up) |
fe0f0a9bb43f
(octave-auto-indent): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17533
diff
changeset
|
1088 (if (or (null (setq fc (current-fill-column))) |
fe0f0a9bb43f
(octave-auto-indent): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17533
diff
changeset
|
1089 (save-excursion |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49334
diff
changeset
|
1090 (beginning-of-line) |
20181
fe0f0a9bb43f
(octave-auto-indent): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17533
diff
changeset
|
1091 (and auto-fill-inhibit-regexp |
fe0f0a9bb43f
(octave-auto-indent): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17533
diff
changeset
|
1092 (looking-at auto-fill-inhibit-regexp)))) |
fe0f0a9bb43f
(octave-auto-indent): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17533
diff
changeset
|
1093 nil ; Can't do anything |
fe0f0a9bb43f
(octave-auto-indent): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17533
diff
changeset
|
1094 (if (and (not (octave-in-comment-p)) |
fe0f0a9bb43f
(octave-auto-indent): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17533
diff
changeset
|
1095 (> (current-column) fc)) |
fe0f0a9bb43f
(octave-auto-indent): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17533
diff
changeset
|
1096 (setq fc (- fc (+ (length octave-continuation-string) 1)))) |
fe0f0a9bb43f
(octave-auto-indent): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17533
diff
changeset
|
1097 (while (and (not give-up) (> (current-column) fc)) |
fe0f0a9bb43f
(octave-auto-indent): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17533
diff
changeset
|
1098 (let* ((opoint (point)) |
fe0f0a9bb43f
(octave-auto-indent): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17533
diff
changeset
|
1099 (fpoint |
fe0f0a9bb43f
(octave-auto-indent): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17533
diff
changeset
|
1100 (save-excursion |
fe0f0a9bb43f
(octave-auto-indent): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17533
diff
changeset
|
1101 (move-to-column (+ fc 1)) |
fe0f0a9bb43f
(octave-auto-indent): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17533
diff
changeset
|
1102 (skip-chars-backward "^ \t\n") |
fe0f0a9bb43f
(octave-auto-indent): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17533
diff
changeset
|
1103 ;; If we're at the beginning of the line, break after |
fe0f0a9bb43f
(octave-auto-indent): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17533
diff
changeset
|
1104 ;; the first word |
fe0f0a9bb43f
(octave-auto-indent): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17533
diff
changeset
|
1105 (if (bolp) |
fe0f0a9bb43f
(octave-auto-indent): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17533
diff
changeset
|
1106 (re-search-forward "[ \t]" opoint t)) |
fe0f0a9bb43f
(octave-auto-indent): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17533
diff
changeset
|
1107 ;; If we're in a comment line, don't break after the |
fe0f0a9bb43f
(octave-auto-indent): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17533
diff
changeset
|
1108 ;; comment chars |
fe0f0a9bb43f
(octave-auto-indent): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17533
diff
changeset
|
1109 (if (save-excursion |
fe0f0a9bb43f
(octave-auto-indent): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17533
diff
changeset
|
1110 (skip-syntax-backward " <") |
fe0f0a9bb43f
(octave-auto-indent): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17533
diff
changeset
|
1111 (bolp)) |
52930
069cb76731fd
(octave-comment-start): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52401
diff
changeset
|
1112 (re-search-forward "[ \t]" (line-end-position) |
20181
fe0f0a9bb43f
(octave-auto-indent): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17533
diff
changeset
|
1113 'move)) |
fe0f0a9bb43f
(octave-auto-indent): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17533
diff
changeset
|
1114 ;; If we're not in a comment line and just ahead the |
fe0f0a9bb43f
(octave-auto-indent): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17533
diff
changeset
|
1115 ;; continuation string, don't break here. |
fe0f0a9bb43f
(octave-auto-indent): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17533
diff
changeset
|
1116 (if (and (not (octave-in-comment-p)) |
fe0f0a9bb43f
(octave-auto-indent): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17533
diff
changeset
|
1117 (looking-at |
fe0f0a9bb43f
(octave-auto-indent): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17533
diff
changeset
|
1118 (concat "\\s-*" |
fe0f0a9bb43f
(octave-auto-indent): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17533
diff
changeset
|
1119 (regexp-quote |
fe0f0a9bb43f
(octave-auto-indent): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17533
diff
changeset
|
1120 octave-continuation-string) |
fe0f0a9bb43f
(octave-auto-indent): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17533
diff
changeset
|
1121 "\\s-*$"))) |
fe0f0a9bb43f
(octave-auto-indent): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17533
diff
changeset
|
1122 (end-of-line)) |
fe0f0a9bb43f
(octave-auto-indent): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17533
diff
changeset
|
1123 (skip-chars-backward " \t") |
fe0f0a9bb43f
(octave-auto-indent): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17533
diff
changeset
|
1124 (point)))) |
fe0f0a9bb43f
(octave-auto-indent): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17533
diff
changeset
|
1125 (if (save-excursion |
fe0f0a9bb43f
(octave-auto-indent): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17533
diff
changeset
|
1126 (goto-char fpoint) |
fe0f0a9bb43f
(octave-auto-indent): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17533
diff
changeset
|
1127 (not (or (bolp) (eolp)))) |
fe0f0a9bb43f
(octave-auto-indent): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17533
diff
changeset
|
1128 (let ((prev-column (current-column))) |
fe0f0a9bb43f
(octave-auto-indent): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17533
diff
changeset
|
1129 (if (save-excursion |
fe0f0a9bb43f
(octave-auto-indent): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17533
diff
changeset
|
1130 (skip-chars-backward " \t") |
fe0f0a9bb43f
(octave-auto-indent): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17533
diff
changeset
|
1131 (= (point) fpoint)) |
fe0f0a9bb43f
(octave-auto-indent): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17533
diff
changeset
|
1132 (progn |
fe0f0a9bb43f
(octave-auto-indent): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17533
diff
changeset
|
1133 (octave-maybe-insert-continuation-string) |
fe0f0a9bb43f
(octave-auto-indent): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17533
diff
changeset
|
1134 (indent-new-comment-line t)) |
fe0f0a9bb43f
(octave-auto-indent): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17533
diff
changeset
|
1135 (save-excursion |
fe0f0a9bb43f
(octave-auto-indent): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17533
diff
changeset
|
1136 (goto-char fpoint) |
fe0f0a9bb43f
(octave-auto-indent): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17533
diff
changeset
|
1137 (octave-maybe-insert-continuation-string) |
fe0f0a9bb43f
(octave-auto-indent): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17533
diff
changeset
|
1138 (indent-new-comment-line t))) |
fe0f0a9bb43f
(octave-auto-indent): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17533
diff
changeset
|
1139 (if (>= (current-column) prev-column) |
fe0f0a9bb43f
(octave-auto-indent): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17533
diff
changeset
|
1140 (setq give-up t))) |
fe0f0a9bb43f
(octave-auto-indent): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17533
diff
changeset
|
1141 (setq give-up t)))) |
fe0f0a9bb43f
(octave-auto-indent): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17533
diff
changeset
|
1142 (not give-up)))) |
16901 | 1143 |
1144 (defun octave-fill-paragraph (&optional arg) | |
1145 "Fill paragraph of Octave code, handling Octave comments." | |
1146 (interactive "P") | |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49334
diff
changeset
|
1147 (save-excursion |
16901 | 1148 (let ((end (progn (forward-paragraph) (point))) |
1149 (beg (progn | |
1150 (forward-paragraph -1) | |
1151 (skip-chars-forward " \t\n") | |
1152 (beginning-of-line) | |
1153 (point))) | |
1154 (cfc (current-fill-column)) | |
1155 (ind (calculate-octave-indent)) | |
1156 comment-prefix) | |
1157 (save-restriction | |
1158 (goto-char beg) | |
1159 (narrow-to-region beg end) | |
1160 (if (listp ind) (setq ind (nth 1 ind))) | |
1161 (while (not (eobp)) | |
1162 (condition-case nil | |
1163 (octave-indent-line ind) | |
1164 (error nil)) | |
1165 (if (and (> ind 0) | |
1166 (not | |
1167 (save-excursion | |
1168 (beginning-of-line) | |
1169 (looking-at "^\\s-*\\($\\|\\s<+\\)")))) | |
1170 (setq ind 0)) | |
1171 (move-to-column cfc) | |
1172 ;; First check whether we need to combine non-empty comment lines | |
1173 (if (and (< (current-column) cfc) | |
1174 (octave-in-comment-p) | |
1175 (not (save-excursion | |
1176 (beginning-of-line) | |
1177 (looking-at "^\\s-*\\s<+\\s-*$")))) | |
1178 ;; This is a nonempty comment line which does not extend | |
47939
5f47d61ffbdc
Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents:
42445
diff
changeset
|
1179 ;; past the fill column. If it is followed by a nonempty |
16901 | 1180 ;; comment line with the same comment prefix, try to |
1181 ;; combine them, and repeat this until either we reach the | |
1182 ;; fill-column or there is nothing more to combine. | |
1183 (progn | |
1184 ;; Get the comment prefix | |
1185 (save-excursion | |
1186 (beginning-of-line) | |
1187 (while (and (re-search-forward "\\s<+") | |
1188 (not (octave-in-comment-p)))) | |
1189 (setq comment-prefix (match-string 0))) | |
1190 ;; And keep combining ... | |
1191 (while (and (< (current-column) cfc) | |
1192 (save-excursion | |
1193 (forward-line 1) | |
1194 (and (looking-at | |
1195 (concat "^\\s-*" | |
1196 comment-prefix | |
1197 "\\S<")) | |
1198 (not (looking-at | |
1199 (concat "^\\s-*" | |
1200 comment-prefix | |
1201 "\\s-*$")))))) | |
1202 (delete-char 1) | |
1203 (re-search-forward comment-prefix) | |
1204 (delete-region (match-beginning 0) (match-end 0)) | |
1205 (fixup-whitespace) | |
1206 (move-to-column cfc)))) | |
20181
fe0f0a9bb43f
(octave-auto-indent): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17533
diff
changeset
|
1207 ;; We might also try to combine continued code lines> Perhaps |
fe0f0a9bb43f
(octave-auto-indent): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17533
diff
changeset
|
1208 ;; some other time ... |
16901 | 1209 (skip-chars-forward "^ \t\n") |
1210 (delete-horizontal-space) | |
1211 (if (or (< (current-column) cfc) | |
1212 (and (= (current-column) cfc) (eolp))) | |
1213 (forward-line 1) | |
1214 (if (not (eolp)) (insert " ")) | |
20181
fe0f0a9bb43f
(octave-auto-indent): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17533
diff
changeset
|
1215 (or (octave-auto-fill) |
fe0f0a9bb43f
(octave-auto-indent): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17533
diff
changeset
|
1216 (forward-line 1))))) |
16901 | 1217 t))) |
1218 | |
1219 | |
1220 ;;; Completions | |
1221 (defun octave-initialize-completions () | |
1222 "Create an alist for Octave completions." | |
1223 (if octave-completion-alist | |
1224 () | |
1225 (setq octave-completion-alist | |
1226 (mapcar '(lambda (var) (cons var var)) | |
1227 (append octave-reserved-words | |
1228 octave-text-functions | |
1229 octave-variables))))) | |
1230 | |
1231 (defun octave-complete-symbol () | |
1232 "Perform completion on Octave symbol preceding point. | |
1233 Compare that symbol against Octave's reserved words and builtin | |
1234 variables." | |
1235 ;; This code taken from lisp-complete-symbol | |
1236 (interactive) | |
1237 (let* ((end (point)) | |
1238 (beg (save-excursion (backward-sexp 1) (point))) | |
1239 (string (buffer-substring-no-properties beg end)) | |
1240 (completion (try-completion string octave-completion-alist))) | |
1241 (cond ((eq completion t)) ; ??? | |
1242 ((null completion) | |
1243 (message "Can't find completion for \"%s\"" string) | |
1244 (ding)) | |
1245 ((not (string= string completion)) | |
1246 (delete-region beg end) | |
1247 (insert completion)) | |
1248 (t | |
1249 (let ((list (all-completions string octave-completion-alist)) | |
1250 (conf (current-window-configuration))) | |
1251 ;; Taken from comint.el | |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49334
diff
changeset
|
1252 (message "Making completion list...") |
16901 | 1253 (with-output-to-temp-buffer "*Completions*" |
1254 (display-completion-list list)) | |
1255 (message "Hit space to flush") | |
1256 (let (key first) | |
1257 (if (save-excursion | |
1258 (set-buffer (get-buffer "*Completions*")) | |
1259 (setq key (read-key-sequence nil) | |
1260 first (aref key 0)) | |
1261 (and (consp first) (consp (event-start first)) | |
1262 (eq (window-buffer (posn-window (event-start | |
1263 first))) | |
1264 (get-buffer "*Completions*")) | |
1265 (eq (key-binding key) 'mouse-choose-completion))) | |
1266 (progn | |
1267 (mouse-choose-completion first) | |
1268 (set-window-configuration conf)) | |
1269 (if (eq first ?\ ) | |
1270 (set-window-configuration conf) | |
1271 (setq unread-command-events | |
1272 (listify-key-sequence key)))))))))) | |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49334
diff
changeset
|
1273 |
16901 | 1274 |
1275 ;;; Electric characters && friends | |
1276 (defun octave-reindent-then-newline-and-indent () | |
1277 "Reindent current Octave line, insert newline, and indent the new line. | |
1278 If Abbrev mode is on, expand abbrevs first." | |
1279 (interactive) | |
1280 (if abbrev-mode (expand-abbrev)) | |
1281 (if octave-blink-matching-block | |
1282 (octave-blink-matching-block-open)) | |
1283 (save-excursion | |
1284 (delete-region (point) (progn (skip-chars-backward " \t") (point))) | |
1285 (indent-according-to-mode)) | |
1286 (insert "\n") | |
1287 (indent-according-to-mode)) | |
1288 | |
1289 (defun octave-electric-semi () | |
1290 "Insert a semicolon in Octave mode. | |
20181
fe0f0a9bb43f
(octave-auto-indent): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17533
diff
changeset
|
1291 Maybe expand abbrevs and blink matching block open keywords. |
fe0f0a9bb43f
(octave-auto-indent): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17533
diff
changeset
|
1292 Reindent the line of `octave-auto-indent' is non-nil. |
fe0f0a9bb43f
(octave-auto-indent): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17533
diff
changeset
|
1293 Insert a newline if `octave-auto-newline' is non-nil." |
16901 | 1294 (interactive) |
1295 (if (not (octave-not-in-string-or-comment-p)) | |
1296 (insert ";") | |
1297 (if abbrev-mode (expand-abbrev)) | |
1298 (if octave-blink-matching-block | |
1299 (octave-blink-matching-block-open)) | |
20181
fe0f0a9bb43f
(octave-auto-indent): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17533
diff
changeset
|
1300 (if octave-auto-indent |
fe0f0a9bb43f
(octave-auto-indent): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17533
diff
changeset
|
1301 (indent-according-to-mode)) |
16901 | 1302 (insert ";") |
1303 (if octave-auto-newline | |
1304 (newline-and-indent)))) | |
1305 | |
1306 (defun octave-electric-space () | |
1307 "Insert a space in Octave mode. | |
20181
fe0f0a9bb43f
(octave-auto-indent): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17533
diff
changeset
|
1308 Maybe expand abbrevs and blink matching block open keywords. |
fe0f0a9bb43f
(octave-auto-indent): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17533
diff
changeset
|
1309 Reindent the line of `octave-auto-indent' is non-nil." |
16901 | 1310 (interactive) |
1311 (setq last-command-char ? ) | |
1312 (if (not (octave-not-in-string-or-comment-p)) | |
1313 (progn | |
1314 (indent-according-to-mode) | |
1315 (self-insert-command 1)) | |
1316 (if abbrev-mode (expand-abbrev)) | |
1317 (if octave-blink-matching-block | |
1318 (octave-blink-matching-block-open)) | |
20181
fe0f0a9bb43f
(octave-auto-indent): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17533
diff
changeset
|
1319 (if (and octave-auto-indent |
fe0f0a9bb43f
(octave-auto-indent): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17533
diff
changeset
|
1320 (save-excursion |
fe0f0a9bb43f
(octave-auto-indent): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17533
diff
changeset
|
1321 (skip-syntax-backward " ") |
fe0f0a9bb43f
(octave-auto-indent): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17533
diff
changeset
|
1322 (not (bolp)))) |
16901 | 1323 (indent-according-to-mode)) |
1324 (self-insert-command 1))) | |
1325 | |
1326 (defun octave-abbrev-start () | |
1327 "Start entering an Octave abbreviation. | |
1328 If Abbrev mode is turned on, typing ` (grave accent) followed by ? or | |
1329 \\[help-command] lists all Octave abbrevs. Any other key combination is | |
1330 executed normally. | |
1331 Note that all Octave mode abbrevs start with a grave accent." | |
1332 (interactive) | |
1333 (if (not abbrev-mode) | |
1334 (self-insert-command 1) | |
1335 (let (c) | |
1336 (insert last-command-char) | |
23848
7896e341d77f
(octave-abbrev-start): Use the correct
Karl Heuer <kwzh@gnu.org>
parents:
21669
diff
changeset
|
1337 (if (if octave-xemacs-p |
7896e341d77f
(octave-abbrev-start): Use the correct
Karl Heuer <kwzh@gnu.org>
parents:
21669
diff
changeset
|
1338 (or (eq (event-to-character (setq c (next-event))) ??) |
7896e341d77f
(octave-abbrev-start): Use the correct
Karl Heuer <kwzh@gnu.org>
parents:
21669
diff
changeset
|
1339 (eq (event-to-character c) help-char)) |
7896e341d77f
(octave-abbrev-start): Use the correct
Karl Heuer <kwzh@gnu.org>
parents:
21669
diff
changeset
|
1340 (or (eq (setq c (read-event)) ??) |
7896e341d77f
(octave-abbrev-start): Use the correct
Karl Heuer <kwzh@gnu.org>
parents:
21669
diff
changeset
|
1341 (eq c help-char))) |
7896e341d77f
(octave-abbrev-start): Use the correct
Karl Heuer <kwzh@gnu.org>
parents:
21669
diff
changeset
|
1342 (let ((abbrev-table-name-list '(octave-abbrev-table))) |
16901 | 1343 (list-abbrevs)) |
1344 (setq unread-command-events (list c)))))) | |
1345 | |
1346 (defun octave-insert-defun (name args vals) | |
1347 "Insert an Octave function skeleton. | |
1348 Prompt for the function's name, arguments and return values (to be | |
1349 entered without parens)." | |
1350 (interactive | |
1351 (list | |
1352 (read-from-minibuffer "Function name: " | |
1353 (substring (buffer-name) 0 -2)) | |
1354 (read-from-minibuffer "Arguments: ") | |
1355 (read-from-minibuffer "Return values: "))) | |
1356 (let ((string (format "%s %s (%s)" | |
1357 (cond | |
1358 ((string-equal vals "") | |
1359 vals) | |
1360 ((string-match "[ ,]" vals) | |
1361 (concat " [" vals "] =")) | |
1362 (t | |
1363 (concat " " vals " ="))) | |
1364 name | |
1365 args)) | |
1366 (prefix octave-block-comment-start)) | |
1367 (if (not (bobp)) (newline)) | |
1368 (insert "function" string) | |
1369 (indent-according-to-mode) | |
1370 (newline 2) | |
1371 (insert prefix "usage: " string) | |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49334
diff
changeset
|
1372 (reindent-then-newline-and-indent) |
16901 | 1373 (insert prefix) |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49334
diff
changeset
|
1374 (reindent-then-newline-and-indent) |
16901 | 1375 (insert prefix) |
1376 (indent-according-to-mode) | |
1377 (save-excursion | |
1378 (newline 2) | |
1379 (insert "endfunction") | |
1380 (indent-according-to-mode)))) | |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49334
diff
changeset
|
1381 |
16901 | 1382 |
1383 ;;; Menu | |
1384 (defun octave-add-octave-menu () | |
1385 "Adds the `Octave' menu to the menu bar in Octave mode." | |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49334
diff
changeset
|
1386 (require 'easymenu) |
16901 | 1387 (easy-menu-define octave-mode-menu-map octave-mode-map |
1388 "Menu keymap for Octave mode." octave-mode-menu) | |
1389 (easy-menu-add octave-mode-menu-map octave-mode-map)) | |
1390 | |
1391 | |
1392 ;;; Communication with the inferior Octave process | |
1393 (defun octave-kill-process () | |
1394 "Kill inferior Octave process and its buffer." | |
1395 (interactive) | |
1396 (if inferior-octave-process | |
1397 (progn | |
1398 (process-send-string inferior-octave-process "quit;\n") | |
1399 (accept-process-output inferior-octave-process))) | |
1400 (if inferior-octave-buffer | |
1401 (kill-buffer inferior-octave-buffer))) | |
1402 | |
1403 (defun octave-show-process-buffer () | |
1404 "Make sure that `inferior-octave-buffer' is displayed." | |
1405 (interactive) | |
1406 (if (get-buffer inferior-octave-buffer) | |
1407 (display-buffer inferior-octave-buffer) | |
1408 (message "No buffer named %s" inferior-octave-buffer))) | |
1409 | |
1410 (defun octave-hide-process-buffer () | |
1411 "Delete all windows that display `inferior-octave-buffer'." | |
1412 (interactive) | |
1413 (if (get-buffer inferior-octave-buffer) | |
1414 (delete-windows-on inferior-octave-buffer) | |
1415 (message "No buffer named %s" inferior-octave-buffer))) | |
1416 | |
1417 (defun octave-send-region (beg end) | |
1418 "Send current region to the inferior Octave process." | |
1419 (interactive "r") | |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49334
diff
changeset
|
1420 (inferior-octave t) |
16901 | 1421 (let ((proc inferior-octave-process) |
1422 (string (buffer-substring-no-properties beg end)) | |
1423 line) | |
1424 (save-excursion | |
1425 (set-buffer inferior-octave-buffer) | |
1426 (setq inferior-octave-output-list nil) | |
1427 (while (not (string-equal string "")) | |
1428 (if (string-match "\n" string) | |
1429 (setq line (substring string 0 (match-beginning 0)) | |
1430 string (substring string (match-end 0))) | |
1431 (setq line string string "")) | |
1432 (setq inferior-octave-receive-in-progress t) | |
1433 (inferior-octave-send-list-and-digest (list (concat line "\n"))) | |
1434 (while inferior-octave-receive-in-progress | |
1435 (accept-process-output proc)) | |
1436 (insert-before-markers | |
1437 (mapconcat 'identity | |
1438 (append | |
1439 (if octave-send-echo-input (list line) (list "")) | |
1440 (mapcar 'inferior-octave-strip-ctrl-g | |
1441 inferior-octave-output-list) | |
1442 (list inferior-octave-output-string)) | |
1443 "\n"))))) | |
1444 (if octave-send-show-buffer | |
1445 (display-buffer inferior-octave-buffer))) | |
1446 | |
1447 (defun octave-send-block () | |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49334
diff
changeset
|
1448 "Send current Octave block to the inferior Octave process." |
16901 | 1449 (interactive) |
1450 (save-excursion | |
1451 (octave-mark-block) | |
1452 (octave-send-region (point) (mark)))) | |
1453 | |
1454 (defun octave-send-defun () | |
1455 "Send current Octave function to the inferior Octave process." | |
1456 (interactive) | |
1457 (save-excursion | |
1458 (octave-mark-defun) | |
1459 (octave-send-region (point) (mark)))) | |
1460 | |
1461 (defun octave-send-line (&optional arg) | |
1462 "Send current Octave code line to the inferior Octave process. | |
1463 With positive prefix ARG, send that many lines. | |
1464 If `octave-send-line-auto-forward' is non-nil, go to the next unsent | |
1465 code line." | |
1466 (interactive "P") | |
1467 (or arg (setq arg 1)) | |
1468 (if (> arg 0) | |
1469 (let (beg end) | |
1470 (beginning-of-line) | |
1471 (setq beg (point)) | |
1472 (octave-next-code-line (- arg 1)) | |
1473 (end-of-line) | |
1474 (setq end (point)) | |
1475 (if octave-send-line-auto-forward | |
1476 (octave-next-code-line 1)) | |
1477 (octave-send-region beg end)))) | |
1478 | |
1479 (defun octave-eval-print-last-sexp () | |
1480 "Evaluate Octave sexp before point and print value into current buffer." | |
1481 (interactive) | |
1482 (inferior-octave t) | |
1483 (let ((standard-output (current-buffer)) | |
1484 (print-escape-newlines nil) | |
1485 (opoint (point))) | |
1486 (terpri) | |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49334
diff
changeset
|
1487 (prin1 |
16901 | 1488 (save-excursion |
1489 (forward-sexp -1) | |
1490 (inferior-octave-send-list-and-digest | |
1491 (list (concat (buffer-substring-no-properties (point) opoint) | |
1492 "\n"))) | |
1493 (mapconcat 'identity inferior-octave-output-list "\n"))) | |
1494 (terpri))) | |
16905
a93836c8b52b
Merge in octave.el; don't require octave.el.
Richard M. Stallman <rms@gnu.org>
parents:
16902
diff
changeset
|
1495 |
a93836c8b52b
Merge in octave.el; don't require octave.el.
Richard M. Stallman <rms@gnu.org>
parents:
16902
diff
changeset
|
1496 ;;; Bug reporting |
a93836c8b52b
Merge in octave.el; don't require octave.el.
Richard M. Stallman <rms@gnu.org>
parents:
16902
diff
changeset
|
1497 (defun octave-submit-bug-report () |
a93836c8b52b
Merge in octave.el; don't require octave.el.
Richard M. Stallman <rms@gnu.org>
parents:
16902
diff
changeset
|
1498 "Submit a bug report on the Emacs Octave package via mail." |
a93836c8b52b
Merge in octave.el; don't require octave.el.
Richard M. Stallman <rms@gnu.org>
parents:
16902
diff
changeset
|
1499 (interactive) |
a93836c8b52b
Merge in octave.el; don't require octave.el.
Richard M. Stallman <rms@gnu.org>
parents:
16902
diff
changeset
|
1500 (require 'reporter) |
a93836c8b52b
Merge in octave.el; don't require octave.el.
Richard M. Stallman <rms@gnu.org>
parents:
16902
diff
changeset
|
1501 (and |
a93836c8b52b
Merge in octave.el; don't require octave.el.
Richard M. Stallman <rms@gnu.org>
parents:
16902
diff
changeset
|
1502 (y-or-n-p "Do you want to submit a bug report? ") |
a93836c8b52b
Merge in octave.el; don't require octave.el.
Richard M. Stallman <rms@gnu.org>
parents:
16902
diff
changeset
|
1503 (reporter-submit-bug-report |
a93836c8b52b
Merge in octave.el; don't require octave.el.
Richard M. Stallman <rms@gnu.org>
parents:
16902
diff
changeset
|
1504 octave-maintainer-address |
a93836c8b52b
Merge in octave.el; don't require octave.el.
Richard M. Stallman <rms@gnu.org>
parents:
16902
diff
changeset
|
1505 (concat "Emacs version " emacs-version) |
a93836c8b52b
Merge in octave.el; don't require octave.el.
Richard M. Stallman <rms@gnu.org>
parents:
16902
diff
changeset
|
1506 (list |
20181
fe0f0a9bb43f
(octave-auto-indent): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17533
diff
changeset
|
1507 'octave-auto-indent |
16905
a93836c8b52b
Merge in octave.el; don't require octave.el.
Richard M. Stallman <rms@gnu.org>
parents:
16902
diff
changeset
|
1508 'octave-auto-newline |
a93836c8b52b
Merge in octave.el; don't require octave.el.
Richard M. Stallman <rms@gnu.org>
parents:
16902
diff
changeset
|
1509 'octave-blink-matching-block |
a93836c8b52b
Merge in octave.el; don't require octave.el.
Richard M. Stallman <rms@gnu.org>
parents:
16902
diff
changeset
|
1510 'octave-block-offset |
a93836c8b52b
Merge in octave.el; don't require octave.el.
Richard M. Stallman <rms@gnu.org>
parents:
16902
diff
changeset
|
1511 'octave-comment-char |
a93836c8b52b
Merge in octave.el; don't require octave.el.
Richard M. Stallman <rms@gnu.org>
parents:
16902
diff
changeset
|
1512 'octave-continuation-offset |
a93836c8b52b
Merge in octave.el; don't require octave.el.
Richard M. Stallman <rms@gnu.org>
parents:
16902
diff
changeset
|
1513 'octave-continuation-string |
a93836c8b52b
Merge in octave.el; don't require octave.el.
Richard M. Stallman <rms@gnu.org>
parents:
16902
diff
changeset
|
1514 'octave-help-files |
a93836c8b52b
Merge in octave.el; don't require octave.el.
Richard M. Stallman <rms@gnu.org>
parents:
16902
diff
changeset
|
1515 'octave-mode-startup-message |
a93836c8b52b
Merge in octave.el; don't require octave.el.
Richard M. Stallman <rms@gnu.org>
parents:
16902
diff
changeset
|
1516 'octave-send-echo-input |
a93836c8b52b
Merge in octave.el; don't require octave.el.
Richard M. Stallman <rms@gnu.org>
parents:
16902
diff
changeset
|
1517 'octave-send-line-auto-forward |
a93836c8b52b
Merge in octave.el; don't require octave.el.
Richard M. Stallman <rms@gnu.org>
parents:
16902
diff
changeset
|
1518 'octave-send-show-buffer)))) |
a93836c8b52b
Merge in octave.el; don't require octave.el.
Richard M. Stallman <rms@gnu.org>
parents:
16902
diff
changeset
|
1519 |
a93836c8b52b
Merge in octave.el; don't require octave.el.
Richard M. Stallman <rms@gnu.org>
parents:
16902
diff
changeset
|
1520 ;;; provide ourself |
a93836c8b52b
Merge in octave.el; don't require octave.el.
Richard M. Stallman <rms@gnu.org>
parents:
16902
diff
changeset
|
1521 |
16911
123d19079d9f
Delete explicit autoload calls.
Richard M. Stallman <rms@gnu.org>
parents:
16905
diff
changeset
|
1522 (provide 'octave-mod) |
16905
a93836c8b52b
Merge in octave.el; don't require octave.el.
Richard M. Stallman <rms@gnu.org>
parents:
16902
diff
changeset
|
1523 |
52401 | 1524 ;;; arch-tag: 05f1ce09-be87-4c00-803e-4919ffa26c23 |
16905
a93836c8b52b
Merge in octave.el; don't require octave.el.
Richard M. Stallman <rms@gnu.org>
parents:
16902
diff
changeset
|
1525 ;;; octave-mod.el ends here |