annotate lisp/progmodes/simula.el @ 14621:f989cff391f1

(canonically-space-region): Use insert-before-markers when inserting spaces at end of line. (fill-region-as-paragraph): New arg SQUEEZE-AFTER.
author Karl Heuer <kwzh@gnu.org>
date Wed, 21 Feb 1996 21:20:28 +0000
parents 35a18ea09b7b
children 68d9a01cfb23
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
805
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1 ;;; simula.el --- SIMULA 87 code editing commands for Emacs
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
2
841
2cdce064065f entered into RCS
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 810
diff changeset
3 ;; Copyright (C) 1992 Free Software Foundation, Inc.
2cdce064065f entered into RCS
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 810
diff changeset
4
810
80303373daae *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 805
diff changeset
5 ;; Author: Hans Henrik Eriksen <hhe@ifi.uio.no>
80303373daae *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 805
diff changeset
6 ;; Maintainer: simula-mode@ifi.uio.no
4665
c791d8c3bdec Fix version in comment.
Richard M. Stallman <rms@gnu.org>
parents: 4664
diff changeset
7 ;; Version: 0.992
810
80303373daae *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 805
diff changeset
8 ;; Adapted-By: ESR
80303373daae *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 805
diff changeset
9 ;; Keywords: languages
80303373daae *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 805
diff changeset
10
805
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
11 ;; This file is part of GNU Emacs.
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
12
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
13 ;; GNU Emacs is free software; you can redistribute it and/or modify
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
14 ;; it under the terms of the GNU General Public License as published by
4664
b26469d5e812 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
15 ;; the Free Software Foundation; either version 2, or (at your option)
805
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
16 ;; any later version.
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
17
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
18 ;; GNU Emacs is distributed in the hope that it will be useful,
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
19 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
20 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
21 ;; GNU General Public License for more details.
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
22
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
23 ;; You should have received a copy of the GNU General Public License
14169
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 10895
diff changeset
24 ;; along with GNU Emacs; see the file COPYING. If not, write to the
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 10895
diff changeset
25 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 10895
diff changeset
26 ;; Boston, MA 02111-1307, USA.
805
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
27
810
80303373daae *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 805
diff changeset
28 ;;; Commentary:
80303373daae *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 805
diff changeset
29
2315
9e7ec92a4fdf Added or corrected Commentary headers
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2024
diff changeset
30 ;; A major mode for editing the Simula language. It knows about Simula
9e7ec92a4fdf Added or corrected Commentary headers
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2024
diff changeset
31 ;; syntax and standard indentation commands. It also provides convenient
9e7ec92a4fdf Added or corrected Commentary headers
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2024
diff changeset
32 ;; abbrevs for Simula keywords.
9e7ec92a4fdf Added or corrected Commentary headers
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2024
diff changeset
33 ;;
9e7ec92a4fdf Added or corrected Commentary headers
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2024
diff changeset
34 ;; Hans Henrik Eriksen (the author) may be reached at:
805
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
35 ;; Institutt for informatikk,
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
36 ;; Universitetet i Oslo
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
37
810
80303373daae *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 805
diff changeset
38 ;;; Code:
805
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
39
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
40 (provide 'simula-mode)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
41
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
42 (defconst simula-tab-always-indent nil
4664
b26469d5e812 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
43 "*Non-nil means TAB in SIMULA mode should always reindent the current line.
b26469d5e812 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
44 Otherwise TAB indents only when point is within
b26469d5e812 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
45 the run of whitespace at the beginning of the line.")
805
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
46
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
47 (defconst simula-indent-level 3
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
48 "*Indentation of SIMULA statements with respect to containing block.")
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
49
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
50 (defconst simula-substatement-offset 3
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
51 "*Extra indentation after DO, THEN, ELSE, WHEN and OTHERWISE.")
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
52
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
53 (defconst simula-continued-statement-offset 3
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
54 "*Extra indentation for lines not starting a statement or substatement.
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
55 If value is a list, each line in a multipleline continued statement
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
56 will have the car of the list extra indentation with respect to
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
57 the previous line of the statement.")
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
58
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
59 (defconst simula-label-offset -4711
4664
b26469d5e812 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
60 "*Offset of SIMULA label lines relative to usual indentation.")
805
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
61
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
62 (defconst simula-if-indent '(0 . 0)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
63 "*Extra indentation of THEN and ELSE with respect to the starting IF.
3591
507f64624555 Apply typo patches from Paul Eggert.
Jim Blandy <jimb@redhat.com>
parents: 2315
diff changeset
64 Value is a cons cell, the car is extra THEN indentation and the cdr
4664
b26469d5e812 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
65 extra ELSE indentation. IF after ELSE is indented as the starting IF.")
805
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
66
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
67 (defconst simula-inspect-indent '(0 . 0)
4664
b26469d5e812 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
68 "*Extra indentation of WHEN and OTHERWISE with respect to the INSPECT.
b26469d5e812 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
69 Value is a cons cell, the car is extra WHEN indentation
b26469d5e812 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
70 and the cdr extra OTHERWISE indentation.")
805
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
71
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
72 (defconst simula-electric-indent nil
4664
b26469d5e812 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
73 "*Non-nil means `simula-indent-line' function may reindent previous line.")
805
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
74
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
75 (defconst simula-abbrev-keyword 'upcase
4664
b26469d5e812 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
76 "*Specify how to convert case for SIMULA keywords.
b26469d5e812 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
77 Value is one of the symbols `upcase', `downcase', `capitalize',
7639
67b7d1ea7b2e Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 4665
diff changeset
78 \(as in) `abbrev-table' or nil if they should not be changed.")
805
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
79
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
80 (defconst simula-abbrev-stdproc 'abbrev-table
4664
b26469d5e812 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
81 "*Specify how to convert case for standard SIMULA procedure and class names.
b26469d5e812 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
82 Value is one of the symbols `upcase', `downcase', `capitalize',
7639
67b7d1ea7b2e Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 4665
diff changeset
83 \(as in) `abbrev-table', or nil if they should not be changed.")
805
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
84
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
85 (defvar simula-abbrev-file nil
4664
b26469d5e812 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
86 "*File with extra abbrev definitions for use in SIMULA mode.
b26469d5e812 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
87 These are used together with the standard abbrev definitions for SIMULA.
b26469d5e812 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
88 Please note that the standard definitions are required
b26469d5e812 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
89 for SIMULA mode to function correctly.")
805
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
90
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
91 (defvar simula-mode-syntax-table nil
4664
b26469d5e812 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
92 "Syntax table in SIMULA mode buffers.")
805
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
93
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
94 (if simula-mode-syntax-table
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
95 ()
4664
b26469d5e812 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
96 (setq simula-mode-syntax-table (copy-syntax-table (standard-syntax-table)))
805
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
97 (modify-syntax-entry ?! "<" simula-mode-syntax-table)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
98 (modify-syntax-entry ?$ "." simula-mode-syntax-table)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
99 (modify-syntax-entry ?% "." simula-mode-syntax-table)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
100 (modify-syntax-entry ?' "\"" simula-mode-syntax-table)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
101 (modify-syntax-entry ?\( "()" simula-mode-syntax-table)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
102 (modify-syntax-entry ?\) ")(" simula-mode-syntax-table)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
103 (modify-syntax-entry ?\; ">" simula-mode-syntax-table)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
104 (modify-syntax-entry ?\[ "." simula-mode-syntax-table)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
105 (modify-syntax-entry ?\\ "." simula-mode-syntax-table)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
106 (modify-syntax-entry ?\] "." simula-mode-syntax-table)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
107 (modify-syntax-entry ?_ "w" simula-mode-syntax-table)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
108 (modify-syntax-entry ?\| "." simula-mode-syntax-table)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
109 (modify-syntax-entry ?\{ "." simula-mode-syntax-table)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
110 (modify-syntax-entry ?\} "." simula-mode-syntax-table))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
111
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
112 (defvar simula-mode-map ()
4664
b26469d5e812 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
113 "Keymap used in SIMULA mode.")
805
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
114
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
115 (if simula-mode-map
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
116 ()
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
117 (setq simula-mode-map (make-sparse-keymap))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
118 (define-key simula-mode-map "\C-c\C-u" 'simula-backward-up-level)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
119 (define-key simula-mode-map "\C-c\C-p" 'simula-previous-statement)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
120 (define-key simula-mode-map "\C-c\C-d" 'simula-forward-down-level)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
121 (define-key simula-mode-map "\C-c\C-n" 'simula-next-statement)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
122 ;(define-key simula-mode-map "\C-c\C-g" 'simula-goto-definition)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
123 ;(define-key simula-mode-map "\C-c\C-h" 'simula-standard-help)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
124 (define-key simula-mode-map "\177" 'backward-delete-char-untabify)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
125 (define-key simula-mode-map ":" 'simula-electric-label)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
126 (define-key simula-mode-map "\t" 'simula-indent-command))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
127
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
128 (defvar simula-mode-abbrev-table nil
4664
b26469d5e812 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
129 "Abbrev table in SIMULA mode buffers")
805
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
130
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
131
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
132 (defun simula-mode ()
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
133 "Major mode for editing SIMULA code.
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
134 \\{simula-mode-map}
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
135 Variables controlling indentation style:
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
136 simula-tab-always-indent
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
137 Non-nil means TAB in SIMULA mode should always reindent the current line,
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
138 regardless of where in the line point is when the TAB command is used.
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
139 simula-indent-level
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
140 Indentation of SIMULA statements with respect to containing block.
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
141 simula-substatement-offset
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
142 Extra indentation after DO, THEN, ELSE, WHEN and OTHERWISE.
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
143 simula-continued-statement-offset 3
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
144 Extra indentation for lines not starting a statement or substatement,
4664
b26469d5e812 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
145 e.g. a nested FOR-loop. If value is a list, each line in a multiple-
805
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
146 line continued statement will have the car of the list extra indentation
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
147 with respect to the previous line of the statement.
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
148 simula-label-offset -4711
4664
b26469d5e812 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
149 Offset of SIMULA label lines relative to usual indentation.
805
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
150 simula-if-indent '(0 . 0)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
151 Extra indentation of THEN and ELSE with respect to the starting IF.
3591
507f64624555 Apply typo patches from Paul Eggert.
Jim Blandy <jimb@redhat.com>
parents: 2315
diff changeset
152 Value is a cons cell, the car is extra THEN indentation and the cdr
4664
b26469d5e812 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
153 extra ELSE indentation. IF after ELSE is indented as the starting IF.
805
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
154 simula-inspect-indent '(0 . 0)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
155 Extra indentation of WHEN and OTHERWISE with respect to the
4664
b26469d5e812 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
156 corresponding INSPECT. Value is a cons cell, the car is
3591
507f64624555 Apply typo patches from Paul Eggert.
Jim Blandy <jimb@redhat.com>
parents: 2315
diff changeset
157 extra WHEN indentation and the cdr extra OTHERWISE indentation.
805
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
158 simula-electric-indent nil
4664
b26469d5e812 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
159 If this variable is non-nil, `simula-indent-line'
805
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
160 will check the previous line to see if it has to be reindented.
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
161 simula-abbrev-keyword 'upcase
4664
b26469d5e812 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
162 Determine how SIMULA keywords will be expanded. Value is one of
b26469d5e812 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
163 the symbols `upcase', `downcase', `capitalize', (as in) `abbrev-table',
b26469d5e812 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
164 or nil if they should not be changed.
805
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
165 simula-abbrev-stdproc 'abbrev-table
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
166 Determine how standard SIMULA procedure and class names will be
4664
b26469d5e812 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
167 expanded. Value is one of the symbols `upcase', `downcase', `capitalize',
b26469d5e812 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
168 (as in) `abbrev-table', or nil if they should not be changed.
805
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
169
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
170 Turning on SIMULA mode calls the value of the variable simula-mode-hook
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
171 with no arguments, if that value is non-nil
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
172
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
173 Warning: simula-mode-hook should not read in an abbrev file without calling
3591
507f64624555 Apply typo patches from Paul Eggert.
Jim Blandy <jimb@redhat.com>
parents: 2315
diff changeset
174 the function simula-install-standard-abbrevs afterwards, preferably not
805
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
175 at all."
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
176 (interactive)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
177 (kill-all-local-variables)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
178 (use-local-map simula-mode-map)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
179 (setq major-mode 'simula-mode)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
180 (setq mode-name "SIMULA")
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
181 (make-local-variable 'comment-column)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
182 (setq comment-column 40)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
183 (make-local-variable 'end-comment-column)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
184 (setq end-comment-column 75)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
185 (set-syntax-table simula-mode-syntax-table)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
186 (make-local-variable 'paragraph-start)
10895
27b6776dc562 (simula-mode): Remove ^ from paragraph-start & paragraph-separate.
Boris Goldowsky <boris@gnu.org>
parents: 7639
diff changeset
187 (setq paragraph-start "[ \t]*$\\|\\f")
805
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
188 (make-local-variable 'paragraph-separate)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
189 (setq paragraph-separate paragraph-start)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
190 (make-local-variable 'indent-line-function)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
191 (setq indent-line-function 'simula-indent-line)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
192 (make-local-variable 'require-final-newline)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
193 (setq require-final-newline t)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
194 (make-local-variable 'comment-start)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
195 (setq comment-start "! ")
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
196 (make-local-variable 'comment-end)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
197 (setq comment-end " ;")
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
198 (make-local-variable 'comment-start-skip)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
199 (setq comment-start-skip "!+ *")
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
200 (make-local-variable 'parse-sexp-ignore-comments)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
201 (setq parse-sexp-ignore-comments nil)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
202 (make-local-variable 'comment-multi-line)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
203 (setq comment-multi-line t)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
204 (if simula-mode-abbrev-table
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
205 ()
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
206 (if simula-abbrev-file
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
207 (read-abbrev-file simula-abbrev-file)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
208 (define-abbrev-table 'simula-mode-abbrev-table ()))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
209 (let (abbrevs-changed)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
210 (simula-install-standard-abbrevs)))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
211 (setq local-abbrev-table simula-mode-abbrev-table)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
212 (abbrev-mode 1)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
213 (run-hooks 'simula-mode-hook))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
214
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
215
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
216
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
217 (defun simula-indent-line ()
4664
b26469d5e812 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
218 "Indent this line as SIMULA code.
b26469d5e812 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
219 If `simula-electric-indent' is non-nil, indent previous line if necessary."
805
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
220 (let ((origin (- (point-max) (point)))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
221 (indent (simula-calculate-indent))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
222 (case-fold-search t))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
223 (unwind-protect
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
224 (progn
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
225 ;;
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
226 ;; manually expand abbrev on last line, if any
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
227 ;;
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
228 (end-of-line 0)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
229 (expand-abbrev)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
230 ;; now maybe we should reindent that line
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
231 (if simula-electric-indent
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
232 (progn
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
233 (beginning-of-line)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
234 (skip-chars-forward " \t\f")
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
235 (if (and
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
236 (looking-at
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
237 "\\(end\\|if\\|then\\|else\\|when\\|otherwise\\)\\>")
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
238 (not (simula-context)))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
239 ;; yes - reindent
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
240 (let ((post-indent (simula-calculate-indent)))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
241 (if (eq (current-indentation) post-indent)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
242 ()
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
243 (delete-horizontal-space)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
244 (indent-to post-indent)))))))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
245 (goto-char (- (point-max) origin))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
246 (if (eq (current-indentation) indent)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
247 (back-to-indentation)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
248 (delete-horizontal-space)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
249 (indent-to indent)))))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
250
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
251
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
252 (defun simula-indent-command (&optional whole-exp)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
253 "Indent current line as SIMULA code, or insert TAB character.
4664
b26469d5e812 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
254 If `simula-tab-always-indent' is non-nil, always indent current line.
805
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
255 Otherwise, indent only if point is before any non-whitespace
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
256 character on the line.
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
257
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
258 A numeric argument, regardless of its value, means indent rigidly
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
259 all the lines of the SIMULA statement after point so that this line
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
260 becomes properly indented.
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
261 The relative indentation among the lines of the statement are preserved."
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
262 (interactive "P")
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
263 (let ((case-fold-search t))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
264 (if (or whole-exp simula-tab-always-indent
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
265 (save-excursion
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
266 (skip-chars-backward " \t\f")
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
267 (bolp)))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
268 ;; reindent current line
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
269 (let ((indent (save-excursion
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
270 (beginning-of-line)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
271 (simula-calculate-indent)))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
272 (current (current-indentation))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
273 (origin (- (point-max) (point)))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
274 (bol (save-excursion
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
275 (skip-chars-backward " \t\f")
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
276 (bolp)))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
277 beg end)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
278 (unwind-protect
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
279 (if (eq current indent)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
280 (if (save-excursion
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
281 (skip-chars-backward " \t\f")
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
282 (bolp))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
283 (back-to-indentation))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
284 (beginning-of-line)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
285 (delete-horizontal-space)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
286 (indent-to indent))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
287 (if (not bol)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
288 (goto-char (- (point-max) origin))))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
289 (setq origin (point))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
290 (if whole-exp
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
291 (save-excursion
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
292 (beginning-of-line 2)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
293 (setq beg (point))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
294 (goto-char origin)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
295 (simula-next-statement 1)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
296 (setq end (point))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
297 (if (and (> end beg) (not (eq indent current)))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
298 (indent-code-rigidly beg end (- indent current) "%")))))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
299 (insert-tab))))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
300
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
301
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
302 (defun simula-context ()
4664
b26469d5e812 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
303 "Returns value according to syntactic SIMULA context of point.
b26469d5e812 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
304 0 point inside COMMENT comment
805
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
305 1 point on SIMULA-compiler directive line
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
306 2 point inside END comment
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
307 3 point inside string
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
308 4 point inside character constant
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
309 nil otherwise."
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
310 ;; first, find out if this is a compiler directive line
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
311 (if (save-excursion
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
312 (beginning-of-line)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
313 (eq (following-char) ?%))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
314 ;; YES - return 1
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
315 1
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
316 (save-excursion
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
317 ;; The current line is NOT a compiler directive line.
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
318 ;; Now, the strategy is to search backward to find a semicolon
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
319 ;; that is NOT inside a string. The point after semicolon MUST be
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
320 ;; outside a comment, since semicolons are comment-ending and
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
321 ;; comments are non-recursive. We take advantage of the fact
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
322 ;; that strings MUST end on the same line as they started, so
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
323 ;; that we can easily decide whether we are inside a string or not.
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
324 (let (return-value (origin (point)))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
325 (skip-chars-backward "^;" (point-min))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
326 ;; found semicolon or beginning of buffer
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
327 (let (loopvalue (saved-point origin))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
328 (while (and (not (bobp))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
329 (if (progn
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
330 (beginning-of-line)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
331 ;; compiler directive line? If so, cont searching..
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
332 (eq (following-char) ?%))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
333 t
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
334 (while (< (point) saved-point)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
335 (skip-chars-forward "^;\"'")
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
336 (forward-char 1)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
337 (cond
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
338 ((eq (preceding-char) ?\;)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
339 (setq saved-point (point)))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
340 ((eq (preceding-char) ?\")
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
341 (skip-chars-forward "^\";")
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
342 (if (eq (following-char) ?\;)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
343 (setq saved-point (point) loopvalue t)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
344 (forward-char 1)))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
345 (t
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
346 (if (eq (following-char) ?')
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
347 (forward-char 1))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
348 (skip-chars-forward "^';")
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
349 (if (eq (following-char) ?\;)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
350 (setq saved-point (point) loopvalue t)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
351 (forward-char 1)))))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
352 loopvalue))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
353 (backward-char 1)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
354 (skip-chars-backward "^;")
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
355 (setq saved-point (point) loopvalue nil)))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
356 ;; Now we are CERTAIN that we are outside comments and strings.
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
357 ;; The job now is to search forward again towards the origin
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
358 ;; skipping directives, comments and strings correctly,
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
359 ;; so that we know what context we are in when we find the origin.
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
360 (while (and
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
361 (< (point) origin)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
362 (re-search-forward
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
363 "\\<end\\>\\|!\\|\"\\|'\\|^%\\|\\<comment\\>" origin 'move))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
364 (cond
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
365 ((memq (preceding-char) '(?d ?D))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
366 (setq return-value 2)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
367 (while (and (memq (preceding-char) '(?d ?D)) (not return-value))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
368 (while (and (re-search-forward
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
369 ";\\|\\<end\\>\\|\\<else\\>\\|\\<otherwise\\>\\|\\<when\\>\\|^%"
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
370 origin 'move)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
371 (eq (preceding-char) ?%))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
372 (beginning-of-line 2)))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
373 (if (looking-at "[ \t\n\f]*\\(;\\|\\<end\\>\\|\\<else\\>\\|\\<otherwise\\>\\|\\<when\\>\\)")
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
374 (setq return-value nil)))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
375 ((memq (preceding-char) '(?! ?t ?T))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
376 ; skip comment
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
377 (setq return-value 0)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
378 (skip-chars-forward "^%;" origin)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
379 (while (and return-value (< (point) origin))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
380 (if (eq (following-char) ?\;)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
381 (setq return-value nil)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
382 (if (bolp)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
383 (beginning-of-line 2) ; skip directive inside comment
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
384 (forward-char 1)) ; or single '%'
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
385 (skip-chars-forward "^%;" origin))))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
386 ((eq (preceding-char) ?\")
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
387 (if (not (search-forward "\"" origin 'move))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
388 (setq return-value 3)))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
389 ((eq (preceding-char) ?\')
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
390 (if (or (eq (point) origin) (eobp))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
391 (setq return-value 4)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
392 (forward-char 1)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
393 (if (not (search-forward "'" origin 'move))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
394 (setq return-value 4))))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
395 ;; compiler directive line - skip
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
396 (t (beginning-of-line 2))))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
397 return-value)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
398 )))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
399
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
400
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
401 (defun simula-electric-label ()
4664
b26469d5e812 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
402 "If this is a label that starts the line, reindent the line."
805
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
403 (interactive)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
404 (expand-abbrev)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
405 (insert ?:)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
406 (let ((origin (- (point-max) (point)))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
407 (case-fold-search t)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
408 ;; don't mix a label with an assignment operator := :-
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
409 ;; therefore look at next typed character...
2024
357941278904 (simula-electric-label): Handle any event when flushing the display.
Richard M. Stallman <rms@gnu.org>
parents: 1821
diff changeset
410 (next-char (setq unread-command-events (list (read-event))))
805
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
411 (com-char last-command-char))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
412 (unwind-protect
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
413 ;; Problem: find out if character just read is a command char
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
414 ;; that would insert something after ':' making it a label.
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
415 ;; At least \n, \r (and maybe \t) falls into this category.
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
416 ;; This is a real crock, it depends on traditional keymap
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
417 ;; bindings, that is, printing characters doing self-insert,
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
418 ;; and no other command sequence inserting '-' or '='.
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
419 ;; simula-electric-label can be easily fooled...
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
420 (if (and (not (memq next-char '(?= ?-)))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
421 (or (memq next-char '(?\n ?\r))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
422 (and (eq next-char ?\t)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
423 simula-tab-always-indent)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
424 (not (memq (following-char) '(?= ?-))))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
425 (not (simula-context))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
426 ;; label?
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
427 (progn
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
428 (backward-char 1)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
429 (skip-chars-backward " \t\f")
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
430 (skip-chars-backward "a-zA-Z0-9_")
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
431 (if (looking-at "virtual\\>")
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
432 nil
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
433 (skip-chars-backward " \t\f")
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
434 (bolp))))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
435 (let ((amount (simula-calculate-indent)))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
436 (delete-horizontal-space)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
437 (indent-to amount)))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
438 (goto-char (- (point-max) origin)))))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
439
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
440
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
441 (defun simula-backward-up-level (count)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
442 "Move backward up COUNT block levels.
4664
b26469d5e812 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
443 If COUNT is negative, move forward up block level instead."
805
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
444 (interactive "p")
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
445 (let ((origin (point))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
446 (case-fold-search t))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
447 (condition-case ()
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
448 (if (> count 0)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
449 (while (> count 0)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
450 (re-search-backward "\\<begin\\>\\|\\<end\\>")
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
451 (if (not (simula-context))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
452 (setq count (if (memq (following-char) '(?b ?B))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
453 (1- count)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
454 (1+ count)))))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
455 (while (< count 0)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
456 (re-search-forward "\\<begin\\>\\|\\<end\\>")
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
457 (backward-word 1)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
458 (if (not (simula-context))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
459 (setq count (if (memq (following-char) '(?e ?E))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
460 (1+ count)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
461 (1- count))))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
462 (backward-word -1)))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
463 ;; If block level not found, jump back to origin and signal an error
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
464 (error (progn
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
465 (goto-char origin)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
466 (error "No higher block level")))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
467 (quit (progn
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
468 (goto-char origin)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
469 (signal 'quit nil))))))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
470
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
471
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
472 (defun simula-forward-down-level (count)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
473 "Move forward down COUNT block levels.
4664
b26469d5e812 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
474 If COUNT is negative, move backward down block level instead."
805
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
475 (interactive "p")
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
476 ;; When we search for a deeper block level, we must never
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
477 ;; get out of the block where we started -> count >= start-count
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
478 (let ((start-count count)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
479 (origin (point))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
480 (case-fold-search t))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
481 (condition-case ()
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
482 (if (< count 0)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
483 (while (< count 0)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
484 (re-search-backward "\\<begin\\>\\|\\<end\\>")
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
485 (if (not (simula-context))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
486 (setq count (if (memq (following-char) '(?e ?E))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
487 (1+ count)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
488 (1- count))))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
489 (if (< count start-count) (signal 'error nil)))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
490 (while (> count 0)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
491 (re-search-forward "\\<begin\\>\\|\\<end\\>")
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
492 (backward-word 1)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
493 (if (not (simula-context))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
494 (setq count (if (memq (following-char) '(?b ?B))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
495 (1- count)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
496 (1+ count))))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
497 (backward-word -1)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
498 ;; deeper level has to be found within starting block
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
499 (if (> count start-count) (signal 'error nil))))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
500 ;; If block level not found, jump back to origin and signal an error
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
501 (error (progn
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
502 (goto-char origin)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
503 (error "No containing block level")))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
504 (quit (progn
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
505 (goto-char origin)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
506 (signal 'quit nil))))))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
507
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
508
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
509 (defun simula-previous-statement (count)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
510 "Move backward COUNT statements.
4664
b26469d5e812 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
511 If COUNT is negative, move forward instead."
805
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
512 (interactive "p")
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
513 (if (< count 0)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
514 (simula-next-statement (- count))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
515 (let (status
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
516 (case-fold-search t)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
517 (origin (point)))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
518 (condition-case ()
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
519 (progn
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
520 (simula-skip-comment-backward)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
521 (if (memq (preceding-char) '(?n ?N))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
522 (progn
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
523 (backward-word 1)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
524 (if (not (looking-at "\\<begin\\>"))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
525 (backward-word -1)))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
526 (if (eq (preceding-char) ?\;)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
527 (backward-char 1)))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
528 (while (and (natnump (setq count (1- count)))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
529 (setq status (simula-search-backward
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
530 ";\\|\\<begin\\>" nil 'move))))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
531 (if status
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
532 (progn
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
533 (if (eq (following-char) ?\;)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
534 (forward-char 1)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
535 (backward-word -1))))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
536 (simula-skip-comment-forward))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
537 (error (progn (goto-char origin)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
538 (error "Incomplete statement (too many ENDs)")))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
539 (quit (progn (goto-char origin) (signal 'quit nil)))))))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
540
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
541
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
542 (defun simula-next-statement (count)
4664
b26469d5e812 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
543 "Move forward COUNT statements.
b26469d5e812 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
544 If COUNT is negative, move backward instead."
805
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
545 (interactive "p")
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
546 (if (< count 0)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
547 (simula-previous-statement (- count))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
548 (let (status
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
549 (case-fold-search t)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
550 (origin (point)))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
551 (condition-case ()
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
552 (progn
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
553 (simula-skip-comment-forward)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
554 (if (looking-at "\\<end\\>") (forward-word 1))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
555 (while (and (natnump (setq count (1- count)))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
556 (setq status (simula-search-forward
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
557 ";\\|\\<end\\>" (point-max) 'move))))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
558 (if (and status (/= (preceding-char) ?\;))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
559 (progn
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
560 (backward-word 1)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
561 (simula-skip-comment-backward))))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
562 (error (progn (goto-char origin)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
563 (error "Incomplete statement (too few ENDs)")))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
564 (quit (progn (goto-char origin) (signal 'quit nil)))))))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
565
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
566
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
567 (defun simula-skip-comment-backward ()
4664
b26469d5e812 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
568 "Search towards bob to find first char that is outside a comment."
805
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
569 (interactive)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
570 (catch 'simula-out
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
571 (let (context)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
572 (while t
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
573 (skip-chars-backward " \t\n\f")
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
574 (if (eq (preceding-char) ?\;)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
575 (save-excursion
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
576 (backward-char 1)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
577 (setq context (simula-context)))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
578 (setq context (simula-context)))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
579 (cond
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
580 ((memq context '(nil 3 4))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
581 ;; check to see if we found a label
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
582 (if (and (eq (preceding-char) ?:)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
583 (not (memq (following-char) '(?- ?=)))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
584 (save-excursion
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
585 (skip-chars-backward ": \t\fa-zA-Z0-9_")
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
586 (not (looking-at "virtual\\>"))))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
587 (skip-chars-backward ": \t\fa-zA-Z0-9_")
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
588 (throw 'simula-out nil)))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
589 ((eq context 0)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
590 ;; since we are inside a comment, it must start somewhere!
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
591 (while (and (re-search-backward "!\\|\\<comment\\>")
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
592 (memq (simula-context) '(0 1)))))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
593 ((eq context 1)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
594 (end-of-line 0)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
595 (if (bobp)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
596 (throw 'simula-out nil)))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
597 ((eq context 2)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
598 ;; an END-comment must belong to an END
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
599 (re-search-backward "\\<end\\>")
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
600 (forward-word 1)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
601 (throw 'simula-out nil))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
602 ;; should be impossible to get here..
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
603 )))))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
604
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
605
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
606 (defun simula-skip-comment-forward ()
4664
b26469d5e812 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
607 "Search towards eob to find first char that is outside a comment."
805
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
608 ;; this function assumes we start with point .outside a comment
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
609 (interactive)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
610 (catch 'simula-out
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
611 (while t
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
612 (skip-chars-forward " \t\n\f")
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
613 (cond
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
614 ((looking-at "!\\|\\<comment\\>")
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
615 (search-forward ";" nil 'move))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
616 ((and (bolp) (eq (following-char) ?%))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
617 (beginning-of-line 2))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
618 ((and (looking-at "[a-z0-9_]*[ \t\f]*:[^-=]")
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
619 (not (looking-at "virtual\\>")))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
620 (skip-chars-forward "a-zA-Z0-9_ \t\f:"))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
621 (t
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
622 (throw 'simula-out t))))))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
623
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
624
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
625 (defun simula-forward-up-level ()
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
626 (let ((continue-loop t)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
627 (origin (point))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
628 (case-fold-search t)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
629 return-value
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
630 temp)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
631 (while continue-loop
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
632 (if (re-search-backward "\\<begin\\>\\|\\<end\\>" (point-min) 'move)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
633 (setq temp (simula-context)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
634 return-value (and (memq (preceding-char) '(?d ?D))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
635 (memq temp '(nil 2)))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
636 continue-loop (and (not return-value)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
637 (simula-forward-up-level)))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
638 (setq continue-loop nil)))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
639 (if return-value
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
640 t
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
641 (goto-char origin)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
642 nil)))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
643
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
644
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
645 (defun simula-calculate-indent ()
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
646 (save-excursion
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
647 (let ((where (simula-context))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
648 (origin (point))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
649 (indent 0)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
650 continued
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
651 start-line
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
652 temp
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
653 found-end
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
654 prev-cont)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
655 (cond
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
656 ((eq where 0)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
657 ;;
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
658 ;; Comment.
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
659 ;; If comment started on previous non-blank line, indent to the
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
660 ;; column where the comment started, else indent as that line.
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
661 ;;
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
662 (skip-chars-backward " \t\n\f")
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
663 (while (and (not (bolp)) (eq (simula-context) 0))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
664 (re-search-backward "^\\|!\\|\\<comment\\>"))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
665 (skip-chars-forward " \t\n\f")
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
666 (prog1
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
667 (current-column)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
668 (goto-char origin)))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
669 ;;
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
670 ;; Detect missing string delimiters
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
671 ;;
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
672 ((eq where 3)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
673 (error "Inside string"))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
674 ((eq where 4)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
675 (error "Inside character constant"))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
676 ;;
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
677 ;; check to see if inside ()'s
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
678 ;;
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
679 ((setq temp (simula-inside-parens))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
680 temp)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
681 ;;
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
682 ;; Calculate non-comment indentation
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
683 (t
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
684 ;; first, find out if this line starts with something that needs
3591
507f64624555 Apply typo patches from Paul Eggert.
Jim Blandy <jimb@redhat.com>
parents: 2315
diff changeset
685 ;; special indentation (END/IF/THEN/ELSE/WHEN/OTHERWISE or label)
805
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
686 ;;
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
687 (skip-chars-forward " \t\f")
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
688 (cond
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
689 ;;
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
690 ;; END
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
691 ;;
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
692 ((looking-at "end\\>")
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
693 (setq indent (- simula-indent-level)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
694 found-end t))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
695 ;;
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
696 ;; IF/THEN/ELSE
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
697 ;;
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
698 ((looking-at "if\\>\\|then\\>\\|else\\>")
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
699 ;; search for the *starting* IF
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
700 (cond
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
701 ((memq (following-char) '(?T ?t))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
702 (setq indent (car simula-if-indent)))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
703 ((memq (following-char) '(?E ?e))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
704 (setq indent (cdr simula-if-indent)))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
705 (t
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
706 (forward-word 1)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
707 (setq indent 0)))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
708 (simula-find-if))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
709 ;;
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
710 ;; WHEN/OTHERWISE
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
711 ;;
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
712 ((looking-at "when\\>\\|otherwise\\>")
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
713 ;; search for corresponding INSPECT
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
714 (if (memq (following-char) '(?W ?w))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
715 (setq indent (car simula-inspect-indent))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
716 (setq indent (cdr simula-inspect-indent)))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
717 (simula-find-inspect))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
718 ;;
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
719 ;; label:
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
720 ;;
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
721 ((and (not (looking-at "virtual\\>"))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
722 (looking-at "[a-z0-9_]*[ \t\f]*:[^-=]"))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
723 (setq indent simula-label-offset)))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
724 ;; find line with non-comment text
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
725 (simula-skip-comment-backward)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
726 (if (and found-end
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
727 (not (eq (preceding-char) ?\;))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
728 (if (memq (preceding-char) '(?N ?n))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
729 (save-excursion
1621
ec2c000b8b69 * bytecomp.el: Declare unread-command-char an obsolete variable.
Jim Blandy <jimb@redhat.com>
parents: 841
diff changeset
730 (backward-word 1)
805
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
731 (not (looking-at "begin\\>")))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
732 t))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
733 (progn
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
734 (simula-previous-statement 1)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
735 (simula-skip-comment-backward)))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
736 (setq start-line
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
737 (save-excursion (beginning-of-line) (point))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
738 ;; - perhaps this is a continued statement
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
739 continued
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
740 (save-excursion
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
741 (and (not (bobp))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
742 ;; (not found-end)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
743 (if (eq (char-syntax (preceding-char)) ?w)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
744 (progn
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
745 (backward-word 1)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
746 (not (looking-at
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
747 "begin\\|then\\|else\\|when\\|otherwise\\|do"
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
748 )))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
749 (not (memq (preceding-char) '(?: ?\;)))))))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
750 ;;
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
751 ;; MAIN calculation loop - count BEGIN/DO etc.
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
752 ;;
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
753 (while (not (bolp))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
754 (if (re-search-backward
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
755 ";\\|\\<\\(begin\\|end\\|if\\|else\\|then\\|when\\|otherwise\\|do\\)\\>"
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
756 start-line 'move)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
757 (if (simula-context)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
758 ();; found something in a comment/string - ignore
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
759 (setq temp (following-char))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
760 (cond
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
761 ((eq temp ?\;)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
762 (simula-previous-statement 1))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
763 ((looking-at "begin\\>")
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
764 (setq indent (+ indent simula-indent-level)))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
765 ((looking-at "end\\>")
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
766 (forward-word 1)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
767 (simula-previous-statement 1))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
768 ((looking-at "do\\>")
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
769 (setq indent (+ indent simula-substatement-offset))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
770 (simula-find-do-match))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
771 ((looking-at "\\(if\\|then\\|else\\)\\>")
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
772 (if (memq temp '(?I ?i))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
773 (forward-word 1)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
774 (setq indent (+ indent
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
775 simula-substatement-offset
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
776 (if (memq temp '(?T ?t))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
777 (car simula-if-indent)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
778 (cdr simula-if-indent)))))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
779 (simula-find-if))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
780 ((looking-at "\\<when\\>\\|\\<otherwise\\>")
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
781 (setq indent (+ indent
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
782 simula-substatement-offset
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
783 (if (memq temp '(?W ?w))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
784 (car simula-if-indent)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
785 (cdr simula-if-indent))))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
786 (simula-find-inspect)))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
787 ;; found the start of a [sub]statement
3591
507f64624555 Apply typo patches from Paul Eggert.
Jim Blandy <jimb@redhat.com>
parents: 2315
diff changeset
788 ;; add indentation for continued statement
805
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
789 (if continued
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
790 (setq indent
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
791 (+ indent
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
792 (if (listp simula-continued-statement-offset)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
793 (car simula-continued-statement-offset)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
794 simula-continued-statement-offset))))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
795 (setq start-line
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
796 (save-excursion (beginning-of-line) (point))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
797 continued nil))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
798 ;; search failed .. point is at beginning of line
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
799 ;; determine if we should continue searching
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
800 ;; (at or before comment or label)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
801 ;; temp = t means finished
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
802 (setq temp
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
803 (and (not (simula-context))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
804 (save-excursion
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
805 (skip-chars-forward " \t\f")
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
806 (or (looking-at "virtual")
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
807 (not
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
808 (looking-at
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
809 "!\\|comment\\>\\|[a-z0-9_]*[ \t\f]*:[^-=]")))))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
810 prev-cont continued)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
811 ;; if we are finished, find current line's indentation
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
812 (if temp
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
813 (setq indent (+ indent (current-indentation))))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
814 ;; find next line with non-comment SIMULA text
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
815 ;; maybe indent extra if statement continues
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
816 (simula-skip-comment-backward)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
817 (setq continued
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
818 (and (not (bobp))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
819 (if (eq (char-syntax (preceding-char)) ?w)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
820 (save-excursion
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
821 (backward-word 1)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
822 (not (looking-at
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
823 "begin\\|then\\|else\\|when\\|otherwise\\|do")))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
824 (not (memq (preceding-char) '(?: ?\;))))))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
825 ;; if we the state of the continued-variable
3591
507f64624555 Apply typo patches from Paul Eggert.
Jim Blandy <jimb@redhat.com>
parents: 2315
diff changeset
826 ;; changed, add indentation for continued statement
805
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
827 (if (or (and prev-cont (not continued))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
828 (and continued
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
829 (listp simula-continued-statement-offset)))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
830 (setq indent
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
831 (+ indent
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
832 (if (listp simula-continued-statement-offset)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
833 (car simula-continued-statement-offset)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
834 simula-continued-statement-offset))))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
835 ;; while ends if point is at beginning of line at loop test
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
836 (if (not temp)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
837 (setq start-line (save-excursion (beginning-of-line) (point)))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
838 (beginning-of-line))))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
839 ;;
3591
507f64624555 Apply typo patches from Paul Eggert.
Jim Blandy <jimb@redhat.com>
parents: 2315
diff changeset
840 ;; return indentation
805
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
841 ;;
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
842 indent)))))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
843
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
844
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
845 (defun simula-find-if ()
4664
b26469d5e812 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
846 "Find starting IF of a IF-THEN[-ELSE[-IF-THEN...]] statement."
805
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
847 (catch 'simula-out
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
848 (while t
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
849 (if (and (simula-search-backward "\\<if\\>\\|;\\|\\<begin\\>"nil t)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
850 (memq (following-char) '(?I ?i)))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
851 (save-excursion
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
852 ;;
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
853 ;; find out if this IF was really the start of the IF statement
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
854 ;;
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
855 (simula-skip-comment-backward)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
856 (if (and (eq (char-syntax (preceding-char)) ?w)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
857 (progn
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
858 (backward-word 1)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
859 (looking-at "else\\>")))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
860 ()
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
861 (throw 'simula-out t)))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
862 (if (not (looking-at "\\<if\\>"))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
863 (error "Missing IF or misplaced BEGIN or ';' (can't find IF)")
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
864 ;;
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
865 ;; we were at the starting IF in the first place..
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
866 ;;
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
867 (throw 'simula-out t))))))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
868
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
869
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
870 (defun simula-find-inspect ()
4664
b26469d5e812 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
871 "Find INSPECT matching WHEN or OTHERWISE."
805
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
872 (catch 'simula-out
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
873 (let ((level 0))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
874 ;;
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
875 ;; INSPECTs can be nested, have to find the corresponding one
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
876 ;;
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
877 (while t
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
878 (if (and (simula-search-backward "\\<inspect\\>\\|\\<otherwise\\>\\|;"
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
879 nil t)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
880 (/= (following-char) ?\;))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
881 (if (memq (following-char) '(?O ?o))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
882 (setq level (1+ level))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
883 (if (zerop level)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
884 (throw 'simula-out t)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
885 (setq level (1- level))))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
886 (error "Missing INSPECT or misplaced ';' (can't find INSPECT)"))))))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
887
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
888
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
889 (defun simula-find-do-match ()
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
890 "Find keyword matching DO: FOR, WHILE, INSPECT or WHEN"
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
891 (while (and (re-search-backward
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
892 "\\<\\(do\\|for\\|while\\|inspect\\|when\\|end\\|begin\\)\\>\\|;"
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
893 nil 'move)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
894 (simula-context)))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
895 (if (and (looking-at "\\<\\(for\\|while\\|inspect\\|when\\)\\>")
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
896 (not (simula-context)))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
897 () ;; found match
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
898 (error "No matching FOR, WHILE or INSPECT for DO, or misplaced ';'")))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
899
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
900
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
901 (defun simula-inside-parens ()
4664
b26469d5e812 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
902 "Return position after `(' on line if inside parentheses, nil otherwise."
805
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
903 (save-excursion
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
904 (let ((parlevel 0))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
905 (catch 'simula-out
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
906 (while t
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
907 (if (re-search-backward "(\\|)\\|;" nil t)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
908 (if (eq (simula-context) nil)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
909 ;; found something - check it out
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
910 (cond
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
911 ((eq (following-char) ?\;)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
912 (if (zerop parlevel)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
913 (throw 'simula-out nil)
3591
507f64624555 Apply typo patches from Paul Eggert.
Jim Blandy <jimb@redhat.com>
parents: 2315
diff changeset
914 (error "Parenthesis mismatch or misplaced ';'")))
805
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
915 ((eq (following-char) ?\()
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
916 (if (zerop parlevel)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
917 (throw 'simula-out (1+ (current-column)))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
918 (setq parlevel (1- parlevel))))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
919 (t (setq parlevel (1+ parlevel))))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
920 );; nothing - inside comment or string
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
921 ;; search failed
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
922 (throw 'simula-out nil)))))))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
923
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
924
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
925 (defun simula-goto-definition ()
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
926 "Goto point of definition of variable, procedure or class."
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
927 (interactive))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
928
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
929
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
930 (defun simula-expand-stdproc ()
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
931 (if (or (not simula-abbrev-stdproc) (simula-context))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
932 (unexpand-abbrev)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
933 (cond
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
934 ((eq simula-abbrev-stdproc 'upcase) (upcase-word -1))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
935 ((eq simula-abbrev-stdproc 'downcase) (downcase-word -1))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
936 ((eq simula-abbrev-stdproc 'capitalize) (capitalize-word -1)))))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
937
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
938
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
939 (defun simula-expand-keyword ()
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
940 (if (or (not simula-abbrev-keyword) (simula-context))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
941 (unexpand-abbrev)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
942 (cond
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
943 ((eq simula-abbrev-keyword 'upcase) (upcase-word -1))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
944 ((eq simula-abbrev-keyword 'downcase) (downcase-word -1))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
945 ((eq simula-abbrev-keyword 'capitalize) (capitalize-word -1)))))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
946
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
947
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
948 (defun simula-electric-keyword ()
4664
b26469d5e812 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
949 "Expand SIMULA keyword. If it starts the line, reindent."
805
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
950 ;; redisplay
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
951 (let ((show-char (eq this-command 'self-insert-command)))
3591
507f64624555 Apply typo patches from Paul Eggert.
Jim Blandy <jimb@redhat.com>
parents: 2315
diff changeset
952 ;; If the abbrev expansion results in reindentation, the user may have
805
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
953 ;; to wait some time before the character he typed is displayed
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
954 ;; (the char causing the expansion is inserted AFTER the hook function
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
955 ;; is called). This is annoying in case of normal characters.
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
956 ;; However, if the user pressed a key bound to newline, it is better
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
957 ;; to have the line inserted after the begin-end match.
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
958 (if show-char
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
959 (progn
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
960 (insert-char last-command-char 1)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
961 (sit-for 0)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
962 (backward-char 1)))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
963 (if (let ((where (simula-context))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
964 (case-fold-search t))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
965 (if where
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
966 (if (and (eq where 2) (eq (char-syntax (preceding-char)) ?w))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
967 (save-excursion
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
968 (backward-word 1)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
969 (not (looking-at "end\\>"))))))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
970 (unexpand-abbrev)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
971 (cond
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
972 ((not simula-abbrev-keyword) (unexpand-abbrev))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
973 ((eq simula-abbrev-keyword 'upcase) (upcase-word -1))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
974 ((eq simula-abbrev-keyword 'downcase) (downcase-word -1))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
975 ((eq simula-abbrev-keyword 'capitalize) (capitalize-word -1)))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
976 (let ((pos (- (point-max) (point)))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
977 (case-fold-search t)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
978 null)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
979 (condition-case null
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
980 (progn
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
981 ;; check if the expanded word is on the beginning of the line.
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
982 (if (and (eq (char-syntax (preceding-char)) ?w)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
983 (progn
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
984 (backward-word 1)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
985 (if (looking-at "end\\>")
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
986 (save-excursion
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
987 (simula-backward-up-level 1)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
988 (if (pos-visible-in-window-p)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
989 (sit-for 1)
14330
35a18ea09b7b (simula-electric-keyword): Pass proper format string to message.
Karl Heuer <kwzh@gnu.org>
parents: 14169
diff changeset
990 (message "Matches %s"
805
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
991 (buffer-substring
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
992 (point)
14330
35a18ea09b7b (simula-electric-keyword): Pass proper format string to message.
Karl Heuer <kwzh@gnu.org>
parents: 14169
diff changeset
993 (+ (point) (window-width)))))))
805
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
994 (skip-chars-backward " \t\f")
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
995 (bolp)))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
996 (let ((indent (simula-calculate-indent)))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
997 (if (eq indent (current-indentation))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
998 ()
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
999 (delete-horizontal-space)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1000 (indent-to indent)))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1001 (skip-chars-forward " \t\f"))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1002 ;; check for END - blow whistles and ring bells
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1003
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1004 (goto-char (- (point-max) pos))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1005 (if show-char
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1006 (delete-char 1)))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1007 (quit (goto-char (- (point-max) pos))))))))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1008
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1009
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1010 (defun simula-search-backward (string &optional limit move)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1011 (setq string (concat string "\\|\\<end\\>"))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1012 (let (level)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1013 (catch 'simula-out
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1014 (while (re-search-backward string limit move)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1015 (if (simula-context)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1016 ()
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1017 (if (looking-at "\\<end\\>")
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1018 (progn
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1019 (setq level 0)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1020 (while (natnump level)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1021 (re-search-backward "\\<begin\\>\\|\\<end\\>")
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1022 (if (simula-context)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1023 ()
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1024 (setq level (if (memq (following-char) '(?b ?B))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1025 (1- level)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1026 (1+ level))))))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1027 (throw 'simula-out t)))))))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1028
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1029
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1030 (defun simula-search-forward (string &optional limit move)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1031 (setq string (concat string "\\|\\<begin\\>"))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1032 (let (level)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1033 (catch 'exit
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1034 (while (re-search-forward string limit move)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1035 (goto-char (match-beginning 0))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1036 (if (simula-context)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1037 (goto-char (1- (match-end 0)))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1038 (if (looking-at "\\<begin\\>")
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1039 (progn
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1040 (goto-char (1- (match-end 0)))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1041 (setq level 0)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1042 (while (natnump level)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1043 (re-search-forward "\\<begin\\>\\|\\<end\\>")
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1044 (backward-word 1)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1045 (if (not (simula-context))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1046 (setq level (if (memq (following-char) '(?e ?E))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1047 (1- level)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1048 (1+ level))))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1049 (backward-word -1)))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1050 (goto-char (1- (match-end 0)))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1051 (throw 'exit t)))))))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1052
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1053
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1054 (defun simula-install-standard-abbrevs ()
4664
b26469d5e812 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1055 "Define Simula keywords, procedures and classes in local abbrev table."
805
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1056 ;; procedure and class names are as of the SIMULA 87 standard.
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1057 (interactive)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1058 (mapcar (function (lambda (args)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1059 (apply 'define-abbrev simula-mode-abbrev-table args)))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1060 '(("abs" "Abs" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1061 ("accum" "Accum" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1062 ("activate" "ACTIVATE" simula-expand-keyword)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1063 ("addepsilon" "AddEpsilon" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1064 ("after" "AFTER" simula-expand-keyword)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1065 ("and" "AND" simula-expand-keyword)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1066 ("arccos" "ArcCos" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1067 ("arcsin" "ArcSin" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1068 ("arctan" "ArcTan" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1069 ("arctan2" "ArcTan2" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1070 ("array" "ARRAY" simula-expand-keyword)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1071 ("at" "AT" simula-expand-keyword)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1072 ("before" "BEFORE" simula-expand-keyword)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1073 ("begin" "BEGIN" simula-expand-keyword)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1074 ("blanks" "Blanks" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1075 ("boolean" "BOOLEAN" simula-expand-keyword)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1076 ("breakoutimage" "BreakOutImage" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1077 ("bytefile" "ByteFile" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1078 ("call" "Call" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1079 ("cancel" "Cancel" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1080 ("cardinal" "Cardinal" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1081 ("char" "Char" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1082 ("character" "CHARACTER" simula-expand-keyword)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1083 ("checkpoint" "CheckPoint" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1084 ("class" "CLASS" simula-expand-keyword)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1085 ("clear" "Clear" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1086 ("clocktime" "ClockTime" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1087 ("close" "Close" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1088 ("comment" "COMMENT" simula-expand-keyword)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1089 ("constant" "Constant" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1090 ("copy" "Copy" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1091 ("cos" "Cos" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1092 ("cosh" "CosH" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1093 ("cotan" "CoTan" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1094 ("cputime" "CpuTime" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1095 ("current" "Current" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1096 ("datetime" "DateTime" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1097 ("decimalmark" "DecimalMark" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1098 ("delay" "DELAY" simula-expand-keyword)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1099 ("deleteimage" "DeleteImage" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1100 ("detach" "Detach" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1101 ("digit" "Digit" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1102 ("directbytefile" "DirectByteFile" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1103 ("directfile" "DirectFile" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1104 ("discrete" "Discrete" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1105 ("do" "DO" simula-expand-keyword)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1106 ("downcase" "Downcase" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1107 ("draw" "Draw" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1108 ("eject" "Eject" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1109 ("else" "ELSE" simula-electric-keyword)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1110 ("empty" "Empty" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1111 ("end" "END" simula-electric-keyword)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1112 ("endfile" "Endfile" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1113 ("entier" "Entier" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1114 ("eq" "EQ" simula-expand-keyword)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1115 ("eqv" "EQV" simula-expand-keyword)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1116 ("erlang" "Erlang" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1117 ("error" "Error" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1118 ("evtime" "EvTime" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1119 ("exp" "Exp" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1120 ("external" "EXTERNAL" simula-expand-keyword)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1121 ("false" "FALSE" simula-expand-keyword)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1122 ("field" "Field" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1123 ("file" "File" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1124 ("first" "First" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1125 ("follow" "Follow" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1126 ("for" "FOR" simula-expand-keyword)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1127 ("ge" "GE" simula-expand-keyword)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1128 ("getchar" "GetChar" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1129 ("getfrac" "GetFrac" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1130 ("getint" "GetInt" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1131 ("getreal" "GetReal" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1132 ("go" "GO" simula-expand-keyword)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1133 ("goto" "GOTO" simula-expand-keyword)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1134 ("gt" "GT" simula-expand-keyword)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1135 ("head" "Head" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1136 ("hidden" "HIDDEN" simula-expand-keyword)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1137 ("histd" "HistD" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1138 ("histo" "Histo" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1139 ("hold" "Hold" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1140 ("idle" "Idle" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1141 ("if" "IF" simula-expand-keyword)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1142 ("image" "Image" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1143 ("imagefile" "ImageFile" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1144 ("imp" "IMP" simula-expand-keyword)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1145 ("in" "IN" simula-expand-keyword)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1146 ("inbyte" "InByte" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1147 ("inbytefile" "InByteFile" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1148 ("inchar" "InChar" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1149 ("infile" "InFile" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1150 ("infrac" "InFrac" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1151 ("inimage" "InImage" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1152 ("inint" "InInt" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1153 ("inner" "INNER" simula-expand-keyword)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1154 ("inreal" "InReal" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1155 ("inrecord" "InRecord" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1156 ("inspect" "INSPECT" simula-expand-keyword)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1157 ("integer" "INTEGER" simula-expand-keyword)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1158 ("intext" "InText" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1159 ("into" "Into" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1160 ("is" "IS" simula-expand-keyword)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1161 ("isochar" "ISOChar" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1162 ("isopen" "IsOpen" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1163 ("isorank" "ISORank" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1164 ("label" "LABEL" simula-expand-keyword)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1165 ("last" "Last" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1166 ("lastitem" "LastItem" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1167 ("lastloc" "LastLoc" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1168 ("le" "LE" simula-expand-keyword)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1169 ("length" "Length" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1170 ("letter" "Letter" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1171 ("line" "Line" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1172 ("linear" "Linear" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1173 ("linesperpage" "LinesPerPage" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1174 ("link" "Link" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1175 ("linkage" "Linkage" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1176 ("ln" "Ln" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1177 ("locate" "Locate" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1178 ("location" "Location" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1179 ("lock" "Lock" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1180 ("locked" "Locked" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1181 ("log10" "Log10" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1182 ("long" "LONG" simula-expand-keyword)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1183 ("lowcase" "LowCase" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1184 ("lowerbound" "LowerBound" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1185 ("lowten" "LowTen" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1186 ("lt" "LT" simula-expand-keyword)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1187 ("main" "Main" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1188 ("max" "Max" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1189 ("maxint" "MaxInt" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1190 ("maxlongreal" "MaxLongReal" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1191 ("maxloc" "MaxLoc" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1192 ("maxrank" "MaxRank" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1193 ("maxreal" "MaxReal" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1194 ("min" "Min" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1195 ("minint" "MinInt" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1196 ("minlongreal" "MinLongReal" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1197 ("minrank" "MinRank" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1198 ("minreal" "MinReal" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1199 ("mod" "Mod" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1200 ("more" "More" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1201 ("name" "NAME" simula-expand-keyword)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1202 ("ne" "NE" simula-expand-keyword)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1203 ("negexp" "NegExp" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1204 ("new" "NEW" simula-expand-keyword)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1205 ("nextev" "NextEv" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1206 ("none" "NONE" simula-expand-keyword)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1207 ("normal" "Normal" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1208 ("not" "NOT" simula-expand-keyword)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1209 ("notext" "NOTEXT" simula-expand-keyword)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1210 ("open" "Open" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1211 ("or" "OR" simula-expand-keyword)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1212 ("otherwise" "OTHERWISE" simula-electric-keyword)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1213 ("out" "Out" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1214 ("outbyte" "OutByte" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1215 ("outbytefile" "OutByteFile" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1216 ("outchar" "OutChar" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1217 ("outfile" "OutFile" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1218 ("outfix" "OutFix" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1219 ("outfrac" "OutFrac" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1220 ("outimage" "OutImage" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1221 ("outint" "OutInt" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1222 ("outreal" "OutReal" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1223 ("outrecord" "OutRecord" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1224 ("outtext" "OutText" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1225 ("page" "Page" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1226 ("passivate" "Passivate" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1227 ("poisson" "Poisson" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1228 ("pos" "Pos" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1229 ("precede" "Precede" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1230 ("pred" "Pred" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1231 ("prev" "Prev" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1232 ("printfile" "PrintFile" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1233 ("prior" "PRIOR" simula-expand-keyword)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1234 ("procedure" "PROCEDURE" simula-expand-keyword)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1235 ("process" "Process" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1236 ("protected" "PROTECTED" simula-expand-keyword)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1237 ("putchar" "PutChar" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1238 ("putfix" "PutFix" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1239 ("putfrac" "PutFrac" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1240 ("putint" "PutInt" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1241 ("putreal" "PutReal" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1242 ("qua" "QUA" simula-expand-keyword)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1243 ("randint" "RandInt" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1244 ("rank" "Rank" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1245 ("reactivate" "REACTIVATE" simula-expand-keyword)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1246 ("real" "REAL" simula-expand-keyword)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1247 ("ref" "REF" simula-expand-keyword)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1248 ("resume" "Resume" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1249 ("setaccess" "SetAccess" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1250 ("setpos" "SetPos" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1251 ("short" "SHORT" simula-expand-keyword)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1252 ("sign" "Sign" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1253 ("simset" "SimSet" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1254 ("simulaid" "SimulaId" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1255 ("simulation" "Simulation" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1256 ("sin" "Sin" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1257 ("sinh" "SinH" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1258 ("sourceline" "SourceLine" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1259 ("spacing" "Spacing" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1260 ("sqrt" "Sqrt" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1261 ("start" "Start" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1262 ("step" "STEP" simula-expand-keyword)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1263 ("strip" "Strip" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1264 ("sub" "Sub" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1265 ("subepsilon" "SubEpsilon" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1266 ("suc" "Suc" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1267 ("switch" "SWITCH" simula-expand-keyword)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1268 ("sysin" "SysIn" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1269 ("sysout" "SysOut" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1270 ("tan" "Tan" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1271 ("tanh" "TanH" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1272 ("terminate_program" "Terminate_Program" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1273 ("terminated" "Terminated" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1274 ("text" "TEXT" simula-expand-keyword)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1275 ("then" "THEN" simula-electric-keyword)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1276 ("this" "THIS" simula-expand-keyword)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1277 ("time" "Time" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1278 ("to" "TO" simula-expand-keyword)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1279 ("true" "TRUE" simula-expand-keyword)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1280 ("uniform" "Uniform" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1281 ("unlock" "Unlock" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1282 ("until" "UNTIL" simula-expand-keyword)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1283 ("upcase" "Upcase" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1284 ("upperbound" "UpperBound" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1285 ("value" "VALUE" simula-expand-keyword)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1286 ("virtual" "VIRTUAL" simula-expand-keyword)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1287 ("wait" "Wait" simula-expand-stdproc)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1288 ("when" "WHEN" simula-electric-keyword)
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1289 ("while" "WHILE" simula-expand-keyword))))
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1290
10f8af91ab47 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1291 ;;; simula.el ends here