Mercurial > emacs
annotate lisp/progmodes/meta-mode.el @ 103434:2527d8d9a450
(vc-default-revision-granularity): Remove to let the normal
error handling kick in (bug#3570).
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Mon, 15 Jun 2009 20:55:53 +0000 |
parents | a9dc0e7c3f2b |
children | 4436585c0829 |
rev | line source |
---|---|
38436
b174db545cfd
Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents:
20953
diff
changeset
|
1 ;;; meta-mode.el --- major mode for editing Metafont or MetaPost sources |
18388 | 2 |
100908 | 3 ;; Copyright (C) 1997, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 |
64699
629afbe74e61
Update copyright for release of 22.1 for progmodes directory.
Nick Roberts <nickrob@snap.net.nz>
parents:
64085
diff
changeset
|
4 ;; Free Software Foundation, Inc. |
18388 | 5 |
6 ;; Author: Ulrik Vieth <vieth@thphy.uni-duesseldorf.de> | |
7 ;; Version: 1.0 | |
8 ;; Keywords: Metafont, MetaPost, tex, languages | |
9 | |
18924
f4b6329afef0
Update copyright notice and permission notice.
Richard M. Stallman <rms@gnu.org>
parents:
18388
diff
changeset
|
10 ;; This file is part of GNU Emacs. |
18388 | 11 |
94673
52b7a8c22af5
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
87649
diff
changeset
|
12 ;; GNU Emacs is free software: you can redistribute it and/or modify |
18388 | 13 ;; it under the terms of the GNU General Public License as published by |
94673
52b7a8c22af5
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
87649
diff
changeset
|
14 ;; the Free Software Foundation, either version 3 of the License, or |
52b7a8c22af5
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
87649
diff
changeset
|
15 ;; (at your option) any later version. |
18388 | 16 |
18924
f4b6329afef0
Update copyright notice and permission notice.
Richard M. Stallman <rms@gnu.org>
parents:
18388
diff
changeset
|
17 ;; GNU Emacs is distributed in the hope that it will be useful, |
18388 | 18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
20 ;; GNU General Public License for more details. | |
21 | |
22 ;; You should have received a copy of the GNU General Public License | |
94673
52b7a8c22af5
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
87649
diff
changeset
|
23 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
18388 | 24 |
25 ;;; Commentary: | |
26 | |
27 ;; Description: | |
28 ;; | |
29 ;; This Emacs Lisp package provides a major mode for editing Metafont | |
30 ;; or MetaPost sources. It includes all the necessary code to set up | |
31 ;; a major mode including an approriate syntax table, keymap, and a | |
32 ;; mode-specific pull-down menu. It also provides a sophisticated set | |
33 ;; of font-lock patterns, a fancy indentation function adapted from | |
56756 | 34 ;; AUCTeX's latex.el, and some basic mode-specific editing functions |
18388 | 35 ;; such as functions to move to the beginning or end of the enclosing |
36 ;; environment, or to mark, re-indent, or comment-out environments. | |
37 ;; On the other hand, it doesn't yet provide any functionality for | |
38 ;; running Metafont or MetaPost in a shell buffer form within Emacs, | |
39 ;; but such functionality might be added later, either as part of this | |
40 ;; package or as a separate Emacs Lisp package. | |
41 | |
42 ;; Installation: | |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
38436
diff
changeset
|
43 ;; |
18388 | 44 ;; An interface to running Metafont or MetaPost as a shell process |
45 ;; from within Emacs is currently under development as a separate | |
46 ;; Emacs Lisp package (meta-buf.el). In order to have that package | |
47 ;; loaded automatically when first entering Metafont or MetaPost mode, | |
48 ;; you might use the load-hook provided in this package by adding | |
49 ;; these lines to your startup file: | |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
38436
diff
changeset
|
50 ;; |
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
38436
diff
changeset
|
51 ;; (add-hook 'meta-mode-load-hook |
82450
be32023b5c7b
(meta-indent-calculate-last): Remove.
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
78234
diff
changeset
|
52 ;; (lambda () (require 'meta-buf))) |
18388 | 53 ;; |
54 ;; The add-on package loaded this way may in turn make use of the | |
55 ;; mode-hooks provided in this package to activate additional features | |
56 ;; when entering Metafont or MetaPost mode. | |
57 | |
58 ;; Font Lock Support: | |
59 ;; | |
60 ;; If you are using global-font-lock-mode (introduced in Emacs 19.31), | |
61 ;; fontification in Metafont and/or MetaPost mode will be activated | |
62 ;; automatically. To speed up fontification for the rather complex | |
63 ;; patterns used in these modes, it may be a good idea to activate | |
64 ;; lazy-lock as a font-lock-support-mode (introduced in Emacs 19.32) | |
65 ;; by adding these lines to your startup file: | |
66 ;; | |
67 ;; (global-font-lock-mode t) | |
68 ;; (setq font-lock-support-mode 'lazy-lock-mode) | |
69 ;; | |
70 ;; If you are using an older version of Emacs, which doesn't provide | |
71 ;; global-font-lock-mode or font-lock-support-mode, you can also | |
72 ;; activate fontification in Metafont and/or MetaPost mode by adding | |
73 ;; the following lines to your startup file: | |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
38436
diff
changeset
|
74 ;; |
18388 | 75 ;; (add-hook 'meta-common-mode-hook 'turn-on-font-lock) |
76 ;; (add-hook 'meta-common-mode-hook 'turn-on-lazy-lock) | |
77 | |
78 ;; Customization: | |
79 ;; | |
80 ;; Following the usual Emacs Lisp coding conventions, the major modes | |
81 ;; defined in this package provide several hook variables to allow for | |
82 ;; local customization when entering the modes. In particular, there | |
83 ;; is a `meta-common-mode-hook' which applies to both modes as well as | |
84 ;; `metafont-mode-hook' and `metapost-mode-hook' which apply to the | |
85 ;; individual modes. In addition, there are several variables and | |
86 ;; regexps controlling e.g. the behavior of the indentation function, | |
87 ;; which may be customized via `edit-options'. Please refer to the | |
88 ;; docstrings in the code below for details. | |
89 | |
90 ;; Availability: | |
91 ;; | |
92 ;; This package is currently available via my "TeX Software" WWW page: | |
93 ;; | |
94 ;; http://www.thphy.uni-duesseldorf.de/~vieth/subjects/tex/software.html | |
95 ;; | |
96 ;; As of this version 1.0, this package will be uploaded to CTAN | |
97 ;; archives, where it shall find a permanent home, presumably in | |
98 ;; tex-archive/support/emacs-modes. It will also be submitted for | |
99 ;; integration into the GNU Emacs distribution at that time. | |
100 ;; | |
101 ;; History: | |
102 ;; | |
103 ;; v 0.0 -- 1997/02/01 UV Started writing meta-mode.el. | |
104 ;; v 0.1 -- 1997/02/02 UV Added preliminary set of font-lock patterns. | |
105 ;; v 0.2 -- 1997/02/03 UV Improved and debugged font-lock patterns. | |
106 ;; Added indent-line-function for TAB. | |
107 ;; v 0.3 -- 1997/02/17 UV Improved font-lock patterns and syntax table. | |
108 ;; Improved and debbuged indentation function. | |
109 ;; v 0.4 -- 1997/02/18 UV Added functions to indent regions for M-C-q, | |
110 ;; also added a preliminary mode-specific menu. | |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
38436
diff
changeset
|
111 ;; v 0.5 -- 1997/02/19 UV Added functions to skip to next or previous |
18388 | 112 ;; defun and to re-indent or comment-out defuns. |
113 ;; v 0.6 -- 1997/02/20 UV More debugging, testing and clean-up. | |
114 ;; v 0.7 -- 1997/02/22 UV Use easymenu to define mode-specific menu. | |
115 ;; v 0.8 -- 1997/02/24 UV Added completion function for M-TAB. | |
116 ;; v 0.9 -- 1997/03/08 UV Added fill-paragraph function for comments. | |
117 ;; Also fixed a few remaining font-lock problems. | |
118 ;; Added meta-mode-load-hook to load meta-buf.el. | |
119 ;; v 1.0 -- 1997/04/07 UV Cleanup for official public release. | |
120 ;; | |
121 ;; Historical Footnote: | |
122 ;; | |
123 ;; This package was begun on February 1, 1997, exactly 20 years after | |
124 ;; the genesis of TeX took place according to Don Knuth's own account | |
84654
9b686572bf3f
(meta-mode-syntax-table): Move init into decl.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84453
diff
changeset
|
125 ;; (cf. ``The Errors of TeX'', reprinted in ``Literate Programming'', |
18388 | 126 ;; Chapter 10, p. 249). What better date could there be to choose? |
127 ;; | |
128 | |
129 | |
130 ;;; Code: | |
131 | |
132 (require 'easymenu) | |
133 | |
20781 | 134 (defgroup meta-font nil |
135 "Major mode for editing Metafont or MetaPost sources." | |
66963
a11fdee52c05
Add :link (custom-group-link font-lock-faces) to defgroup.
Juri Linkov <juri@jurta.org>
parents:
66114
diff
changeset
|
136 :link '(custom-group-link :tag "Font Lock Faces group" font-lock-faces) |
20781 | 137 :group 'languages) |
138 | |
18388 | 139 ;;; Fontification. |
140 | |
141 (defvar meta-font-lock-keywords | |
142 (let ((input-keywords | |
143 "\\(input\\|generate\\)") | |
144 (begin-keywords | |
145 (concat "\\(begin\\(char\\|fig\\|graph\\|logochar\\)\\|" | |
146 "\\cmchar\\|dcchar\\|ecchar\\)")) | |
147 (end-keywords | |
148 "\\(end\\(char\\|fig\\|graph\\)\\)") | |
149 (macro-keywords-1 | |
150 "\\(def\\|let\\|mode_def\\|vardef\\)") | |
151 (macro-keywords-2 | |
152 "\\(primarydef\\|secondarydef\\|tertiarydef\\)") | |
153 ;(make-regexp | |
154 ; '("expr" "suffix" "text" "primary" "secondary" "tertiary") t) | |
155 (args-keywords | |
156 (concat "\\(expr\\|primary\\|s\\(econdary\\|uffix\\)\\|" | |
157 "te\\(rtiary\\|xt\\)\\)")) | |
158 ;(make-regexp | |
159 ; '("boolean" "color" "numeric" "pair" "path" "pen" "picture" | |
160 ; "string" "transform" "newinternal") t) | |
161 (type-keywords | |
162 (concat "\\(boolean\\|color\\|n\\(ewinternal\\|umeric\\)\\|" | |
163 "p\\(a\\(ir\\|th\\)\\|en\\|icture\\)\\|string\\|" | |
164 "transform\\)")) | |
165 ;(make-regexp | |
166 ; '("for" "forever" "forsuffixes" "endfor" | |
167 ; "step" "until" "upto" "downto" "thru" "within" | |
168 ; "iff" "if" "elseif" "else" "fi" "exitif" "exitunless" | |
169 ; "let" "def" "vardef" "enddef" "mode_def" | |
170 ; "true" "false" "known" "unknown" "and" "or" "not" | |
171 ; "save" "interim" "inner" "outer" "relax" | |
172 ; "begingroup" "endgroup" "expandafter" "scantokens" | |
173 ; "generate" "input" "endinput" "end" "bye" | |
174 ; "message" "errmessage" "errhelp" "special" "numspecial" | |
175 ; "readstring" "readfrom" "write") t) | |
176 (syntactic-keywords | |
177 (concat "\\(and\\|b\\(egingroup\\|ye\\)\\|" | |
178 "d\\(ef\\|ownto\\)\\|e\\(lse\\(\\|if\\)" | |
179 "\\|nd\\(\\|def\\|for\\|group\\|input\\)" | |
180 "\\|rr\\(help\\|message\\)" | |
181 "\\|x\\(it\\(if\\|unless\\)\\|pandafter\\)\\)\\|" | |
182 "f\\(alse\\|i\\|or\\(\\|ever\\|suffixes\\)\\)\\|" | |
183 "generate\\|i\\(ff?\\|n\\(ner\\|put\\|terim\\)\\)\\|" | |
184 "known\\|let\\|m\\(essage\\|ode_def\\)\\|" | |
185 "n\\(ot\\|umspecial\\)\\|o\\(r\\|uter\\)\\|" | |
186 "re\\(ad\\(from\\|string\\)\\|lax\\)\\|" | |
187 "s\\(ave\\|cantokens\\|pecial\\|tep\\)\\|" | |
188 "t\\(hru\\|rue\\)\\|" | |
189 "u\\(n\\(known\\|til\\)\\|pto\\)\\|" | |
190 "vardef\\|w\\(ithin\\|rite\\)\\)")) | |
191 ) | |
192 (list | |
193 ;; embedded TeX code in btex ... etex | |
194 (cons (concat "\\(btex\\|verbatimtex\\)" | |
84451
3258c63732d1
(meta-font-lock-keywords)
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
82450
diff
changeset
|
195 "[ \t\f]+\\(.*\\)[ \t\f]+" |
18388 | 196 "\\(etex\\)") |
197 '((1 font-lock-keyword-face) | |
198 (2 font-lock-string-face) | |
199 (3 font-lock-keyword-face))) | |
200 ;; unary macro definitions: def, vardef, let | |
201 (cons (concat "\\<" macro-keywords-1 "\\>" | |
84451
3258c63732d1
(meta-font-lock-keywords)
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
82450
diff
changeset
|
202 "[ \t\f]+\\(\\sw+\\|\\s_+\\|\\s.+\\)") |
18388 | 203 '((1 font-lock-keyword-face) |
204 (2 font-lock-function-name-face))) | |
205 ;; binary macro defintions: <leveldef> x operator y | |
206 (cons (concat "\\<" macro-keywords-2 "\\>" | |
84451
3258c63732d1
(meta-font-lock-keywords)
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
82450
diff
changeset
|
207 "[ \t\f]+\\(\\sw+\\)" |
3258c63732d1
(meta-font-lock-keywords)
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
82450
diff
changeset
|
208 "[ \t\f]*\\(\\sw+\\|\\s.+\\)" |
3258c63732d1
(meta-font-lock-keywords)
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
82450
diff
changeset
|
209 "[ \t\f]*\\(\\sw+\\)") |
18388 | 210 '((1 font-lock-keyword-face) |
211 (2 font-lock-variable-name-face nil t) | |
212 (3 font-lock-function-name-face nil t) | |
213 (4 font-lock-variable-name-face nil t))) | |
214 ;; variable declarations: numeric, pair, color, ... | |
215 (cons (concat "\\<" type-keywords "\\>" | |
84451
3258c63732d1
(meta-font-lock-keywords)
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
82450
diff
changeset
|
216 "\\([ \t\f]+\\(\\sw+\\)\\)*") |
18388 | 217 '((1 font-lock-type-face) |
218 (font-lock-match-meta-declaration-item-and-skip-to-next | |
219 (goto-char (match-end 1)) nil | |
220 (1 font-lock-variable-name-face nil t)))) | |
221 ;; argument declarations: expr, suffix, text, ... | |
222 (cons (concat "\\<" args-keywords "\\>" | |
84451
3258c63732d1
(meta-font-lock-keywords)
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
82450
diff
changeset
|
223 "\\([ \t\f]+\\(\\sw+\\|\\s_+\\)\\)*") |
18388 | 224 '((1 font-lock-type-face) |
225 (font-lock-match-meta-declaration-item-and-skip-to-next | |
226 (goto-char (match-end 1)) nil | |
227 (1 font-lock-variable-name-face nil t)))) | |
228 ;; special case of arguments: expr x of y | |
84451
3258c63732d1
(meta-font-lock-keywords)
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
82450
diff
changeset
|
229 (cons (concat "\\(expr\\)[ \t\f]+\\(\\sw+\\)" |
3258c63732d1
(meta-font-lock-keywords)
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
82450
diff
changeset
|
230 "[ \t\f]+\\(of\\)[ \t\f]+\\(\\sw+\\)") |
18388 | 231 '((1 font-lock-type-face) |
232 (2 font-lock-variable-name-face) | |
233 (3 font-lock-keyword-face nil t) | |
234 (4 font-lock-variable-name-face nil t))) | |
235 ;; syntactic keywords | |
236 (cons (concat "\\<" syntactic-keywords "\\>") | |
237 'font-lock-keyword-face) | |
238 ;; beginchar, beginfig | |
239 (cons (concat "\\<" begin-keywords "\\>") | |
240 'font-lock-keyword-face) | |
241 ;; endchar, endfig | |
242 (cons (concat "\\<" end-keywords "\\>") | |
243 'font-lock-keyword-face) | |
244 ;; input, generate | |
245 (cons (concat "\\<" input-keywords "\\>" | |
84451
3258c63732d1
(meta-font-lock-keywords)
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
82450
diff
changeset
|
246 "[ \t\f]+\\(\\sw+\\)") |
18388 | 247 '((1 font-lock-keyword-face) |
20953
f3f9df46d008
Changed font-lock-reference-face to font-lock-constant-face.
Simon Marshall <simon@gnu.org>
parents:
20781
diff
changeset
|
248 (2 font-lock-constant-face))) |
18388 | 249 ;; embedded Metafont/MetaPost code in comments |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
38436
diff
changeset
|
250 (cons "|\\([^|]+\\)|" |
20953
f3f9df46d008
Changed font-lock-reference-face to font-lock-constant-face.
Simon Marshall <simon@gnu.org>
parents:
20781
diff
changeset
|
251 '(1 font-lock-constant-face t)) |
18388 | 252 )) |
253 "Default expressions to highlight in Metafont or MetaPost mode.") | |
254 | |
255 | |
256 (defun font-lock-match-meta-declaration-item-and-skip-to-next (limit) | |
257 ;; Match and move over Metafont/MetaPost declaration item after point. | |
258 ;; | |
259 ;; The expected syntax of an item is either "word" or "symbol", | |
260 ;; possibly ending with optional whitespace. Everything following | |
261 ;; the item (but belonging to it) is expected to by skipable by | |
262 ;; `forward-sexp'. The list of items is expected to be separated | |
263 ;; by commas and terminated by semicolons or equals signs. | |
264 ;; | |
84451
3258c63732d1
(meta-font-lock-keywords)
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
82450
diff
changeset
|
265 (if (looking-at "[ \t\f]*\\(\\sw+\\|\\s_+\\)") |
18388 | 266 (save-match-data |
267 (condition-case nil | |
268 (save-restriction | |
269 ;; Restrict to end of line, currently guaranteed to be LIMIT. | |
270 (narrow-to-region (point-min) limit) | |
271 (goto-char (match-end 1)) | |
272 ;; Move over any item value, etc., to the next item. | |
84451
3258c63732d1
(meta-font-lock-keywords)
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
82450
diff
changeset
|
273 (while (not (looking-at "[ \t\f]*\\(\\(,\\)\\|;\\|=\\|$\\)")) |
18388 | 274 (goto-char (or (scan-sexps (point) 1) (point-max)))) |
275 (goto-char (match-end 2))) | |
276 (error t))))) | |
277 | |
278 | |
279 | |
280 ;;; Completion. | |
281 | |
282 ;; The data used to prepare the following lists of primitives and | |
283 ;; standard macros available in Metafont or MetaPost was extracted | |
284 ;; from the original sources like this: | |
285 ;; | |
286 ;; grep '^primitive' texk-7.0/web2c/{mf,mp}.web |\ | |
287 ;; sed 's/primitive(\("[a-zA-Z]*"\).*/\1/' > {mf,mp}_prim.list | |
288 ;; | |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
38436
diff
changeset
|
289 ;; grep '\(let\|def\|vardef\|primarydef\|secondarydef\|tertiarydef\)' |
18388 | 290 ;; texmf/meta{font,post}/plain.{mf,mp} > {mf,mp}_plain.list |
291 | |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
38436
diff
changeset
|
292 (defconst meta-common-primitives-list |
18388 | 293 '("ASCII" "addto" "also" "and" "angle" "atleast" "batchmode" |
294 "begingroup" "boolean" "boundarychar" "char" "charcode" "chardp" | |
295 "charexists" "charext" "charht" "charic" "charlist" "charwd" | |
296 "contour" "controls" "cosd" "curl" "cycle" "day" "decimal" "def" | |
297 "delimiters" "designsize" "directiontime" "doublepath" "dump" "else" | |
298 "elseif" "end" "enddef" "endfor" "endgroup" "endinput" "errhelp" | |
299 "errmessage" "errorstopmode" "everyjob" "exitif" "expandafter" | |
300 "expr" "extensible" "false" "fi" "floor" "fontdimen" "fontmaking" | |
301 "for" "forever" "forsuffixes" "headerbyte" "hex" "if" "inner" | |
302 "input" "interim" "intersectiontimes" "jobname" "kern" "known" | |
303 "length" "let" "ligtable" "makepath" "makepen" "message" "mexp" | |
304 "mlog" "month" "newinternal" "nonstopmode" "normaldeviate" "not" | |
305 "nullpen" "nullpicture" "numeric" "oct" "odd" "of" "or" "outer" | |
306 "pair" "path" "pausing" "pen" "pencircle" "penoffset" "picture" | |
307 "point" "postcontrol" "precontrol" "primary" "primarydef" "quote" | |
308 "randomseed" "readstring" "reverse" "rotated" "save" "scaled" | |
309 "scantokens" "scrollmode" "secondary" "secondarydef" "shifted" | |
310 "shipout" "show" "showdependencies" "showstats" "showstopping" | |
311 "showtoken" "showvariable" "sind" "skipto" "slanted" "special" | |
312 "sqrt" "step" "str" "string" "subpath" "substring" "suffix" | |
313 "tension" "tertiary" "tertiarydef" "text" "time" "to" | |
314 "tracingcapsules" "tracingchoices" "tracingcommands" | |
315 "tracingequations" "tracingmacros" "tracingonline" "tracingoutput" | |
316 "tracingrestores" "tracingspecs" "tracingstats" "tracingtitles" | |
317 "transform" "transformed" "true" "turningnumber" "uniformdeviate" | |
318 "unknown" "until" "vardef" "warningcheck" "withpen" "xpart" | |
319 "xscaled" "xxpart" "xypart" "year" "ypart" "yscaled" "yxpart" | |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
38436
diff
changeset
|
320 "yypart" "zscaled") |
18388 | 321 "List of primitives common to Metafont and MetaPost.") |
322 | |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
38436
diff
changeset
|
323 (defconst metafont-primitives-list |
18388 | 324 '("at" "autorounding" "chardx" "chardy" "cull" "display" |
325 "dropping" "fillin" "from" "granularity" "hppp" "inwindow" | |
326 "keeping" "numspecial" "openwindow" "proofing" "smoothing" | |
327 "totalweight" "tracingedges" "tracingpens" "turningcheck" "vppp" | |
328 "withweight" "xoffset" "yoffset") | |
329 "List of primitives only defined in Metafont.") | |
330 | |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
38436
diff
changeset
|
331 (defconst metapost-primitives-list |
18388 | 332 '("arclength" "arctime" "bluepart" "bounded" "btex" "clip" |
333 "clipped" "color" "dashed" "dashpart" "etex" "filled" "fontpart" | |
334 "fontsize" "greenpart" "infont" "linecap" "linejoin" "llcorner" | |
335 "lrcorner" "miterlimit" "mpxbreak" "pathpart" "penpart" | |
336 "prologues" "readfrom" "redpart" "setbounds" "stroked" "textpart" | |
337 "textual" "tracinglostchars" "truecorners" "ulcorner" "urcorner" | |
338 "verbatimtex" "withcolor" "within" "write") | |
339 "List of primitives only defined in MetaPost.") | |
340 | |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
38436
diff
changeset
|
341 (defconst meta-common-plain-macros-list |
18388 | 342 '( "abs" "bot" "bye" "byte" "ceiling" "clear_pen_memory" |
343 "clearit" "clearpen" "clearxy" "counterclockwise" "cutdraw" "decr" | |
344 "dir" "direction" "directionpoint" "div" "dotprod" "downto" "draw" | |
345 "drawdot" "erase" "exitunless" "fill" "filldraw" "flex" "gobble" | |
346 "hide" "incr" "interact" "interpath" "intersectionpoint" "inverse" | |
347 "label" "labels" "lft" "loggingall" "magstep" "makelabel" "max" | |
348 "min" "mod" "numtok" "penlabels" "penpos" "penstroke" "pickup" | |
349 "range" "reflectedabout" "relax" "rotatedabout" "rotatedaround" | |
350 "round" "rt" "savepen" "shipit" "softjoin" "solve" "stop" | |
351 "superellipse" "takepower" "tensepath" "thru" "top" "tracingall" | |
352 "tracingnone" "undraw" "undrawdot" "unfill" "unfilldraw" | |
353 "unitvector" "upto" "whatever") | |
354 "List of macros common to plain Metafont and MetaPost.") | |
355 | |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
38436
diff
changeset
|
356 (defconst metafont-plain-macros-list |
18388 | 357 '("beginchar" "change_width" "culldraw" "cullit" "cutoff" |
358 "define_blacker_pixels" "define_corrected_pixels" | |
359 "define_good_x_pixels" "define_good_y_pixels" | |
360 "define_horizontal_corrected_pixels" "define_pixels" | |
361 "define_whole_blacker_pixels" "define_whole_pixels" | |
362 "define_whole_vertical_blacker_pixels" | |
363 "define_whole_vertical_pixels" "endchar" "fix_units" | |
364 "font_coding_scheme" "font_extra_space" "font_identifier" | |
365 "font_normal_shrink" "font_normal_space" "font_normal_stretch" | |
366 "font_quad" "font_size" "font_slant" "font_x_height" "gfcorners" | |
367 "good.bot" "good.lft" "good.rt" "good.top" "good.x" "good.y" | |
368 "grayfont" "hround" "imagerules" "italcorr" "labelfont" | |
369 "lowres_fix" "makebox" "makegrid" "maketicks" "mode_lowres" | |
370 "mode_proof" "mode_setup" "mode_smoke" "nodisplays" "notransforms" | |
371 "openit" "penrazor" "pensquare" "proofoffset" "proofrule" | |
372 "proofrulethickness" "screenchars" "screenrule" "screenstrokes" | |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
38436
diff
changeset
|
373 "showit" "slantfont" "smode" "titlefont" "vround") |
18388 | 374 "List of macros only defined in plain Metafont.") |
375 | |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
38436
diff
changeset
|
376 (defconst metapost-plain-macros-list |
18388 | 377 '("arrowhead" "bbox" "beginfig" "buildcycle" "center" "cutafter" |
378 "cutbefore" "dashpattern" "dotlabel" "dotlabels" "drawarrow" | |
379 "drawdblarrow" "drawoptions" "endfig" "image" "label" "off" "on" | |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
38436
diff
changeset
|
380 "thelabel") |
18388 | 381 "List of macros only defined in plain MetaPost.") |
382 | |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
38436
diff
changeset
|
383 (defconst metapost-graph-macros-list |
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
38436
diff
changeset
|
384 '("augment" "auto.x" "auto.y" "autogrid" "begingraph" "endgraph" |
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
38436
diff
changeset
|
385 "format" "frame" "gdata" "gdotlabel" "gdraw" "gdrawarrow" |
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
38436
diff
changeset
|
386 "gdrawdblarrow" "gfill" "glabel" "grid" "itick" "otick" "plot" |
18388 | 387 "setcoords" "setrange") |
388 "List of macros only defined in MetaPost \"graph\" package.") | |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
38436
diff
changeset
|
389 |
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
38436
diff
changeset
|
390 (defconst metapost-boxes-macros-list |
18388 | 391 '("boxit" "boxjoin" "bpath" "circleit" "drawboxed" "drawboxes" |
392 "drawunboxed" "fixpos" "fixsize" "pic" "rboxit") | |
393 "List of macros only defined in MetaPost \"boxes\" package.") | |
394 | |
395 | |
396 (defvar metafont-symbol-list | |
397 (append meta-common-primitives-list | |
398 metafont-primitives-list | |
399 meta-common-plain-macros-list | |
400 metafont-plain-macros-list) | |
401 "List of known symbols to complete in Metafont mode.") | |
402 | |
403 (defvar metapost-symbol-list | |
404 (append meta-common-primitives-list | |
405 metapost-primitives-list | |
406 meta-common-plain-macros-list | |
407 metapost-plain-macros-list | |
408 metapost-graph-macros-list | |
409 metapost-boxes-macros-list) | |
410 "List of known symbols to complete in MetaPost mode.") | |
411 | |
412 | |
413 (defvar meta-symbol-list nil | |
414 "List of known symbols to complete in Metafont or MetaPost mode.") | |
415 | |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
38436
diff
changeset
|
416 (defvar meta-symbol-changed nil |
18388 | 417 "Flag indicating whether `meta-symbol-list' has been initialized.") |
418 | |
419 (defvar meta-complete-list nil | |
420 ; (list (list "\\<\\(\\sw+\\)" 1 'meta-symbol-list) | |
421 ; (list "" 'ispell-complete-word)) | |
422 "List of ways to perform completion in Metafont or MetaPost mode. | |
423 | |
424 Each entry is a list with the following elements: | |
425 1. Regexp matching the preceding text. | |
426 2. A number indicating the subgroup in the regexp containing the text. | |
427 3. A function returning an alist of possible completions. | |
428 4. Text to append after a succesful completion (if any). | |
429 | |
430 Or alternatively: | |
431 1. Regexp matching the preceding text. | |
432 2. Function to do the actual completion.") | |
433 | |
434 | |
435 (defun meta-add-symbols (&rest entries) | |
436 "Add entries to list of known symbols in Metafont or MetaPost mode." | |
437 (if meta-symbol-changed | |
438 (setq meta-symbol-list (cons entries meta-symbol-list)) | |
439 (setq meta-symbol-changed t) | |
440 (setq meta-symbol-list (cons entries meta-symbol-list)))) | |
441 | |
442 (defun meta-symbol-list () | |
443 "Return value of list of known symbols in Metafont or MetaPost mode. | |
444 If the list was changed, sort the list and remove duplicates first." | |
445 (if (not meta-symbol-changed) | |
446 () | |
447 (setq meta-symbol-changed nil) | |
448 (message "Preparing completion list...") | |
449 ;; sort list of symbols | |
450 (setq meta-symbol-list | |
451 (sort (mapcar 'meta-listify (apply 'append meta-symbol-list)) | |
452 'meta-car-string-lessp)) | |
453 ;; remove duplicates | |
454 (let ((entry meta-symbol-list)) | |
455 (while (and entry (cdr entry)) | |
456 (let ((this (car entry)) | |
457 (next (car (cdr entry)))) | |
458 (if (not (string-equal (car this) (car next))) | |
459 (setq entry (cdr entry)) | |
460 (if (> (length next) (length this)) | |
461 (setcdr this (cdr next))) | |
462 (setcdr entry (cdr (cdr entry))))))) | |
463 (message "Preparing completion list... done")) | |
464 meta-symbol-list) | |
465 | |
466 (defun meta-listify (a) | |
467 ;; utility function used in `meta-add-symbols' | |
468 (if (listp a) a (list a))) | |
469 | |
470 (defun meta-car-string-lessp (a b) | |
471 ;; utility function used in `meta-add-symbols' | |
472 (string-lessp (car a) (car b))) | |
473 | |
474 | |
475 (defun meta-complete-symbol () | |
476 "Perform completion on Metafont or MetaPost symbol preceding point." | |
477 (interactive "*") | |
478 (let ((list meta-complete-list) | |
479 entry) | |
480 (while list | |
481 (setq entry (car list) | |
482 list (cdr list)) | |
483 (if (meta-looking-at-backward (car entry) 200) | |
484 (setq list nil))) | |
485 (if (numberp (nth 1 entry)) | |
486 (let* ((sub (nth 1 entry)) | |
487 (close (nth 3 entry)) | |
488 (begin (match-beginning sub)) | |
489 (end (match-end sub)) | |
490 (pattern (meta-match-buffer 0)) | |
491 (symbol (buffer-substring begin end)) | |
492 (list (funcall (nth 2 entry))) | |
493 (completion (try-completion symbol list))) | |
494 (cond ((eq completion t) | |
495 (and close | |
496 (not (looking-at (regexp-quote close))) | |
497 (insert close))) | |
498 ((null completion) | |
499 (error "Can't find completion for \"%s\"" pattern)) | |
500 ((not (string-equal symbol completion)) | |
501 (delete-region begin end) | |
502 (insert completion) | |
503 (and close | |
504 (eq (try-completion completion list) t) | |
505 (not (looking-at (regexp-quote close))) | |
506 (insert close))) | |
507 (t | |
508 (message "Making completion list...") | |
509 (let ((list (all-completions symbol list nil))) | |
510 (with-output-to-temp-buffer "*Completions*" | |
66114
13abee3a9bc6
* message.el (message-expand-group): Pass the common
Masatake YAMATO <jet@gyve.org>
parents:
64699
diff
changeset
|
511 (display-completion-list list symbol))) |
18388 | 512 (message "Making completion list... done")))) |
513 (funcall (nth 1 entry))))) | |
514 | |
515 | |
516 (defun meta-looking-at-backward (regexp &optional limit) | |
517 ;; utility function used in `meta-complete-symbol' | |
518 (let ((pos (point))) | |
519 (save-excursion | |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
38436
diff
changeset
|
520 (and (re-search-backward |
18388 | 521 regexp (if limit (max (point-min) (- (point) limit))) t) |
522 (eq (match-end 0) pos))))) | |
523 | |
524 (defun meta-match-buffer (n) | |
525 ;; utility function used in `meta-complete-symbol' | |
526 (if (match-beginning n) | |
527 (let ((str (buffer-substring (match-beginning n) (match-end n)))) | |
528 (set-text-properties 0 (length str) nil str) | |
529 (copy-sequence str)) | |
530 "")) | |
531 | |
532 | |
533 | |
534 ;;; Indentation. | |
535 | |
20781 | 536 (defcustom meta-indent-level 2 |
537 "*Indentation of begin-end blocks in Metafont or MetaPost mode." | |
538 :type 'integer | |
539 :group 'meta-font) | |
18388 | 540 |
541 | |
20781 | 542 (defcustom meta-left-comment-regexp "%%+" |
543 "*Regexp matching comments that should be placed on the left margin." | |
544 :type 'regexp | |
545 :group 'meta-font) | |
18388 | 546 |
20781 | 547 (defcustom meta-right-comment-regexp nil |
548 "*Regexp matching comments that should be placed to the right margin." | |
549 :type '(choice regexp | |
550 (const :tag "None" nil)) | |
551 :group 'meta-font) | |
18388 | 552 |
20781 | 553 (defcustom meta-ignore-comment-regexp "%[^%]" |
554 "*Regexp matching comments that whose indentation should not be touched." | |
555 :type 'regexp | |
556 :group 'meta-font) | |
18388 | 557 |
558 | |
20781 | 559 (defcustom meta-begin-environment-regexp |
18388 | 560 (concat "\\(begin\\(char\\|fig\\|gr\\(aph\\|oup\\)\\|logochar\\)\\|" |
561 "def\\|for\\(\\|ever\\|suffixes\\)\\|if\\|mode_def\\|" | |
562 "primarydef\\|secondarydef\\|tertiarydef\\|vardef\\)") | |
20781 | 563 "*Regexp matching the beginning of environments to be indented." |
564 :type 'regexp | |
565 :group 'meta-font) | |
18388 | 566 |
20781 | 567 (defcustom meta-end-environment-regexp |
18388 | 568 (concat "\\(end\\(char\\|def\\|f\\(ig\\|or\\)\\|gr\\(aph\\|oup\\)\\)" |
569 "\\|fi\\)") | |
20781 | 570 "*Regexp matching the end of environments to be indented." |
571 :type 'regexp | |
572 :group 'meta-font) | |
18388 | 573 |
20781 | 574 (defcustom meta-within-environment-regexp |
18388 | 575 ; (concat "\\(e\\(lse\\(\\|if\\)\\|xit\\(if\\|unless\\)\\)\\)") |
576 (concat "\\(else\\(\\|if\\)\\)") | |
20781 | 577 "*Regexp matching keywords within environments not to be indented." |
578 :type 'regexp | |
579 :group 'meta-font) | |
18388 | 580 |
581 | |
582 (defun meta-comment-indent () | |
583 "Return the indentation for a comment in Metafont or MetaPost mode." | |
584 (if (and meta-left-comment-regexp | |
585 (looking-at meta-left-comment-regexp)) | |
586 (current-column) | |
84451
3258c63732d1
(meta-font-lock-keywords)
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
82450
diff
changeset
|
587 (skip-chars-backward "\t\f ") |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
38436
diff
changeset
|
588 (max (if (bolp) 0 (1+ (current-column))) |
18388 | 589 comment-column))) |
590 | |
591 (defun meta-indent-line () | |
592 "Indent the line containing point as Metafont or MetaPost source." | |
593 (interactive) | |
594 (let ((indent (meta-indent-calculate))) | |
595 (save-excursion | |
596 (if (/= (current-indentation) indent) | |
597 (let ((beg (progn (beginning-of-line) (point))) | |
598 (end (progn (back-to-indentation) (point)))) | |
599 (delete-region beg end) | |
600 (indent-to indent)))) | |
601 (if (< (current-column) indent) | |
602 (back-to-indentation)))) | |
603 | |
604 (defun meta-indent-calculate () | |
605 "Return the indentation of current line of Metafont or MetaPost source." | |
82450
be32023b5c7b
(meta-indent-calculate-last): Remove.
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
78234
diff
changeset
|
606 ;; Indentation within strings is not considered as Meta* don't allow multi |
be32023b5c7b
(meta-indent-calculate-last): Remove.
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
78234
diff
changeset
|
607 ;; line strings. |
18388 | 608 (save-excursion |
609 (back-to-indentation) | |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
38436
diff
changeset
|
610 (cond |
82450
be32023b5c7b
(meta-indent-calculate-last): Remove.
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
78234
diff
changeset
|
611 ;; Comments to the left margin. |
18388 | 612 ((and meta-left-comment-regexp |
613 (looking-at meta-left-comment-regexp)) | |
614 0) | |
82450
be32023b5c7b
(meta-indent-calculate-last): Remove.
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
78234
diff
changeset
|
615 ;; Comments to the right margin. |
18388 | 616 ((and meta-right-comment-regexp |
617 (looking-at meta-right-comment-regexp)) | |
618 comment-column) | |
619 ;; Comments best left alone. | |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
38436
diff
changeset
|
620 ((and meta-ignore-comment-regexp |
18388 | 621 (looking-at meta-ignore-comment-regexp)) |
622 (current-indentation)) | |
82450
be32023b5c7b
(meta-indent-calculate-last): Remove.
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
78234
diff
changeset
|
623 ;; Beginning of buffer. |
be32023b5c7b
(meta-indent-calculate-last): Remove.
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
78234
diff
changeset
|
624 ((eq (point-at-bol) (point-min)) |
be32023b5c7b
(meta-indent-calculate-last): Remove.
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
78234
diff
changeset
|
625 0) |
18388 | 626 ;; Backindent at end of environments. |
82450
be32023b5c7b
(meta-indent-calculate-last): Remove.
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
78234
diff
changeset
|
627 ((meta-indent-looking-at-code |
18388 | 628 (concat "\\<" meta-end-environment-regexp "\\>")) |
82450
be32023b5c7b
(meta-indent-calculate-last): Remove.
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
78234
diff
changeset
|
629 (- (meta-indent-current-indentation) meta-indent-level)) |
18388 | 630 ;; Backindent at keywords within environments. |
82450
be32023b5c7b
(meta-indent-calculate-last): Remove.
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
78234
diff
changeset
|
631 ((meta-indent-looking-at-code |
18388 | 632 (concat "\\<" meta-within-environment-regexp "\\>")) |
82450
be32023b5c7b
(meta-indent-calculate-last): Remove.
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
78234
diff
changeset
|
633 (- (meta-indent-current-indentation) meta-indent-level)) |
be32023b5c7b
(meta-indent-calculate-last): Remove.
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
78234
diff
changeset
|
634 (t (meta-indent-current-indentation))))) |
be32023b5c7b
(meta-indent-calculate-last): Remove.
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
78234
diff
changeset
|
635 |
be32023b5c7b
(meta-indent-calculate-last): Remove.
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
78234
diff
changeset
|
636 (defun meta-indent-in-string-p () |
be32023b5c7b
(meta-indent-calculate-last): Remove.
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
78234
diff
changeset
|
637 "Tell if the point is in a string." |
be32023b5c7b
(meta-indent-calculate-last): Remove.
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
78234
diff
changeset
|
638 (or (nth 3 (syntax-ppss)) |
be32023b5c7b
(meta-indent-calculate-last): Remove.
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
78234
diff
changeset
|
639 (eq (get-text-property (point) 'face) font-lock-string-face))) |
18388 | 640 |
82450
be32023b5c7b
(meta-indent-calculate-last): Remove.
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
78234
diff
changeset
|
641 (defun meta-indent-looking-at-code (regexp) |
be32023b5c7b
(meta-indent-calculate-last): Remove.
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
78234
diff
changeset
|
642 "Same as `looking-at' but checks that the point is not in a string." |
be32023b5c7b
(meta-indent-calculate-last): Remove.
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
78234
diff
changeset
|
643 (unless (meta-indent-in-string-p) |
be32023b5c7b
(meta-indent-calculate-last): Remove.
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
78234
diff
changeset
|
644 (looking-at regexp))) |
be32023b5c7b
(meta-indent-calculate-last): Remove.
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
78234
diff
changeset
|
645 |
be32023b5c7b
(meta-indent-calculate-last): Remove.
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
78234
diff
changeset
|
646 (defun meta-indent-previous-line () |
be32023b5c7b
(meta-indent-calculate-last): Remove.
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
78234
diff
changeset
|
647 "Go to the previous line of code, skipping comments." |
84451
3258c63732d1
(meta-font-lock-keywords)
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
82450
diff
changeset
|
648 (skip-chars-backward "\n\t\f ") |
82450
be32023b5c7b
(meta-indent-calculate-last): Remove.
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
78234
diff
changeset
|
649 (move-to-column (current-indentation)) |
be32023b5c7b
(meta-indent-calculate-last): Remove.
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
78234
diff
changeset
|
650 ;; Ignore comments. |
be32023b5c7b
(meta-indent-calculate-last): Remove.
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
78234
diff
changeset
|
651 (while (and (looking-at comment-start) (not (bobp))) |
84451
3258c63732d1
(meta-font-lock-keywords)
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
82450
diff
changeset
|
652 (skip-chars-backward "\n\t\f ") |
84453
7fda06536470
(meta-indent-unfinished-line): Do not say that a `%' in a string is
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
84451
diff
changeset
|
653 (when (not (bobp)) |
7fda06536470
(meta-indent-unfinished-line): Do not say that a `%' in a string is
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
84451
diff
changeset
|
654 (move-to-column (current-indentation))))) |
18388 | 655 |
82450
be32023b5c7b
(meta-indent-calculate-last): Remove.
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
78234
diff
changeset
|
656 (defun meta-indent-unfinished-line () |
be32023b5c7b
(meta-indent-calculate-last): Remove.
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
78234
diff
changeset
|
657 "Tell if the current line of code ends with an unfinished expression." |
be32023b5c7b
(meta-indent-calculate-last): Remove.
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
78234
diff
changeset
|
658 (save-excursion |
be32023b5c7b
(meta-indent-calculate-last): Remove.
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
78234
diff
changeset
|
659 (end-of-line) |
be32023b5c7b
(meta-indent-calculate-last): Remove.
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
78234
diff
changeset
|
660 ;; Skip backward the comments. |
84453
7fda06536470
(meta-indent-unfinished-line): Do not say that a `%' in a string is
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
84451
diff
changeset
|
661 (let ((point-not-in-string (point))) |
7fda06536470
(meta-indent-unfinished-line): Do not say that a `%' in a string is
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
84451
diff
changeset
|
662 (while (search-backward comment-start (point-at-bol) t) |
7fda06536470
(meta-indent-unfinished-line): Do not say that a `%' in a string is
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
84451
diff
changeset
|
663 (unless (meta-indent-in-string-p) |
7fda06536470
(meta-indent-unfinished-line): Do not say that a `%' in a string is
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
84451
diff
changeset
|
664 (setq point-not-in-string (point)))) |
7fda06536470
(meta-indent-unfinished-line): Do not say that a `%' in a string is
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
84451
diff
changeset
|
665 (goto-char point-not-in-string)) |
82450
be32023b5c7b
(meta-indent-calculate-last): Remove.
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
78234
diff
changeset
|
666 ;; Search for the end of the previous expression. |
be32023b5c7b
(meta-indent-calculate-last): Remove.
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
78234
diff
changeset
|
667 (if (search-backward ";" (point-at-bol) t) |
be32023b5c7b
(meta-indent-calculate-last): Remove.
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
78234
diff
changeset
|
668 (progn (while (and (meta-indent-in-string-p) |
be32023b5c7b
(meta-indent-calculate-last): Remove.
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
78234
diff
changeset
|
669 (search-backward ";" (point-at-bol) t))) |
be32023b5c7b
(meta-indent-calculate-last): Remove.
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
78234
diff
changeset
|
670 (if (= (char-after) ?\;) |
be32023b5c7b
(meta-indent-calculate-last): Remove.
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
78234
diff
changeset
|
671 (forward-char) |
be32023b5c7b
(meta-indent-calculate-last): Remove.
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
78234
diff
changeset
|
672 (beginning-of-line))) |
be32023b5c7b
(meta-indent-calculate-last): Remove.
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
78234
diff
changeset
|
673 (beginning-of-line)) |
be32023b5c7b
(meta-indent-calculate-last): Remove.
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
78234
diff
changeset
|
674 ;; See if the last statement of the line is environment-related, |
be32023b5c7b
(meta-indent-calculate-last): Remove.
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
78234
diff
changeset
|
675 ;; or exists at all. |
be32023b5c7b
(meta-indent-calculate-last): Remove.
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
78234
diff
changeset
|
676 (if (meta-indent-looking-at-code |
84451
3258c63732d1
(meta-font-lock-keywords)
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
82450
diff
changeset
|
677 (concat "[ \t\f]*\\($\\|" (regexp-quote comment-start) |
82450
be32023b5c7b
(meta-indent-calculate-last): Remove.
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
78234
diff
changeset
|
678 "\\|\\<" meta-end-environment-regexp "\\>" |
be32023b5c7b
(meta-indent-calculate-last): Remove.
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
78234
diff
changeset
|
679 "\\|\\<" meta-begin-environment-regexp "\\>" |
be32023b5c7b
(meta-indent-calculate-last): Remove.
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
78234
diff
changeset
|
680 "\\|\\<" meta-within-environment-regexp "\\>\\)")) |
be32023b5c7b
(meta-indent-calculate-last): Remove.
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
78234
diff
changeset
|
681 nil |
be32023b5c7b
(meta-indent-calculate-last): Remove.
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
78234
diff
changeset
|
682 t))) |
be32023b5c7b
(meta-indent-calculate-last): Remove.
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
78234
diff
changeset
|
683 |
be32023b5c7b
(meta-indent-calculate-last): Remove.
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
78234
diff
changeset
|
684 (defun meta-indent-current-indentation () |
be32023b5c7b
(meta-indent-calculate-last): Remove.
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
78234
diff
changeset
|
685 "Return the indentation wanted for the current line of code." |
be32023b5c7b
(meta-indent-calculate-last): Remove.
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
78234
diff
changeset
|
686 (+ (meta-indent-current-nesting) |
be32023b5c7b
(meta-indent-calculate-last): Remove.
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
78234
diff
changeset
|
687 (if (save-excursion |
be32023b5c7b
(meta-indent-calculate-last): Remove.
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
78234
diff
changeset
|
688 (back-to-indentation) |
be32023b5c7b
(meta-indent-calculate-last): Remove.
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
78234
diff
changeset
|
689 (and (not (looking-at (concat "\\<" meta-end-environment-regexp "\\>" |
be32023b5c7b
(meta-indent-calculate-last): Remove.
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
78234
diff
changeset
|
690 "\\|\\<" meta-within-environment-regexp "\\>"))) |
be32023b5c7b
(meta-indent-calculate-last): Remove.
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
78234
diff
changeset
|
691 (progn (meta-indent-previous-line) |
be32023b5c7b
(meta-indent-calculate-last): Remove.
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
78234
diff
changeset
|
692 (meta-indent-unfinished-line)))) |
be32023b5c7b
(meta-indent-calculate-last): Remove.
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
78234
diff
changeset
|
693 meta-indent-level |
be32023b5c7b
(meta-indent-calculate-last): Remove.
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
78234
diff
changeset
|
694 0))) |
be32023b5c7b
(meta-indent-calculate-last): Remove.
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
78234
diff
changeset
|
695 |
be32023b5c7b
(meta-indent-calculate-last): Remove.
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
78234
diff
changeset
|
696 (defun meta-indent-current-nesting () |
be32023b5c7b
(meta-indent-calculate-last): Remove.
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
78234
diff
changeset
|
697 "Return the indentation according to the nearest environment keyword." |
be32023b5c7b
(meta-indent-calculate-last): Remove.
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
78234
diff
changeset
|
698 (save-excursion |
be32023b5c7b
(meta-indent-calculate-last): Remove.
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
78234
diff
changeset
|
699 (save-restriction |
be32023b5c7b
(meta-indent-calculate-last): Remove.
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
78234
diff
changeset
|
700 (widen) |
be32023b5c7b
(meta-indent-calculate-last): Remove.
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
78234
diff
changeset
|
701 (back-to-indentation) |
be32023b5c7b
(meta-indent-calculate-last): Remove.
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
78234
diff
changeset
|
702 (let ((to-add 0)) |
be32023b5c7b
(meta-indent-calculate-last): Remove.
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
78234
diff
changeset
|
703 ;; If we found some environment marker backward... |
be32023b5c7b
(meta-indent-calculate-last): Remove.
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
78234
diff
changeset
|
704 (if (catch 'found |
be32023b5c7b
(meta-indent-calculate-last): Remove.
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
78234
diff
changeset
|
705 (while (re-search-backward |
be32023b5c7b
(meta-indent-calculate-last): Remove.
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
78234
diff
changeset
|
706 (concat "(\\|)\\|\\<" meta-end-environment-regexp "\\>" |
be32023b5c7b
(meta-indent-calculate-last): Remove.
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
78234
diff
changeset
|
707 "\\|\\<" meta-begin-environment-regexp "\\>" |
be32023b5c7b
(meta-indent-calculate-last): Remove.
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
78234
diff
changeset
|
708 "\\|\\<" meta-within-environment-regexp "\\>") |
be32023b5c7b
(meta-indent-calculate-last): Remove.
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
78234
diff
changeset
|
709 nil t) |
be32023b5c7b
(meta-indent-calculate-last): Remove.
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
78234
diff
changeset
|
710 ;; If we aren't in a string or in a comment, we've found something. |
be32023b5c7b
(meta-indent-calculate-last): Remove.
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
78234
diff
changeset
|
711 (unless (or (meta-indent-in-string-p) |
be32023b5c7b
(meta-indent-calculate-last): Remove.
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
78234
diff
changeset
|
712 (nth 4 (syntax-ppss))) |
be32023b5c7b
(meta-indent-calculate-last): Remove.
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
78234
diff
changeset
|
713 (cond ((= (char-after) ?\() |
be32023b5c7b
(meta-indent-calculate-last): Remove.
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
78234
diff
changeset
|
714 (setq to-add (+ to-add meta-indent-level))) |
be32023b5c7b
(meta-indent-calculate-last): Remove.
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
78234
diff
changeset
|
715 ((= (char-after) ?\)) |
be32023b5c7b
(meta-indent-calculate-last): Remove.
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
78234
diff
changeset
|
716 (setq to-add (- to-add meta-indent-level))) |
be32023b5c7b
(meta-indent-calculate-last): Remove.
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
78234
diff
changeset
|
717 (t (throw 'found t)))))) |
be32023b5c7b
(meta-indent-calculate-last): Remove.
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
78234
diff
changeset
|
718 (progn |
be32023b5c7b
(meta-indent-calculate-last): Remove.
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
78234
diff
changeset
|
719 ;; ... then use it to compute the current indentation. |
be32023b5c7b
(meta-indent-calculate-last): Remove.
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
78234
diff
changeset
|
720 (back-to-indentation) |
be32023b5c7b
(meta-indent-calculate-last): Remove.
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
78234
diff
changeset
|
721 (+ to-add (current-indentation) (meta-indent-level-count) |
be32023b5c7b
(meta-indent-calculate-last): Remove.
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
78234
diff
changeset
|
722 ;; Compensate for backindent of end and within keywords. |
be32023b5c7b
(meta-indent-calculate-last): Remove.
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
78234
diff
changeset
|
723 (if (meta-indent-looking-at-code |
be32023b5c7b
(meta-indent-calculate-last): Remove.
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
78234
diff
changeset
|
724 (concat "\\<" meta-end-environment-regexp "\\>\\|" |
be32023b5c7b
(meta-indent-calculate-last): Remove.
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
78234
diff
changeset
|
725 "\\<" meta-within-environment-regexp "\\>")) |
be32023b5c7b
(meta-indent-calculate-last): Remove.
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
78234
diff
changeset
|
726 meta-indent-level |
be32023b5c7b
(meta-indent-calculate-last): Remove.
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
78234
diff
changeset
|
727 ;; Compensate for unfinished line. |
be32023b5c7b
(meta-indent-calculate-last): Remove.
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
78234
diff
changeset
|
728 (if (save-excursion |
be32023b5c7b
(meta-indent-calculate-last): Remove.
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
78234
diff
changeset
|
729 (meta-indent-previous-line) |
be32023b5c7b
(meta-indent-calculate-last): Remove.
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
78234
diff
changeset
|
730 (meta-indent-unfinished-line)) |
be32023b5c7b
(meta-indent-calculate-last): Remove.
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
78234
diff
changeset
|
731 (- meta-indent-level) |
be32023b5c7b
(meta-indent-calculate-last): Remove.
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
78234
diff
changeset
|
732 0)))) |
be32023b5c7b
(meta-indent-calculate-last): Remove.
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
78234
diff
changeset
|
733 0))))) |
18388 | 734 |
735 (defun meta-indent-level-count () | |
736 "Count indentation change for begin-end commands in the current line." | |
737 (save-excursion | |
738 (save-restriction | |
739 (let ((count 0)) | |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
38436
diff
changeset
|
740 (narrow-to-region |
18388 | 741 (point) (save-excursion |
742 (re-search-forward "[^\\\\\"]%\\|\n\\|\\'" nil t) | |
743 (backward-char) (point))) | |
744 (while (re-search-forward "\\<\\sw+\\>\\|(\\|)" nil t) | |
745 (save-excursion | |
746 (goto-char (match-beginning 0)) | |
747 (cond | |
748 ;; Count number of begin-end keywords within line. | |
82450
be32023b5c7b
(meta-indent-calculate-last): Remove.
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
78234
diff
changeset
|
749 ((meta-indent-looking-at-code |
18388 | 750 (concat "\\<" meta-begin-environment-regexp "\\>")) |
751 (setq count (+ count meta-indent-level))) | |
82450
be32023b5c7b
(meta-indent-calculate-last): Remove.
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
78234
diff
changeset
|
752 ((meta-indent-looking-at-code |
18388 | 753 (concat "\\<" meta-end-environment-regexp "\\>")) |
82450
be32023b5c7b
(meta-indent-calculate-last): Remove.
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
78234
diff
changeset
|
754 (setq count (- count meta-indent-level)))))) |
18388 | 755 count)))) |
756 | |
757 | |
758 | |
759 ;;; Editing commands. | |
760 | |
20781 | 761 (defcustom meta-begin-defun-regexp |
18388 | 762 (concat "\\(begin\\(char\\|fig\\|logochar\\)\\|def\\|mode_def\\|" |
763 "primarydef\\|secondarydef\\|tertiarydef\\|vardef\\)") | |
20781 | 764 "*Regexp matching beginning of defuns in Metafont or MetaPost mode." |
765 :type 'regexp | |
766 :group 'meta-font) | |
18388 | 767 |
20781 | 768 (defcustom meta-end-defun-regexp |
18388 | 769 (concat "\\(end\\(char\\|def\\|fig\\)\\)") |
20781 | 770 "*Regexp matching the end of defuns in Metafont or MetaPost mode." |
771 :type 'regexp | |
772 :group 'meta-font) | |
18388 | 773 |
774 | |
775 (defun meta-beginning-of-defun (&optional arg) | |
776 "Move backward to beginnning of a defun in Metafont or MetaPost code. | |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
38436
diff
changeset
|
777 With numeric argument, do it that many times. |
18388 | 778 Negative arg -N means move forward to Nth following beginning of defun. |
779 Returns t unless search stops due to beginning or end of buffer." | |
780 (interactive "p") | |
781 (if (or (null arg) (= 0 arg)) (setq arg 1)) | |
782 (and arg (< arg 0) (not (eobp)) (forward-char 1)) | |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
38436
diff
changeset
|
783 (and (re-search-backward |
18388 | 784 (concat "\\<" meta-begin-defun-regexp "\\>") nil t arg) |
785 (progn (goto-char (match-beginning 0)) | |
786 (skip-chars-backward "%") | |
84451
3258c63732d1
(meta-font-lock-keywords)
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
82450
diff
changeset
|
787 (skip-chars-backward " \t\f") t))) |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
38436
diff
changeset
|
788 |
18388 | 789 (defun meta-end-of-defun (&optional arg) |
790 "Move forward to end of a defun in Metafont or MetaPost code. | |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
38436
diff
changeset
|
791 With numeric argument, do it that many times. |
18388 | 792 Negative argument -N means move back to Nth preceding end of defun. |
793 Returns t unless search stops due to beginning or end of buffer." | |
794 (interactive "p") | |
795 (if (or (null arg) (= 0 arg)) (setq arg 1)) | |
796 (and (< arg 0) (not (bobp)) (forward-line -1)) | |
797 (and (re-search-forward | |
798 (concat "\\<" meta-end-defun-regexp "\\>") nil t arg) | |
799 (progn (goto-char (match-end 0)) | |
800 (skip-chars-forward ";") | |
84451
3258c63732d1
(meta-font-lock-keywords)
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
82450
diff
changeset
|
801 (skip-chars-forward " \t\f") |
18388 | 802 (if (looking-at "\n") (forward-line 1)) t))) |
803 | |
804 | |
805 (defun meta-comment-region (beg end &optional arg) | |
806 "Comment out active region as Metafont or MetaPost source." | |
807 (interactive "r") | |
808 (comment-region beg end arg)) | |
809 | |
810 (defun meta-uncomment-region (beg end) | |
811 "Uncomment active region as Metafont or MetaPost source." | |
812 (interactive "r") | |
813 (comment-region beg end -1)) | |
814 | |
815 (defun meta-comment-defun (&optional arg) | |
816 "Comment out current environment as Metafont or MetaPost source. | |
817 With prefix argument, uncomment the environment. | |
818 The environment used is the one that contains point or follows point." | |
819 (interactive "P") | |
820 (save-excursion | |
821 (let* ((end (if (meta-end-of-defun) (point) (point-max))) | |
822 (beg (if (meta-beginning-of-defun) (point) (point-min)))) | |
823 (comment-region beg end arg)))) | |
824 | |
825 (defun meta-uncomment-defun () | |
826 "Uncomment current environment as Metafont or MetaPost source." | |
827 (interactive) | |
828 (meta-comment-defun -1)) | |
829 | |
830 | |
831 (defun meta-indent-region (beg end) | |
832 "Indent the active region as Metafont or MetaPost source." | |
833 (interactive "r") | |
834 (indent-region beg end nil)) | |
835 | |
836 (defun meta-indent-buffer () | |
837 "Indent the whole buffer contents as Metafont or MetaPost source." | |
838 (interactive) | |
839 (save-excursion | |
840 (indent-region (point-min) (point-max) nil))) | |
841 | |
842 (defun meta-indent-defun () | |
843 "Indent the current environment as Metafont or MetaPost source. | |
844 The environment indented is the one that contains point or follows point." | |
845 (interactive) | |
846 (save-excursion | |
847 (let* ((end (if (meta-end-of-defun) (point) (point-max))) | |
848 (beg (if (meta-beginning-of-defun) (point) (point-min)))) | |
849 (indent-region beg end nil)))) | |
850 | |
851 | |
852 (defun meta-mark-defun () | |
853 "Put mark at end of the environment, point at the beginning. | |
854 The environment marked is the one that contains point or follows point." | |
855 (interactive) | |
856 (push-mark (point)) | |
857 (meta-end-of-defun) | |
858 (push-mark (point) nil t) | |
859 (meta-beginning-of-defun)) | |
860 | |
861 | |
862 | |
863 ;;; Syntax table, keymap and menu. | |
864 | |
865 (defvar meta-mode-abbrev-table nil | |
866 "Abbrev table used in Metafont or MetaPost mode.") | |
867 (define-abbrev-table 'meta-mode-abbrev-table ()) | |
868 | |
84654
9b686572bf3f
(meta-mode-syntax-table): Move init into decl.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84453
diff
changeset
|
869 (defvar meta-mode-syntax-table |
9b686572bf3f
(meta-mode-syntax-table): Move init into decl.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84453
diff
changeset
|
870 (let ((st (make-syntax-table))) |
9b686572bf3f
(meta-mode-syntax-table): Move init into decl.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84453
diff
changeset
|
871 ;; underscores are word constituents |
9b686572bf3f
(meta-mode-syntax-table): Move init into decl.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84453
diff
changeset
|
872 (modify-syntax-entry ?_ "w" st) |
9b686572bf3f
(meta-mode-syntax-table): Move init into decl.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84453
diff
changeset
|
873 ;; miscellaneous non-word symbols |
9b686572bf3f
(meta-mode-syntax-table): Move init into decl.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84453
diff
changeset
|
874 (modify-syntax-entry ?# "_" st) |
9b686572bf3f
(meta-mode-syntax-table): Move init into decl.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84453
diff
changeset
|
875 (modify-syntax-entry ?@ "_" st) |
9b686572bf3f
(meta-mode-syntax-table): Move init into decl.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84453
diff
changeset
|
876 (modify-syntax-entry ?$ "_" st) |
9b686572bf3f
(meta-mode-syntax-table): Move init into decl.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84453
diff
changeset
|
877 (modify-syntax-entry ?? "_" st) |
9b686572bf3f
(meta-mode-syntax-table): Move init into decl.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84453
diff
changeset
|
878 (modify-syntax-entry ?! "_" st) |
9b686572bf3f
(meta-mode-syntax-table): Move init into decl.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84453
diff
changeset
|
879 ;; binary operators |
9b686572bf3f
(meta-mode-syntax-table): Move init into decl.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84453
diff
changeset
|
880 (modify-syntax-entry ?& "." st) |
9b686572bf3f
(meta-mode-syntax-table): Move init into decl.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84453
diff
changeset
|
881 (modify-syntax-entry ?+ "." st) |
9b686572bf3f
(meta-mode-syntax-table): Move init into decl.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84453
diff
changeset
|
882 (modify-syntax-entry ?- "." st) |
9b686572bf3f
(meta-mode-syntax-table): Move init into decl.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84453
diff
changeset
|
883 (modify-syntax-entry ?/ "." st) |
9b686572bf3f
(meta-mode-syntax-table): Move init into decl.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84453
diff
changeset
|
884 (modify-syntax-entry ?* "." st) |
9b686572bf3f
(meta-mode-syntax-table): Move init into decl.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84453
diff
changeset
|
885 (modify-syntax-entry ?. "." st) |
9b686572bf3f
(meta-mode-syntax-table): Move init into decl.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84453
diff
changeset
|
886 (modify-syntax-entry ?: "." st) |
9b686572bf3f
(meta-mode-syntax-table): Move init into decl.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84453
diff
changeset
|
887 (modify-syntax-entry ?= "." st) |
9b686572bf3f
(meta-mode-syntax-table): Move init into decl.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84453
diff
changeset
|
888 (modify-syntax-entry ?< "." st) |
9b686572bf3f
(meta-mode-syntax-table): Move init into decl.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84453
diff
changeset
|
889 (modify-syntax-entry ?> "." st) |
9b686572bf3f
(meta-mode-syntax-table): Move init into decl.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84453
diff
changeset
|
890 (modify-syntax-entry ?| "." st) |
9b686572bf3f
(meta-mode-syntax-table): Move init into decl.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84453
diff
changeset
|
891 ;; opening and closing delimiters |
9b686572bf3f
(meta-mode-syntax-table): Move init into decl.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84453
diff
changeset
|
892 (modify-syntax-entry ?\( "()" st) |
9b686572bf3f
(meta-mode-syntax-table): Move init into decl.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84453
diff
changeset
|
893 (modify-syntax-entry ?\) ")(" st) |
9b686572bf3f
(meta-mode-syntax-table): Move init into decl.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84453
diff
changeset
|
894 (modify-syntax-entry ?\[ "(]" st) |
9b686572bf3f
(meta-mode-syntax-table): Move init into decl.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84453
diff
changeset
|
895 (modify-syntax-entry ?\] ")[" st) |
9b686572bf3f
(meta-mode-syntax-table): Move init into decl.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84453
diff
changeset
|
896 (modify-syntax-entry ?\{ "(}" st) |
9b686572bf3f
(meta-mode-syntax-table): Move init into decl.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84453
diff
changeset
|
897 (modify-syntax-entry ?\} "){" st) |
9b686572bf3f
(meta-mode-syntax-table): Move init into decl.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84453
diff
changeset
|
898 ;; comment character |
9b686572bf3f
(meta-mode-syntax-table): Move init into decl.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84453
diff
changeset
|
899 (modify-syntax-entry ?% "<" st) |
9b686572bf3f
(meta-mode-syntax-table): Move init into decl.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84453
diff
changeset
|
900 (modify-syntax-entry ?\n ">" st) |
9b686572bf3f
(meta-mode-syntax-table): Move init into decl.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84453
diff
changeset
|
901 ;; escape character, needed for embedded TeX code |
9b686572bf3f
(meta-mode-syntax-table): Move init into decl.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84453
diff
changeset
|
902 (modify-syntax-entry ?\\ "\\" st) |
9b686572bf3f
(meta-mode-syntax-table): Move init into decl.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84453
diff
changeset
|
903 st) |
18388 | 904 "Syntax table used in Metafont or MetaPost mode.") |
905 | |
84654
9b686572bf3f
(meta-mode-syntax-table): Move init into decl.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84453
diff
changeset
|
906 (defvar meta-mode-map |
9b686572bf3f
(meta-mode-syntax-table): Move init into decl.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84453
diff
changeset
|
907 (let ((map (make-sparse-keymap))) |
9b686572bf3f
(meta-mode-syntax-table): Move init into decl.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84453
diff
changeset
|
908 (define-key map "\C-m" 'reindent-then-newline-and-indent) |
9b686572bf3f
(meta-mode-syntax-table): Move init into decl.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84453
diff
changeset
|
909 ;; Comment Paragraphs: |
9b686572bf3f
(meta-mode-syntax-table): Move init into decl.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84453
diff
changeset
|
910 ;; (define-key map "\M-a" 'backward-sentence) |
9b686572bf3f
(meta-mode-syntax-table): Move init into decl.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84453
diff
changeset
|
911 ;; (define-key map "\M-e" 'forward-sentence) |
9b686572bf3f
(meta-mode-syntax-table): Move init into decl.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84453
diff
changeset
|
912 ;; (define-key map "\M-h" 'mark-paragraph) |
9b686572bf3f
(meta-mode-syntax-table): Move init into decl.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84453
diff
changeset
|
913 ;; (define-key map "\M-q" 'fill-paragraph) |
9b686572bf3f
(meta-mode-syntax-table): Move init into decl.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84453
diff
changeset
|
914 ;; Navigation: |
9b686572bf3f
(meta-mode-syntax-table): Move init into decl.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84453
diff
changeset
|
915 (define-key map "\M-\C-a" 'meta-beginning-of-defun) |
9b686572bf3f
(meta-mode-syntax-table): Move init into decl.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84453
diff
changeset
|
916 (define-key map "\M-\C-e" 'meta-end-of-defun) |
9b686572bf3f
(meta-mode-syntax-table): Move init into decl.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84453
diff
changeset
|
917 (define-key map "\M-\C-h" 'meta-mark-defun) |
9b686572bf3f
(meta-mode-syntax-table): Move init into decl.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84453
diff
changeset
|
918 ;; Indentation: |
9b686572bf3f
(meta-mode-syntax-table): Move init into decl.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84453
diff
changeset
|
919 (define-key map "\M-\C-q" 'meta-indent-defun) |
9b686572bf3f
(meta-mode-syntax-table): Move init into decl.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84453
diff
changeset
|
920 (define-key map "\C-c\C-qe" 'meta-indent-defun) |
9b686572bf3f
(meta-mode-syntax-table): Move init into decl.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84453
diff
changeset
|
921 (define-key map "\C-c\C-qr" 'meta-indent-region) |
9b686572bf3f
(meta-mode-syntax-table): Move init into decl.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84453
diff
changeset
|
922 (define-key map "\C-c\C-qb" 'meta-indent-buffer) |
9b686572bf3f
(meta-mode-syntax-table): Move init into decl.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84453
diff
changeset
|
923 ;; Commenting Out: |
9b686572bf3f
(meta-mode-syntax-table): Move init into decl.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84453
diff
changeset
|
924 (define-key map "\C-c%" 'meta-comment-defun) |
9b686572bf3f
(meta-mode-syntax-table): Move init into decl.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84453
diff
changeset
|
925 ;; (define-key map "\C-uC-c%" 'meta-uncomment-defun) |
9b686572bf3f
(meta-mode-syntax-table): Move init into decl.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84453
diff
changeset
|
926 (define-key map "\C-c;" 'meta-comment-region) |
9b686572bf3f
(meta-mode-syntax-table): Move init into decl.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84453
diff
changeset
|
927 (define-key map "\C-c:" 'meta-uncomment-region) |
9b686572bf3f
(meta-mode-syntax-table): Move init into decl.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84453
diff
changeset
|
928 ;; Symbol Completion: |
9b686572bf3f
(meta-mode-syntax-table): Move init into decl.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84453
diff
changeset
|
929 (define-key map "\M-\t" 'meta-complete-symbol) |
9b686572bf3f
(meta-mode-syntax-table): Move init into decl.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84453
diff
changeset
|
930 ;; Shell Commands: |
9b686572bf3f
(meta-mode-syntax-table): Move init into decl.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84453
diff
changeset
|
931 ;; (define-key map "\C-c\C-c" 'meta-command-file) |
9b686572bf3f
(meta-mode-syntax-table): Move init into decl.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84453
diff
changeset
|
932 ;; (define-key map "\C-c\C-k" 'meta-kill-job) |
9b686572bf3f
(meta-mode-syntax-table): Move init into decl.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84453
diff
changeset
|
933 ;; (define-key map "\C-c\C-l" 'meta-recenter-output) |
9b686572bf3f
(meta-mode-syntax-table): Move init into decl.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84453
diff
changeset
|
934 map) |
18388 | 935 "Keymap used in Metafont or MetaPost mode.") |
84654
9b686572bf3f
(meta-mode-syntax-table): Move init into decl.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84453
diff
changeset
|
936 |
18388 | 937 |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
38436
diff
changeset
|
938 (easy-menu-define |
18388 | 939 meta-mode-menu meta-mode-map |
940 "Menu used in Metafont or MetaPost mode." | |
941 (list "Meta" | |
942 ["Forward Environment" meta-beginning-of-defun t] | |
943 ["Backward Environment" meta-end-of-defun t] | |
944 "--" | |
945 ["Indent Line" meta-indent-line t] | |
946 ["Indent Environment" meta-indent-defun t] | |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
38436
diff
changeset
|
947 ["Indent Region" meta-indent-region |
18388 | 948 :active (meta-mark-active)] |
949 ["Indent Buffer" meta-indent-buffer t] | |
950 "--" | |
951 ["Comment Out Environment" meta-comment-defun t] | |
952 ["Uncomment Environment" meta-uncomment-defun t] | |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
38436
diff
changeset
|
953 ["Comment Out Region" meta-comment-region |
18388 | 954 :active (meta-mark-active)] |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
38436
diff
changeset
|
955 ["Uncomment Region" meta-uncomment-region |
18388 | 956 :active (meta-mark-active)] |
957 "--" | |
958 ["Complete Symbol" meta-complete-symbol t] | |
959 ; "--" | |
960 ; ["Command on Buffer" meta-command-file t] | |
961 ; ["Kill Job" meta-kill-job t] | |
962 ; ["Recenter Output Buffer" meta-recenter-output-buffer t] | |
963 )) | |
964 | |
965 ;; Compatibility: XEmacs doesn't have the `mark-active' variable. | |
966 (defun meta-mark-active () | |
967 "Return whether the mark and region are currently active in this buffer." | |
60142
d1fdce4dfc73
(meta-mark-active): Fix condition to just
David Kastrup <dak@gnu.org>
parents:
56756
diff
changeset
|
968 (if (boundp 'mark-active) mark-active (mark))) |
18388 | 969 |
970 | |
971 | |
972 ;;; Hook variables. | |
973 | |
20781 | 974 (defcustom meta-mode-load-hook nil |
975 "*Hook evaluated when first loading Metafont or MetaPost mode." | |
976 :type 'hook | |
977 :group 'meta-font) | |
18388 | 978 |
20781 | 979 (defcustom meta-common-mode-hook nil |
980 "*Hook evaluated by both `metafont-mode' and `metapost-mode'." | |
981 :type 'hook | |
982 :group 'meta-font) | |
18388 | 983 |
20781 | 984 (defcustom metafont-mode-hook nil |
985 "*Hook evaluated by `metafont-mode' after `meta-common-mode-hook'." | |
986 :type 'hook | |
987 :group 'meta-font) | |
988 (defcustom metapost-mode-hook nil | |
989 "*Hook evaluated by `metapost-mode' after `meta-common-mode-hook'." | |
990 :type 'hook | |
991 :group 'meta-font) | |
18388 | 992 |
993 | |
994 | |
995 ;;; Initialization. | |
996 | |
997 (defun meta-common-initialization () | |
998 "Common initialization for Metafont or MetaPost mode." | |
999 (kill-all-local-variables) | |
1000 | |
1001 (make-local-variable 'paragraph-start) | |
1002 (make-local-variable 'paragraph-separate) | |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
38436
diff
changeset
|
1003 (setq paragraph-start |
18388 | 1004 (concat page-delimiter "\\|$")) |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
38436
diff
changeset
|
1005 (setq paragraph-separate |
18388 | 1006 (concat page-delimiter "\\|$")) |
1007 | |
1008 (make-local-variable 'paragraph-ignore-fill-prefix) | |
1009 (setq paragraph-ignore-fill-prefix t) | |
1010 | |
1011 (make-local-variable 'comment-start-skip) | |
1012 (make-local-variable 'comment-start) | |
1013 (make-local-variable 'comment-end) | |
1014 (make-local-variable 'comment-multi-line) | |
84451
3258c63732d1
(meta-font-lock-keywords)
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
82450
diff
changeset
|
1015 (setq comment-start-skip "%+[ \t\f]*") |
18388 | 1016 (setq comment-start "%") |
1017 (setq comment-end "") | |
1018 (setq comment-multi-line nil) | |
1019 | |
84451
3258c63732d1
(meta-font-lock-keywords)
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
82450
diff
changeset
|
1020 ;; We use `back-to-indentation' but \f is no indentation sign. |
3258c63732d1
(meta-font-lock-keywords)
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
82450
diff
changeset
|
1021 (modify-syntax-entry ?\f "_ ") |
3258c63732d1
(meta-font-lock-keywords)
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
82450
diff
changeset
|
1022 |
18388 | 1023 (make-local-variable 'parse-sexp-ignore-comments) |
1024 (setq parse-sexp-ignore-comments t) | |
1025 | |
1026 (make-local-variable 'comment-indent-function) | |
1027 (setq comment-indent-function 'meta-comment-indent) | |
1028 (make-local-variable 'indent-line-function) | |
1029 (setq indent-line-function 'meta-indent-line) | |
1030 ;; No need to define a mode-specific 'indent-region-function. | |
1031 ;; Simply use the generic 'indent-region and 'comment-region. | |
1032 | |
1033 ;; Set defaults for font-lock mode. | |
1034 (make-local-variable 'font-lock-defaults) | |
1035 (setq font-lock-defaults | |
1036 '(meta-font-lock-keywords | |
1037 nil nil ((?_ . "w")) nil | |
1038 (font-lock-comment-start-regexp . "%"))) | |
1039 | |
1040 ;; Activate syntax table, keymap and menu. | |
1041 (setq local-abbrev-table meta-mode-abbrev-table) | |
1042 (set-syntax-table meta-mode-syntax-table) | |
1043 (use-local-map meta-mode-map) | |
1044 (easy-menu-add meta-mode-menu) | |
1045 ) | |
1046 | |
1047 | |
18924
f4b6329afef0
Update copyright notice and permission notice.
Richard M. Stallman <rms@gnu.org>
parents:
18388
diff
changeset
|
1048 ;;;###autoload |
18388 | 1049 (defun metafont-mode () |
1050 "Major mode for editing Metafont sources. | |
1051 Special commands: | |
1052 \\{meta-mode-map} | |
1053 | |
1054 Turning on Metafont mode calls the value of the variables | |
1055 `meta-common-mode-hook' and `metafont-mode-hook'." | |
1056 (interactive) | |
1057 (meta-common-initialization) | |
1058 (setq mode-name "Metafont") | |
1059 (setq major-mode 'metafont-mode) | |
1060 | |
1061 ;; Set defaults for completion function. | |
1062 (make-local-variable 'meta-symbol-list) | |
1063 (make-local-variable 'meta-symbol-changed) | |
1064 (make-local-variable 'meta-complete-list) | |
1065 (setq meta-symbol-list nil) | |
1066 (setq meta-symbol-changed nil) | |
1067 (apply 'meta-add-symbols metafont-symbol-list) | |
1068 (setq meta-complete-list | |
1069 (list (list "\\<\\(\\sw+\\)" 1 'meta-symbol-list) | |
1070 (list "" 'ispell-complete-word))) | |
62772
f2892faa87d4
* progmodes/ada-mode.el (ada-mode):
Lute Kamstra <lute@gnu.org>
parents:
60142
diff
changeset
|
1071 (run-mode-hooks 'meta-common-mode-hook 'metafont-mode-hook)) |
18388 | 1072 |
18924
f4b6329afef0
Update copyright notice and permission notice.
Richard M. Stallman <rms@gnu.org>
parents:
18388
diff
changeset
|
1073 ;;;###autoload |
18388 | 1074 (defun metapost-mode () |
1075 "Major mode for editing MetaPost sources. | |
1076 Special commands: | |
1077 \\{meta-mode-map} | |
1078 | |
1079 Turning on MetaPost mode calls the value of the variable | |
1080 `meta-common-mode-hook' and `metafont-mode-hook'." | |
1081 (interactive) | |
1082 (meta-common-initialization) | |
1083 (setq mode-name "MetaPost") | |
1084 (setq major-mode 'metapost-mode) | |
1085 | |
1086 ;; Set defaults for completion function. | |
1087 (make-local-variable 'meta-symbol-list) | |
1088 (make-local-variable 'meta-symbol-changed) | |
1089 (make-local-variable 'meta-complete-list) | |
1090 (setq meta-symbol-list nil) | |
1091 (setq meta-symbol-changed nil) | |
1092 (apply 'meta-add-symbols metapost-symbol-list) | |
1093 (setq meta-complete-list | |
1094 (list (list "\\<\\(\\sw+\\)" 1 'meta-symbol-list) | |
1095 (list "" 'ispell-complete-word))) | |
62772
f2892faa87d4
* progmodes/ada-mode.el (ada-mode):
Lute Kamstra <lute@gnu.org>
parents:
60142
diff
changeset
|
1096 (run-mode-hooks 'meta-common-mode-hook 'metapost-mode-hook)) |
18388 | 1097 |
1098 | |
1099 ;;; Just in case ... | |
1100 | |
1101 (provide 'meta-mode) | |
1102 (run-hooks 'meta-mode-load-hook) | |
1103 | |
84654
9b686572bf3f
(meta-mode-syntax-table): Move init into decl.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84453
diff
changeset
|
1104 ;; arch-tag: ec2916b2-3a83-4cf7-962d-d8019370c006 |
18388 | 1105 ;;; meta-mode.el ends here |