annotate lisp/progmodes/modula2.el @ 106329:1328c6aa3dec

(multi-isearch-read-buffers): Move canonicalization of buffers with `get-buffer' to `multi-isearch-buffers'. (multi-isearch-buffers, multi-isearch-buffers-regexp): Canonicalize BUFFERS with `get-buffer'. Doc fix. (multi-isearch-files, multi-isearch-files-regexp): Canonicalize FILES with `expand-file-name' converting relative file names to absolute. Doc fix. (Bug#4727)
author Juri Linkov <juri@jurta.org>
date Mon, 30 Nov 2009 20:27:44 +0000
parents 1e3a407766b9
children cc035ccb9275
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
659
505130d1ddf8 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 258
diff changeset
1 ;;; modula2.el --- Modula-2 editing support package
791
203c23c9f22c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 663
diff changeset
2
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 38412
diff changeset
3 ;; Author: Michael Schmidt <michael@pbinfo.UUCP>
791
203c23c9f22c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 663
diff changeset
4 ;; Tom Perrine <Perrin@LOGICON.ARPA>
17996
be02a4e4cf47 Comment changes.
Richard M. Stallman <rms@gnu.org>
parents: 17980
diff changeset
5 ;; Maintainer: FSF
811
e694e0879463 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 791
diff changeset
6 ;; Keywords: languages
659
505130d1ddf8 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 258
diff changeset
7
38412
253f761ad37b Some fixes to follow coding conventions in files maintained by FSF.
Pavel Janík <Pavel@Janik.cz>
parents: 20960
diff changeset
8 ;; This file is part of GNU Emacs.
253f761ad37b Some fixes to follow coding conventions in files maintained by FSF.
Pavel Janík <Pavel@Janik.cz>
parents: 20960
diff changeset
9
791
203c23c9f22c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 663
diff changeset
10 ;; The authors distributed this without a copyright notice
203c23c9f22c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 663
diff changeset
11 ;; back in 1988, so it is in the public domain. The original included
203c23c9f22c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 663
diff changeset
12 ;; the following credit:
22
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13
791
203c23c9f22c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 663
diff changeset
14 ;; Author Mick Jordan
203c23c9f22c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 663
diff changeset
15 ;; amended Peter Robinson
22
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16
2308
f287613dfc28 Added or corrected Commentary sections
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2307
diff changeset
17 ;;; Commentary:
f287613dfc28 Added or corrected Commentary sections
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2307
diff changeset
18
f287613dfc28 Added or corrected Commentary sections
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2307
diff changeset
19 ;; A major mode for editing Modula-2 code. It provides convenient abbrevs
f287613dfc28 Added or corrected Commentary sections
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2307
diff changeset
20 ;; for Modula-2 keywords, knows about the standard layout rules, and supports
f287613dfc28 Added or corrected Commentary sections
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2307
diff changeset
21 ;; a native compile command.
f287613dfc28 Added or corrected Commentary sections
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2307
diff changeset
22
791
203c23c9f22c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 663
diff changeset
23 ;;; Code:
203c23c9f22c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 663
diff changeset
24
20960
2f9b7d0689a9 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 20953
diff changeset
25 (defgroup modula2 nil
2f9b7d0689a9 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 20953
diff changeset
26 "Major mode for editing Modula-2 code."
66963
a11fdee52c05 Add :link (custom-group-link font-lock-faces) to defgroup.
Juri Linkov <juri@jurta.org>
parents: 63522
diff changeset
27 :link '(custom-group-link :tag "Font Lock Faces group" font-lock-faces)
20960
2f9b7d0689a9 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 20953
diff changeset
28 :prefix "m2-"
2f9b7d0689a9 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 20953
diff changeset
29 :group 'languages)
2f9b7d0689a9 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 20953
diff changeset
30
791
203c23c9f22c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 663
diff changeset
31 ;;; Added by Tom Perrine (TEP)
22
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
32 (defvar m2-mode-syntax-table nil
231
3c29c1b2d6a1 *** empty log message ***
Brian Preble <rassilon@gnu.org>
parents: 22
diff changeset
33 "Syntax table in use in Modula-2 buffers.")
22
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
34
20960
2f9b7d0689a9 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 20953
diff changeset
35 (defcustom m2-compile-command "m2c"
2f9b7d0689a9 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 20953
diff changeset
36 "Command to compile Modula-2 programs."
2f9b7d0689a9 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 20953
diff changeset
37 :type 'string
2f9b7d0689a9 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 20953
diff changeset
38 :group 'modula2)
22
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
39
20960
2f9b7d0689a9 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 20953
diff changeset
40 (defcustom m2-link-command "m2l"
2f9b7d0689a9 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 20953
diff changeset
41 "Command to link Modula-2 programs."
2f9b7d0689a9 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 20953
diff changeset
42 :type 'string
2f9b7d0689a9 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 20953
diff changeset
43 :group 'modula2)
22
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
44
20960
2f9b7d0689a9 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 20953
diff changeset
45 (defcustom m2-link-name nil
2f9b7d0689a9 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 20953
diff changeset
46 "Name of the Modula-2 executable."
2f9b7d0689a9 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 20953
diff changeset
47 :type '(choice (const nil) string)
2f9b7d0689a9 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 20953
diff changeset
48 :group 'modula2)
22
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
49
20960
2f9b7d0689a9 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 20953
diff changeset
50 (defcustom m2-end-comment-column 75
2f9b7d0689a9 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 20953
diff changeset
51 "*Column for aligning the end of a comment, in Modula-2."
2f9b7d0689a9 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 20953
diff changeset
52 :type 'integer
2f9b7d0689a9 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 20953
diff changeset
53 :group 'modula2)
22
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
54
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
55 (if m2-mode-syntax-table
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
56 ()
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
57 (let ((table (make-syntax-table)))
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
58 (modify-syntax-entry ?\\ "\\" table)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
59 (modify-syntax-entry ?\( ". 1" table)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
60 (modify-syntax-entry ?\) ". 4" table)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
61 (modify-syntax-entry ?* ". 23" table)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
62 (modify-syntax-entry ?+ "." table)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
63 (modify-syntax-entry ?- "." table)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
64 (modify-syntax-entry ?= "." table)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
65 (modify-syntax-entry ?% "." table)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
66 (modify-syntax-entry ?< "." table)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
67 (modify-syntax-entry ?> "." table)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
68 (modify-syntax-entry ?\' "\"" table)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
69 (setq m2-mode-syntax-table table)))
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
70
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
71 ;;; Added by TEP
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
72 (defvar m2-mode-map nil
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
73 "Keymap used in Modula-2 mode.")
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
74
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
75 (if m2-mode-map ()
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
76 (let ((map (make-sparse-keymap)))
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
77 (define-key map "\^i" 'm2-tab)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
78 (define-key map "\C-cb" 'm2-begin)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
79 (define-key map "\C-cc" 'm2-case)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
80 (define-key map "\C-cd" 'm2-definition)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
81 (define-key map "\C-ce" 'm2-else)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
82 (define-key map "\C-cf" 'm2-for)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
83 (define-key map "\C-ch" 'm2-header)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
84 (define-key map "\C-ci" 'm2-if)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
85 (define-key map "\C-cm" 'm2-module)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
86 (define-key map "\C-cl" 'm2-loop)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
87 (define-key map "\C-co" 'm2-or)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
88 (define-key map "\C-cp" 'm2-procedure)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
89 (define-key map "\C-c\C-w" 'm2-with)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
90 (define-key map "\C-cr" 'm2-record)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
91 (define-key map "\C-cs" 'm2-stdio)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
92 (define-key map "\C-ct" 'm2-type)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
93 (define-key map "\C-cu" 'm2-until)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
94 (define-key map "\C-cv" 'm2-var)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
95 (define-key map "\C-cw" 'm2-while)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
96 (define-key map "\C-cx" 'm2-export)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
97 (define-key map "\C-cy" 'm2-import)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
98 (define-key map "\C-c{" 'm2-begin-comment)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
99 (define-key map "\C-c}" 'm2-end-comment)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
100 (define-key map "\C-j" 'm2-newline)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
101 (define-key map "\C-c\C-z" 'suspend-emacs)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
102 (define-key map "\C-c\C-v" 'm2-visit)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
103 (define-key map "\C-c\C-t" 'm2-toggle)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
104 (define-key map "\C-c\C-l" 'm2-link)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
105 (define-key map "\C-c\C-c" 'm2-compile)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
106 (setq m2-mode-map map)))
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
107
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 38412
diff changeset
108 (defcustom m2-indent 5
20960
2f9b7d0689a9 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 20953
diff changeset
109 "*This variable gives the indentation in Modula-2-Mode."
2f9b7d0689a9 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 20953
diff changeset
110 :type 'integer
2f9b7d0689a9 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 20953
diff changeset
111 :group 'modula2)
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 38412
diff changeset
112
258
1e0bc00dca7a *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 231
diff changeset
113 ;;;###autoload
22
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
114 (defun modula-2-mode ()
231
3c29c1b2d6a1 *** empty log message ***
Brian Preble <rassilon@gnu.org>
parents: 22
diff changeset
115 "This is a mode intended to support program development in Modula-2.
3c29c1b2d6a1 *** empty log message ***
Brian Preble <rassilon@gnu.org>
parents: 22
diff changeset
116 All control constructs of Modula-2 can be reached by typing C-c
3c29c1b2d6a1 *** empty log message ***
Brian Preble <rassilon@gnu.org>
parents: 22
diff changeset
117 followed by the first character of the construct.
3c29c1b2d6a1 *** empty log message ***
Brian Preble <rassilon@gnu.org>
parents: 22
diff changeset
118 \\<m2-mode-map>
3c29c1b2d6a1 *** empty log message ***
Brian Preble <rassilon@gnu.org>
parents: 22
diff changeset
119 \\[m2-begin] begin \\[m2-case] case
3c29c1b2d6a1 *** empty log message ***
Brian Preble <rassilon@gnu.org>
parents: 22
diff changeset
120 \\[m2-definition] definition \\[m2-else] else
3c29c1b2d6a1 *** empty log message ***
Brian Preble <rassilon@gnu.org>
parents: 22
diff changeset
121 \\[m2-for] for \\[m2-header] header
3c29c1b2d6a1 *** empty log message ***
Brian Preble <rassilon@gnu.org>
parents: 22
diff changeset
122 \\[m2-if] if \\[m2-module] module
3c29c1b2d6a1 *** empty log message ***
Brian Preble <rassilon@gnu.org>
parents: 22
diff changeset
123 \\[m2-loop] loop \\[m2-or] or
3c29c1b2d6a1 *** empty log message ***
Brian Preble <rassilon@gnu.org>
parents: 22
diff changeset
124 \\[m2-procedure] procedure Control-c Control-w with
3c29c1b2d6a1 *** empty log message ***
Brian Preble <rassilon@gnu.org>
parents: 22
diff changeset
125 \\[m2-record] record \\[m2-stdio] stdio
3c29c1b2d6a1 *** empty log message ***
Brian Preble <rassilon@gnu.org>
parents: 22
diff changeset
126 \\[m2-type] type \\[m2-until] until
3c29c1b2d6a1 *** empty log message ***
Brian Preble <rassilon@gnu.org>
parents: 22
diff changeset
127 \\[m2-var] var \\[m2-while] while
3c29c1b2d6a1 *** empty log message ***
Brian Preble <rassilon@gnu.org>
parents: 22
diff changeset
128 \\[m2-export] export \\[m2-import] import
3c29c1b2d6a1 *** empty log message ***
Brian Preble <rassilon@gnu.org>
parents: 22
diff changeset
129 \\[m2-begin-comment] begin-comment \\[m2-end-comment] end-comment
3c29c1b2d6a1 *** empty log message ***
Brian Preble <rassilon@gnu.org>
parents: 22
diff changeset
130 \\[suspend-emacs] suspend Emacs \\[m2-toggle] toggle
3c29c1b2d6a1 *** empty log message ***
Brian Preble <rassilon@gnu.org>
parents: 22
diff changeset
131 \\[m2-compile] compile \\[m2-next-error] next-error
3c29c1b2d6a1 *** empty log message ***
Brian Preble <rassilon@gnu.org>
parents: 22
diff changeset
132 \\[m2-link] link
22
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
133
231
3c29c1b2d6a1 *** empty log message ***
Brian Preble <rassilon@gnu.org>
parents: 22
diff changeset
134 `m2-indent' controls the number of spaces for each indentation.
3c29c1b2d6a1 *** empty log message ***
Brian Preble <rassilon@gnu.org>
parents: 22
diff changeset
135 `m2-compile-command' holds the command to compile a Modula-2 program.
3c29c1b2d6a1 *** empty log message ***
Brian Preble <rassilon@gnu.org>
parents: 22
diff changeset
136 `m2-link-command' holds the command to link a Modula-2 program."
22
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
137 (interactive)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
138 (kill-all-local-variables)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
139 (use-local-map m2-mode-map)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
140 (setq major-mode 'modula-2-mode)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
141 (setq mode-name "Modula-2")
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
142 (make-local-variable 'comment-column)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
143 (setq comment-column 41)
17532
5c77f95c5dd1 (m2-end-comment-column): New defvar.
Richard M. Stallman <rms@gnu.org>
parents: 17496
diff changeset
144 (make-local-variable 'm2-end-comment-column)
22
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
145 (set-syntax-table m2-mode-syntax-table)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
146 (make-local-variable 'paragraph-start)
10885
13ce3a71c223 (modula-2-mode): Remove ^ from paragraph-start & paragraph-separate.
Boris Goldowsky <boris@gnu.org>
parents: 2308
diff changeset
147 (setq paragraph-start (concat "$\\|" page-delimiter))
22
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
148 (make-local-variable 'paragraph-separate)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
149 (setq paragraph-separate paragraph-start)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
150 (make-local-variable 'paragraph-ignore-fill-prefix)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
151 (setq paragraph-ignore-fill-prefix t)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
152 ; (make-local-variable 'indent-line-function)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
153 ; (setq indent-line-function 'c-indent-line)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
154 (make-local-variable 'require-final-newline)
59248
376983f62602 (modula-2-mode): Use mode-require-final-newline.
Richard M. Stallman <rms@gnu.org>
parents: 52401
diff changeset
155 (setq require-final-newline mode-require-final-newline)
22
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
156 (make-local-variable 'comment-start)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
157 (setq comment-start "(* ")
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
158 (make-local-variable 'comment-end)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
159 (setq comment-end " *)")
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
160 (make-local-variable 'comment-column)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
161 (setq comment-column 41)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
162 (make-local-variable 'comment-start-skip)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
163 (setq comment-start-skip "/\\*+ *")
2307
10e417efb12a Added or corrected Commentary sections
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 841
diff changeset
164 (make-local-variable 'comment-indent-function)
10e417efb12a Added or corrected Commentary sections
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 841
diff changeset
165 (setq comment-indent-function 'c-comment-indent)
22
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
166 (make-local-variable 'parse-sexp-ignore-comments)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
167 (setq parse-sexp-ignore-comments t)
17496
4cb9ccf6b6b8 Font Lock support.
Simon Marshall <simon@gnu.org>
parents: 13997
diff changeset
168 (make-local-variable 'font-lock-defaults)
4cb9ccf6b6b8 Font Lock support.
Simon Marshall <simon@gnu.org>
parents: 13997
diff changeset
169 (setq font-lock-defaults
4cb9ccf6b6b8 Font Lock support.
Simon Marshall <simon@gnu.org>
parents: 13997
diff changeset
170 '((m3-font-lock-keywords
4cb9ccf6b6b8 Font Lock support.
Simon Marshall <simon@gnu.org>
parents: 13997
diff changeset
171 m3-font-lock-keywords-1 m3-font-lock-keywords-2)
18333
ff12edf576bf Do <* *> via syntax table not regexps; use regexp-opt.
Simon Marshall <simon@gnu.org>
parents: 17996
diff changeset
172 nil nil ((?_ . "w") (?. . "w") (?< . ". 1") (?> . ". 4")) nil
17496
4cb9ccf6b6b8 Font Lock support.
Simon Marshall <simon@gnu.org>
parents: 13997
diff changeset
173 ;; Obsoleted by Emacs 19.35 parse-partial-sexp's COMMENTSTOP.
4cb9ccf6b6b8 Font Lock support.
Simon Marshall <simon@gnu.org>
parents: 13997
diff changeset
174 ;(font-lock-comment-start-regexp . "(\\*")
4cb9ccf6b6b8 Font Lock support.
Simon Marshall <simon@gnu.org>
parents: 13997
diff changeset
175 ))
62772
f2892faa87d4 * progmodes/ada-mode.el (ada-mode):
Lute Kamstra <lute@gnu.org>
parents: 59248
diff changeset
176 (run-mode-hooks 'm2-mode-hook))
17496
4cb9ccf6b6b8 Font Lock support.
Simon Marshall <simon@gnu.org>
parents: 13997
diff changeset
177
18333
ff12edf576bf Do <* *> via syntax table not regexps; use regexp-opt.
Simon Marshall <simon@gnu.org>
parents: 17996
diff changeset
178 ;; Regexps written with help from Ron Forrester <ron@orcad.com>
ff12edf576bf Do <* *> via syntax table not regexps; use regexp-opt.
Simon Marshall <simon@gnu.org>
parents: 17996
diff changeset
179 ;; and Spencer Allain <sallain@teknowledge.com>.
17496
4cb9ccf6b6b8 Font Lock support.
Simon Marshall <simon@gnu.org>
parents: 13997
diff changeset
180 (defconst m3-font-lock-keywords-1
4cb9ccf6b6b8 Font Lock support.
Simon Marshall <simon@gnu.org>
parents: 13997
diff changeset
181 '(
4cb9ccf6b6b8 Font Lock support.
Simon Marshall <simon@gnu.org>
parents: 13997
diff changeset
182 ;;
4cb9ccf6b6b8 Font Lock support.
Simon Marshall <simon@gnu.org>
parents: 13997
diff changeset
183 ;; Module definitions.
4cb9ccf6b6b8 Font Lock support.
Simon Marshall <simon@gnu.org>
parents: 13997
diff changeset
184 ("\\<\\(INTERFACE\\|MODULE\\|PROCEDURE\\)\\>[ \t]*\\(\\sw+\\)?"
4cb9ccf6b6b8 Font Lock support.
Simon Marshall <simon@gnu.org>
parents: 13997
diff changeset
185 (1 font-lock-keyword-face) (2 font-lock-function-name-face nil t))
4cb9ccf6b6b8 Font Lock support.
Simon Marshall <simon@gnu.org>
parents: 13997
diff changeset
186 ;;
4cb9ccf6b6b8 Font Lock support.
Simon Marshall <simon@gnu.org>
parents: 13997
diff changeset
187 ;; Import directives.
4cb9ccf6b6b8 Font Lock support.
Simon Marshall <simon@gnu.org>
parents: 13997
diff changeset
188 ("\\<\\(EXPORTS\\|FROM\\|IMPORT\\)\\>"
4cb9ccf6b6b8 Font Lock support.
Simon Marshall <simon@gnu.org>
parents: 13997
diff changeset
189 (1 font-lock-keyword-face)
4cb9ccf6b6b8 Font Lock support.
Simon Marshall <simon@gnu.org>
parents: 13997
diff changeset
190 (font-lock-match-c-style-declaration-item-and-skip-to-next
4cb9ccf6b6b8 Font Lock support.
Simon Marshall <simon@gnu.org>
parents: 13997
diff changeset
191 nil (goto-char (match-end 0))
20953
f3f9df46d008 Changed font-lock-reference-face to font-lock-constant-face.
Simon Marshall <simon@gnu.org>
parents: 18383
diff changeset
192 (1 font-lock-constant-face)))
17496
4cb9ccf6b6b8 Font Lock support.
Simon Marshall <simon@gnu.org>
parents: 13997
diff changeset
193 ;;
4cb9ccf6b6b8 Font Lock support.
Simon Marshall <simon@gnu.org>
parents: 13997
diff changeset
194 ;; Pragmas as warnings.
18333
ff12edf576bf Do <* *> via syntax table not regexps; use regexp-opt.
Simon Marshall <simon@gnu.org>
parents: 17996
diff changeset
195 ;; Spencer Allain <sallain@teknowledge.com> says do them as comments...
ff12edf576bf Do <* *> via syntax table not regexps; use regexp-opt.
Simon Marshall <simon@gnu.org>
parents: 17996
diff changeset
196 ;; ("<\\*.*\\*>" . font-lock-warning-face)
ff12edf576bf Do <* *> via syntax table not regexps; use regexp-opt.
Simon Marshall <simon@gnu.org>
parents: 17996
diff changeset
197 ;; ... but instead we fontify the first word.
ff12edf576bf Do <* *> via syntax table not regexps; use regexp-opt.
Simon Marshall <simon@gnu.org>
parents: 17996
diff changeset
198 ("<\\*[ \t]*\\(\\sw+\\)" 1 font-lock-warning-face prepend)
17496
4cb9ccf6b6b8 Font Lock support.
Simon Marshall <simon@gnu.org>
parents: 13997
diff changeset
199 )
4cb9ccf6b6b8 Font Lock support.
Simon Marshall <simon@gnu.org>
parents: 13997
diff changeset
200 "Subdued level highlighting for Modula-3 modes.")
4cb9ccf6b6b8 Font Lock support.
Simon Marshall <simon@gnu.org>
parents: 13997
diff changeset
201
4cb9ccf6b6b8 Font Lock support.
Simon Marshall <simon@gnu.org>
parents: 13997
diff changeset
202 (defconst m3-font-lock-keywords-2
4cb9ccf6b6b8 Font Lock support.
Simon Marshall <simon@gnu.org>
parents: 13997
diff changeset
203 (append m3-font-lock-keywords-1
4cb9ccf6b6b8 Font Lock support.
Simon Marshall <simon@gnu.org>
parents: 13997
diff changeset
204 (eval-when-compile
4cb9ccf6b6b8 Font Lock support.
Simon Marshall <simon@gnu.org>
parents: 13997
diff changeset
205 (let ((m3-types
18333
ff12edf576bf Do <* *> via syntax table not regexps; use regexp-opt.
Simon Marshall <simon@gnu.org>
parents: 17996
diff changeset
206 (regexp-opt
ff12edf576bf Do <* *> via syntax table not regexps; use regexp-opt.
Simon Marshall <simon@gnu.org>
parents: 17996
diff changeset
207 '("INTEGER" "BITS" "BOOLEAN" "CARDINAL" "CHAR" "FLOAT" "REAL"
ff12edf576bf Do <* *> via syntax table not regexps; use regexp-opt.
Simon Marshall <simon@gnu.org>
parents: 17996
diff changeset
208 "LONGREAL" "REFANY" "ADDRESS" "ARRAY" "SET" "TEXT"
ff12edf576bf Do <* *> via syntax table not regexps; use regexp-opt.
Simon Marshall <simon@gnu.org>
parents: 17996
diff changeset
209 "MUTEX" "ROOT" "EXTENDED")))
17496
4cb9ccf6b6b8 Font Lock support.
Simon Marshall <simon@gnu.org>
parents: 13997
diff changeset
210 (m3-keywords
18333
ff12edf576bf Do <* *> via syntax table not regexps; use regexp-opt.
Simon Marshall <simon@gnu.org>
parents: 17996
diff changeset
211 (regexp-opt
ff12edf576bf Do <* *> via syntax table not regexps; use regexp-opt.
Simon Marshall <simon@gnu.org>
parents: 17996
diff changeset
212 '("AND" "ANY" "AS" "BEGIN" "BRANDED" "BY" "CASE" "CONST" "DIV"
ff12edf576bf Do <* *> via syntax table not regexps; use regexp-opt.
Simon Marshall <simon@gnu.org>
parents: 17996
diff changeset
213 "DO" "ELSE" "ELSIF" "EVAL" "EXCEPT" "EXIT" "FINALLY"
ff12edf576bf Do <* *> via syntax table not regexps; use regexp-opt.
Simon Marshall <simon@gnu.org>
parents: 17996
diff changeset
214 "FOR" "GENERIC" "IF" "IN" "LOCK" "LOOP" "METHODS" "MOD" "NOT"
ff12edf576bf Do <* *> via syntax table not regexps; use regexp-opt.
Simon Marshall <simon@gnu.org>
parents: 17996
diff changeset
215 "OBJECT" "OF" "OR" "OVERRIDES" "READONLY" "RECORD" "REF"
ff12edf576bf Do <* *> via syntax table not regexps; use regexp-opt.
Simon Marshall <simon@gnu.org>
parents: 17996
diff changeset
216 "REPEAT" "RETURN" "REVEAL" "THEN" "TO" "TRY"
ff12edf576bf Do <* *> via syntax table not regexps; use regexp-opt.
Simon Marshall <simon@gnu.org>
parents: 17996
diff changeset
217 "TYPE" "TYPECASE" "UNSAFE" "UNTIL" "UNTRACED" "VAR" "VALUE"
ff12edf576bf Do <* *> via syntax table not regexps; use regexp-opt.
Simon Marshall <simon@gnu.org>
parents: 17996
diff changeset
218 "WHILE" "WITH")))
17496
4cb9ccf6b6b8 Font Lock support.
Simon Marshall <simon@gnu.org>
parents: 13997
diff changeset
219 (m3-builtins
18333
ff12edf576bf Do <* *> via syntax table not regexps; use regexp-opt.
Simon Marshall <simon@gnu.org>
parents: 17996
diff changeset
220 (regexp-opt
ff12edf576bf Do <* *> via syntax table not regexps; use regexp-opt.
Simon Marshall <simon@gnu.org>
parents: 17996
diff changeset
221 '("ABS" "ADR" "ADRSIZE" "BITSIZE" "BYTESIZE" "CEILING"
ff12edf576bf Do <* *> via syntax table not regexps; use regexp-opt.
Simon Marshall <simon@gnu.org>
parents: 17996
diff changeset
222 "DEC" "DISPOSE" "FIRST" "FLOOR" "INC" "ISTYPE" "LAST"
ff12edf576bf Do <* *> via syntax table not regexps; use regexp-opt.
Simon Marshall <simon@gnu.org>
parents: 17996
diff changeset
223 "LOOPHOLE" "MAX" "MIN" "NARROW" "NEW" "NUMBER" "ORD"
ff12edf576bf Do <* *> via syntax table not regexps; use regexp-opt.
Simon Marshall <simon@gnu.org>
parents: 17996
diff changeset
224 "ROUND" "SUBARRAY" "TRUNC" "TYPECODE" "VAL")))
17496
4cb9ccf6b6b8 Font Lock support.
Simon Marshall <simon@gnu.org>
parents: 13997
diff changeset
225 )
4cb9ccf6b6b8 Font Lock support.
Simon Marshall <simon@gnu.org>
parents: 13997
diff changeset
226 (list
4cb9ccf6b6b8 Font Lock support.
Simon Marshall <simon@gnu.org>
parents: 13997
diff changeset
227 ;;
4cb9ccf6b6b8 Font Lock support.
Simon Marshall <simon@gnu.org>
parents: 13997
diff changeset
228 ;; Keywords except those fontified elsewhere.
4cb9ccf6b6b8 Font Lock support.
Simon Marshall <simon@gnu.org>
parents: 13997
diff changeset
229 (concat "\\<\\(" m3-keywords "\\)\\>")
4cb9ccf6b6b8 Font Lock support.
Simon Marshall <simon@gnu.org>
parents: 13997
diff changeset
230 ;;
4cb9ccf6b6b8 Font Lock support.
Simon Marshall <simon@gnu.org>
parents: 13997
diff changeset
231 ;; Builtins.
4cb9ccf6b6b8 Font Lock support.
Simon Marshall <simon@gnu.org>
parents: 13997
diff changeset
232 (cons (concat "\\<\\(" m3-builtins "\\)\\>") 'font-lock-builtin-face)
4cb9ccf6b6b8 Font Lock support.
Simon Marshall <simon@gnu.org>
parents: 13997
diff changeset
233 ;;
4cb9ccf6b6b8 Font Lock support.
Simon Marshall <simon@gnu.org>
parents: 13997
diff changeset
234 ;; Type names.
4cb9ccf6b6b8 Font Lock support.
Simon Marshall <simon@gnu.org>
parents: 13997
diff changeset
235 (cons (concat "\\<\\(" m3-types "\\)\\>") 'font-lock-type-face)
4cb9ccf6b6b8 Font Lock support.
Simon Marshall <simon@gnu.org>
parents: 13997
diff changeset
236 ;;
4cb9ccf6b6b8 Font Lock support.
Simon Marshall <simon@gnu.org>
parents: 13997
diff changeset
237 ;; Fontify tokens as function names.
4cb9ccf6b6b8 Font Lock support.
Simon Marshall <simon@gnu.org>
parents: 13997
diff changeset
238 '("\\<\\(END\\|EXCEPTION\\|RAISES?\\)\\>[ \t{]*"
4cb9ccf6b6b8 Font Lock support.
Simon Marshall <simon@gnu.org>
parents: 13997
diff changeset
239 (1 font-lock-keyword-face)
18333
ff12edf576bf Do <* *> via syntax table not regexps; use regexp-opt.
Simon Marshall <simon@gnu.org>
parents: 17996
diff changeset
240 (font-lock-match-c-style-declaration-item-and-skip-to-next
ff12edf576bf Do <* *> via syntax table not regexps; use regexp-opt.
Simon Marshall <simon@gnu.org>
parents: 17996
diff changeset
241 nil (goto-char (match-end 0))
17496
4cb9ccf6b6b8 Font Lock support.
Simon Marshall <simon@gnu.org>
parents: 13997
diff changeset
242 (1 font-lock-function-name-face)))
4cb9ccf6b6b8 Font Lock support.
Simon Marshall <simon@gnu.org>
parents: 13997
diff changeset
243 ;;
4cb9ccf6b6b8 Font Lock support.
Simon Marshall <simon@gnu.org>
parents: 13997
diff changeset
244 ;; Fontify constants as references.
20953
f3f9df46d008 Changed font-lock-reference-face to font-lock-constant-face.
Simon Marshall <simon@gnu.org>
parents: 18383
diff changeset
245 '("\\<\\(FALSE\\|NIL\\|NULL\\|TRUE\\)\\>" . font-lock-constant-face)
17496
4cb9ccf6b6b8 Font Lock support.
Simon Marshall <simon@gnu.org>
parents: 13997
diff changeset
246 ))))
4cb9ccf6b6b8 Font Lock support.
Simon Marshall <simon@gnu.org>
parents: 13997
diff changeset
247 "Gaudy level highlighting for Modula-3 modes.")
4cb9ccf6b6b8 Font Lock support.
Simon Marshall <simon@gnu.org>
parents: 13997
diff changeset
248
4cb9ccf6b6b8 Font Lock support.
Simon Marshall <simon@gnu.org>
parents: 13997
diff changeset
249 (defvar m3-font-lock-keywords m3-font-lock-keywords-1
4cb9ccf6b6b8 Font Lock support.
Simon Marshall <simon@gnu.org>
parents: 13997
diff changeset
250 "Default expressions to highlight in Modula-3 modes.")
4cb9ccf6b6b8 Font Lock support.
Simon Marshall <simon@gnu.org>
parents: 13997
diff changeset
251
4cb9ccf6b6b8 Font Lock support.
Simon Marshall <simon@gnu.org>
parents: 13997
diff changeset
252 ;; We don't actually have different keywords for Modula-2. Volunteers?
4cb9ccf6b6b8 Font Lock support.
Simon Marshall <simon@gnu.org>
parents: 13997
diff changeset
253 (defconst m2-font-lock-keywords-1 m3-font-lock-keywords-1
4cb9ccf6b6b8 Font Lock support.
Simon Marshall <simon@gnu.org>
parents: 13997
diff changeset
254 "Subdued level highlighting for Modula-2 modes.")
4cb9ccf6b6b8 Font Lock support.
Simon Marshall <simon@gnu.org>
parents: 13997
diff changeset
255
4cb9ccf6b6b8 Font Lock support.
Simon Marshall <simon@gnu.org>
parents: 13997
diff changeset
256 (defconst m2-font-lock-keywords-2 m3-font-lock-keywords-2
4cb9ccf6b6b8 Font Lock support.
Simon Marshall <simon@gnu.org>
parents: 13997
diff changeset
257 "Gaudy level highlighting for Modula-2 modes.")
4cb9ccf6b6b8 Font Lock support.
Simon Marshall <simon@gnu.org>
parents: 13997
diff changeset
258
4cb9ccf6b6b8 Font Lock support.
Simon Marshall <simon@gnu.org>
parents: 13997
diff changeset
259 (defvar m2-font-lock-keywords m2-font-lock-keywords-1
4cb9ccf6b6b8 Font Lock support.
Simon Marshall <simon@gnu.org>
parents: 13997
diff changeset
260 "Default expressions to highlight in Modula-2 modes.")
4cb9ccf6b6b8 Font Lock support.
Simon Marshall <simon@gnu.org>
parents: 13997
diff changeset
261
22
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
262 (defun m2-newline ()
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
263 "Insert a newline and indent following line like previous line."
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
264 (interactive)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
265 (let ((hpos (current-indentation)))
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
266 (newline)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
267 (indent-to hpos)))
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
268
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
269 (defun m2-tab ()
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
270 "Indent to next tab stop."
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
271 (interactive)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
272 (indent-to (* (1+ (/ (current-indentation) m2-indent)) m2-indent)))
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
273
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
274 (defun m2-begin ()
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
275 "Insert a BEGIN keyword and indent for the next line."
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
276 (interactive)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
277 (insert "BEGIN")
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
278 (m2-newline)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
279 (m2-tab))
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
280
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
281 (defun m2-case ()
13997
a56ed7721b43 (m2-case, m2-for, m2-if): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents: 12953
diff changeset
282 "Build skeleton CASE statement, prompting for the <expression>."
22
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
283 (interactive)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
284 (let ((name (read-string "Case-Expression: ")))
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
285 (insert "CASE " name " OF")
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
286 (m2-newline)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
287 (m2-newline)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
288 (insert "END (* case " name " *);"))
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
289 (end-of-line 0)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
290 (m2-tab))
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
291
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
292 (defun m2-definition ()
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
293 "Build skeleton DEFINITION MODULE, prompting for the <module name>."
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
294 (interactive)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
295 (insert "DEFINITION MODULE ")
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
296 (let ((name (read-string "Name: ")))
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
297 (insert name ";\n\n\n\nEND " name ".\n"))
78683
96cf59afcbbc (m2-definition, m2-module): Don't use previous-line.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 66963
diff changeset
298 (forward-line -3))
22
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
299
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
300 (defun m2-else ()
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
301 "Insert ELSE keyword and indent for next line."
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
302 (interactive)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
303 (m2-newline)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
304 (backward-delete-char-untabify m2-indent ())
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
305 (insert "ELSE")
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
306 (m2-newline)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
307 (m2-tab))
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
308
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
309 (defun m2-for ()
13997
a56ed7721b43 (m2-case, m2-for, m2-if): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents: 12953
diff changeset
310 "Build skeleton FOR loop statement, prompting for the loop parameters."
22
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
311 (interactive)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
312 (insert "FOR ")
63522
96b14b14568b (m2-for): Fix spellings.
Juanma Barranquero <lekktu@gmail.com>
parents: 62772
diff changeset
313 (let ((name (read-string "Loop Initializer: ")) limit by)
22
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
314 (insert name " TO ")
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
315 (setq limit (read-string "Limit: "))
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
316 (insert limit)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
317 (setq by (read-string "Step: "))
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
318 (if (not (string-equal by ""))
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
319 (insert " BY " by))
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
320 (insert " DO")
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
321 (m2-newline)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
322 (m2-newline)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
323 (insert "END (* for " name " to " limit " *);"))
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
324 (end-of-line 0)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
325 (m2-tab))
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
326
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
327 (defun m2-header ()
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
328 "Insert a comment block containing the module title, author, etc."
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
329 (interactive)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
330 (insert "(*\n Title: \t")
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
331 (insert (read-string "Title: "))
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
332 (insert "\n Created:\t")
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
333 (insert (current-time-string))
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
334 (insert "\n Author: \t")
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
335 (insert (user-full-name))
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
336 (insert (concat "\n\t\t<" (user-login-name) "@" (system-name) ">\n"))
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
337 (insert "*)\n\n"))
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
338
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
339 (defun m2-if ()
13997
a56ed7721b43 (m2-case, m2-for, m2-if): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents: 12953
diff changeset
340 "Insert skeleton IF statement, prompting for <boolean-expression>."
22
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
341 (interactive)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
342 (insert "IF ")
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
343 (let ((thecondition (read-string "<boolean-expression>: ")))
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
344 (insert thecondition " THEN")
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
345 (m2-newline)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
346 (m2-newline)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
347 (insert "END (* if " thecondition " *);"))
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
348 (end-of-line 0)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
349 (m2-tab))
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
350
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
351 (defun m2-loop ()
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
352 "Build skeleton LOOP (with END)."
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
353 (interactive)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
354 (insert "LOOP")
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
355 (m2-newline)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
356 (m2-newline)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
357 (insert "END (* loop *);")
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
358 (end-of-line 0)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
359 (m2-tab))
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
360
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
361 (defun m2-module ()
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
362 "Build skeleton IMPLEMENTATION MODULE, prompting for <module-name>."
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
363 (interactive)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
364 (insert "IMPLEMENTATION MODULE ")
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
365 (let ((name (read-string "Name: ")))
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
366 (insert name ";\n\n\n\nEND " name ".\n")
78683
96cf59afcbbc (m2-definition, m2-module): Don't use previous-line.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 66963
diff changeset
367 (forward-line -3)
22
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
368 (m2-header)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
369 (m2-type)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
370 (newline)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
371 (m2-var)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
372 (newline)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
373 (m2-begin)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
374 (m2-begin-comment)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
375 (insert " Module " name " Initialisation Code "))
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
376 (m2-end-comment)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
377 (newline)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
378 (m2-tab))
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
379
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
380 (defun m2-or ()
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
381 (interactive)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
382 (m2-newline)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
383 (backward-delete-char-untabify m2-indent)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
384 (insert "|")
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
385 (m2-newline)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
386 (m2-tab))
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
387
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
388 (defun m2-procedure ()
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
389 (interactive)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
390 (insert "PROCEDURE ")
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
391 (let ((name (read-string "Name: " ))
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
392 args)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
393 (insert name " (")
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
394 (insert (read-string "Arguments: ") ")")
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
395 (setq args (read-string "Result Type: "))
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
396 (if (not (string-equal args ""))
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
397 (insert " : " args))
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
398 (insert ";")
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
399 (m2-newline)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
400 (insert "BEGIN")
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
401 (m2-newline)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
402 (m2-newline)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
403 (insert "END ")
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
404 (insert name)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
405 (insert ";")
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
406 (end-of-line 0)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
407 (m2-tab)))
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
408
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
409 (defun m2-with ()
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
410 (interactive)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
411 (insert "WITH ")
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
412 (let ((name (read-string "Record-Type: ")))
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
413 (insert name)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
414 (insert " DO")
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
415 (m2-newline)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
416 (m2-newline)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
417 (insert "END (* with " name " *);"))
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
418 (end-of-line 0)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
419 (m2-tab))
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
420
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
421 (defun m2-record ()
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
422 (interactive)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
423 (insert "RECORD")
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
424 (m2-newline)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
425 (m2-newline)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
426 (insert "END (* record *);")
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
427 (end-of-line 0)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
428 (m2-tab))
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
429
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
430 (defun m2-stdio ()
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
431 (interactive)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
432 (insert "
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 38412
diff changeset
433 FROM TextIO IMPORT
22
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
434 WriteCHAR, ReadCHAR, WriteINTEGER, ReadINTEGER,
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
435 WriteCARDINAL, ReadCARDINAL, WriteBOOLEAN, ReadBOOLEAN,
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
436 WriteREAL, ReadREAL, WriteBITSET, ReadBITSET,
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
437 WriteBasedCARDINAL, ReadBasedCARDINAL, WriteChars, ReadChars,
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
438 WriteString, ReadString, WhiteSpace, EndOfLine;
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
439
231
3c29c1b2d6a1 *** empty log message ***
Brian Preble <rassilon@gnu.org>
parents: 22
diff changeset
440 FROM SysStreams IMPORT sysIn, sysOut, sysErr;
22
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
441
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
442 "))
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
443
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
444 (defun m2-type ()
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
445 (interactive)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
446 (insert "TYPE")
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
447 (m2-newline)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
448 (m2-tab))
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
449
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
450 (defun m2-until ()
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
451 (interactive)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
452 (insert "REPEAT")
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
453 (m2-newline)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
454 (m2-newline)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
455 (insert "UNTIL ")
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
456 (insert (read-string "<boolean-expression>: ") ";")
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
457 (end-of-line 0)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
458 (m2-tab))
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
459
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
460 (defun m2-var ()
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
461 (interactive)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
462 (m2-newline)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
463 (insert "VAR")
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
464 (m2-newline)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
465 (m2-tab))
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
466
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
467 (defun m2-while ()
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
468 (interactive)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
469 (insert "WHILE ")
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
470 (let ((name (read-string "<boolean-expression>: ")))
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
471 (insert name " DO" )
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
472 (m2-newline)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
473 (m2-newline)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
474 (insert "END (* while " name " *);"))
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
475 (end-of-line 0)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
476 (m2-tab))
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
477
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
478 (defun m2-export ()
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
479 (interactive)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
480 (insert "EXPORT QUALIFIED "))
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
481
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
482 (defun m2-import ()
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
483 (interactive)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
484 (insert "FROM ")
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
485 (insert (read-string "Module: "))
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
486 (insert " IMPORT "))
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
487
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
488 (defun m2-begin-comment ()
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
489 (interactive)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
490 (if (not (bolp))
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
491 (indent-to comment-column 0))
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
492 (insert "(* "))
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
493
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
494 (defun m2-end-comment ()
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
495 (interactive)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
496 (if (not (bolp))
17532
5c77f95c5dd1 (m2-end-comment-column): New defvar.
Richard M. Stallman <rms@gnu.org>
parents: 17496
diff changeset
497 (indent-to m2-end-comment-column))
22
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
498 (insert "*)"))
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
499
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
500 (defun m2-compile ()
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
501 (interactive)
17532
5c77f95c5dd1 (m2-end-comment-column): New defvar.
Richard M. Stallman <rms@gnu.org>
parents: 17496
diff changeset
502 (compile (concat m2-compile-command " " (buffer-name))))
22
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
503
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
504 (defun m2-link ()
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
505 (interactive)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
506 (if m2-link-name
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
507 (compile (concat m2-link-command " " m2-link-name))
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
508 (compile (concat m2-link-command " "
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
509 (setq m2-link-name (read-string "Name of executable: "
17532
5c77f95c5dd1 (m2-end-comment-column): New defvar.
Richard M. Stallman <rms@gnu.org>
parents: 17496
diff changeset
510 (buffer-name)))))))
22
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
511
12953
e0db27f18a43 (m2-execute-monitor-command): Renamed from execute-monitor-command.
Richard M. Stallman <rms@gnu.org>
parents: 10885
diff changeset
512 (defun m2-execute-monitor-command (command)
22
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
513 (let* ((shell shell-file-name)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
514 (csh (equal (file-name-nondirectory shell) "csh")))
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
515 (call-process shell nil t t "-cf" (concat "exec " command))))
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
516
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
517 (defun m2-visit ()
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
518 (interactive)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
519 (let ((deffile nil)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
520 (modfile nil)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
521 modulename)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
522 (save-excursion
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
523 (setq modulename
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
524 (read-string "Module name: "))
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
525 (switch-to-buffer "*Command Execution*")
12953
e0db27f18a43 (m2-execute-monitor-command): Renamed from execute-monitor-command.
Richard M. Stallman <rms@gnu.org>
parents: 10885
diff changeset
526 (m2-execute-monitor-command (concat "m2whereis " modulename))
22
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
527 (goto-char (point-min))
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
528 (condition-case ()
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
529 (progn (re-search-forward "\\(.*\\.def\\) *$")
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
530 (setq deffile (buffer-substring (match-beginning 1)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
531 (match-end 1))))
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
532 (search-failed ()))
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
533 (condition-case ()
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
534 (progn (re-search-forward "\\(.*\\.mod\\) *$")
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
535 (setq modfile (buffer-substring (match-beginning 1)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
536 (match-end 1))))
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
537 (search-failed ()))
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
538 (if (not (or deffile modfile))
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
539 (error "I can find neither definition nor implementation of %s"
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
540 modulename)))
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
541 (cond (deffile
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
542 (find-file deffile)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
543 (if modfile
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
544 (save-excursion
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
545 (find-file modfile))))
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
546 (modfile
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
547 (find-file modfile)))))
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
548
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
549 (defun m2-toggle ()
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
550 "Toggle between .mod and .def files for the module."
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
551 (interactive)
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
552 (cond ((string-equal (substring (buffer-name) -4) ".def")
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
553 (find-file-other-window
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
554 (concat (substring (buffer-name) 0 -4) ".mod")))
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
555 ((string-equal (substring (buffer-name) -4) ".mod")
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
556 (find-file-other-window
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
557 (concat (substring (buffer-name) 0 -4) ".def")))
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
558 ((string-equal (substring (buffer-name) -3) ".mi")
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
559 (find-file-other-window
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
560 (concat (substring (buffer-name) 0 -3) ".md")))
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
561 ((string-equal (substring (buffer-name) -3) ".md")
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
562 (find-file-other-window
dee6a680d1d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
563 (concat (substring (buffer-name) 0 -3) ".mi")))))
659
505130d1ddf8 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 258
diff changeset
564
18383
11218164bc54 Add provide call.
Richard M. Stallman <rms@gnu.org>
parents: 18333
diff changeset
565 (provide 'modula2)
11218164bc54 Add provide call.
Richard M. Stallman <rms@gnu.org>
parents: 18333
diff changeset
566
93975
1e3a407766b9 Fix up comment convention on the arch-tag lines.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 78683
diff changeset
567 ;; arch-tag: a21df1cb-5ece-4709-9219-1e7cd2d85d90
659
505130d1ddf8 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 258
diff changeset
568 ;;; modula2.el ends here