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