Commit | Line | Data |
---|---|---|
1fffafda | 1 | ;;; generic-x.el --- A collection of generic modes |
ca1e63a5 | 2 | |
c90f2757 | 3 | ;; Copyright (C) 1997, 1998, 2001, 2002, 2003, 2004, |
409cc4a3 | 4 | ;; 2005, 2006, 2007, 2008 Free Software Foundation, Inc. |
ca1e63a5 RS |
5 | |
6 | ;; Author: Peter Breton <pbreton@cs.umb.edu> | |
7 | ;; Created: Tue Oct 08 1996 | |
8 | ;; Keywords: generic, comment, font-lock | |
9 | ||
10 | ;; This file is part of GNU Emacs. | |
11 | ||
eb3fa2cf | 12 | ;; GNU Emacs is free software: you can redistribute it and/or modify |
ca1e63a5 | 13 | ;; it under the terms of the GNU General Public License as published by |
eb3fa2cf GM |
14 | ;; the Free Software Foundation, either version 3 of the License, or |
15 | ;; (at your option) any later version. | |
ca1e63a5 RS |
16 | |
17 | ;; GNU Emacs is distributed in the hope that it will be useful, | |
18 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
19 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
20 | ;; GNU General Public License for more details. | |
21 | ||
22 | ;; You should have received a copy of the GNU General Public License | |
eb3fa2cf | 23 | ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
ca1e63a5 RS |
24 | |
25 | ;;; Commentary: | |
26 | ;; | |
76ee7bd5 | 27 | ;; This file contains a collection of generic modes. |
ffe0c7ef | 28 | ;; |
ca1e63a5 RS |
29 | ;; INSTALLATION: |
30 | ;; | |
31 | ;; Add this line to your .emacs file: | |
32 | ;; | |
33 | ;; (require 'generic-x) | |
34 | ;; | |
35 | ;; You can decide which modes to load by setting the variable | |
1fffafda LK |
36 | ;; `generic-extras-enable-list'. Its default value is platform- |
37 | ;; specific. The recommended way to set this variable is through | |
38 | ;; customize: | |
ffe0c7ef | 39 | ;; |
1fffafda LK |
40 | ;; M-x customize-option RET generic-extras-enable-list RET |
41 | ;; | |
42 | ;; This lets you select generic modes from the list of available | |
43 | ;; modes. If you manually set `generic-extras-enable-list' in your | |
44 | ;; .emacs, do it BEFORE loading generic-x with (require 'generic-x). | |
45 | ;; | |
46 | ;; You can also send in new modes; if the file types are reasonably | |
47 | ;; common, we would like to install them. | |
ca1e63a5 | 48 | ;; |
9285b8bc LK |
49 | ;; DEFAULT GENERIC MODE: |
50 | ;; | |
51 | ;; This file provides a hook which automatically puts a file into | |
52 | ;; `default-generic-mode' if the first few lines of a file in | |
53 | ;; fundamental mode start with a hash comment character. To disable | |
54 | ;; this functionality, set the variable `generic-use-find-file-hook' | |
55 | ;; to nil BEFORE loading generic-x. See the variables | |
56 | ;; `generic-lines-to-scan' and `generic-find-file-regexp' for | |
57 | ;; customization options. | |
58 | ;; | |
ca1e63a5 RS |
59 | ;; PROBLEMS WHEN USED WITH FOLDING MODE: |
60 | ;; | |
762f539b | 61 | ;; [The following relates to the obsolete selective-display technique. |
1fffafda | 62 | ;; Folding mode should use invisible text properties instead. -- Dave |
762f539b DL |
63 | ;; Love] |
64 | ;; | |
ca1e63a5 | 65 | ;; From Anders Lindgren <andersl@csd.uu.se> |
ffe0c7ef | 66 | ;; |
ca1e63a5 | 67 | ;; Problem summary: Wayne Adams has found a problem when using folding |
1fffafda | 68 | ;; mode in conjunction with font-lock for a mode defined in |
ca1e63a5 RS |
69 | ;; `generic-x.el'. |
70 | ;; | |
71 | ;; The problem, as Wayne described it, was that error messages of the | |
72 | ;; following form appeared when both font-lock and folding are used: | |
ffe0c7ef | 73 | ;; |
ca1e63a5 RS |
74 | ;; > - various msgs including "Fontifying region...(error Stack |
75 | ;; > overflow in regexp matcher)" appear | |
ffe0c7ef | 76 | ;; |
1fffafda LK |
77 | ;; I have just tracked down the cause of the problem. The regexp's in |
78 | ;; `generic-x.el' do not take into account the way that folding hides | |
79 | ;; sections of the buffer. The technique is known as | |
ca1e63a5 | 80 | ;; `selective-display' and has been available for a very long time (I |
1fffafda | 81 | ;; started using it back in the good old Emacs 18 days). Basically, a |
ca1e63a5 RS |
82 | ;; section is hidden by creating one very long line were the newline |
83 | ;; character (C-j) is replaced by a linefeed (C-m) character. | |
ffe0c7ef | 84 | ;; |
ca1e63a5 RS |
85 | ;; Many other hiding packages, besides folding, use the same technique, |
86 | ;; the problem should occur when using them as well. | |
ffe0c7ef | 87 | ;; |
1fffafda | 88 | ;; The erroneous lines in `generic-x.el' look like the following (this |
ca1e63a5 | 89 | ;; example is from the `ini' section): |
ffe0c7ef PB |
90 | ;; |
91 | ;; '(("^\\(\\[.*\\]\\)" 1 'font-lock-constant-face) | |
ca1e63a5 | 92 | ;; ("^\\(.*\\)=" 1 'font-lock-variable-name-face) |
ffe0c7ef | 93 | ;; |
ca1e63a5 RS |
94 | ;; The intention of these lines is to highlight lines of the following |
95 | ;; form: | |
ffe0c7ef | 96 | ;; |
ca1e63a5 RS |
97 | ;; [foo] |
98 | ;; bar = xxx | |
ffe0c7ef | 99 | ;; |
1fffafda LK |
100 | ;; However, since the `.' regexp symbol matches the linefeed character |
101 | ;; the entire folded section is searched, resulting in a regexp stack | |
ca1e63a5 | 102 | ;; overflow. |
ffe0c7ef | 103 | ;; |
1fffafda LK |
104 | ;; Solution suggestion: Instead of using ".", use the sequence |
105 | ;; "[^\n\r]". This will make the rules behave just as before, but | |
106 | ;; they will work together with selective-display. | |
ca1e63a5 RS |
107 | |
108 | ;;; Code: | |
109 | ||
1fffafda | 110 | (eval-when-compile (require 'font-lock)) |
ca1e63a5 | 111 | |
ef1c5063 | 112 | (defgroup generic-x nil |
9285b8bc | 113 | "A collection of generic modes." |
ef1c5063 | 114 | :prefix "generic-" |
9285b8bc | 115 | :group 'data |
10714c98 | 116 | :version "20.3") |
ef1c5063 | 117 | |
9285b8bc LK |
118 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
119 | ;; Default-Generic mode | |
120 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
121 | ||
122 | (defcustom generic-use-find-file-hook t | |
123 | "*If non-nil, add a hook to enter `default-generic-mode' automatically. | |
124 | This is done if the first few lines of a file in fundamental mode | |
125 | start with a hash comment character." | |
126 | :group 'generic-x | |
127 | :type 'boolean) | |
128 | ||
129 | (defcustom generic-lines-to-scan 3 | |
130 | "*Number of lines that `generic-mode-find-file-hook' looks at. | |
131 | Relevant when deciding whether to enter Default-Generic mode automatically. | |
132 | This variable should be set to a small positive number." | |
133 | :group 'generic-x | |
134 | :type 'integer) | |
135 | ||
136 | (defcustom generic-find-file-regexp "^#" | |
137 | "*Regular expression used by `generic-mode-find-file-hook'. | |
138 | Files in fundamental mode whose first few lines contain a match | |
139 | for this regexp, should be put into Default-Generic mode instead. | |
140 | The number of lines tested for the matches is specified by the | |
141 | value of the variable `generic-lines-to-scan', which see." | |
142 | :group 'generic-x | |
143 | :type 'regexp) | |
144 | ||
145 | (defcustom generic-ignore-files-regexp "[Tt][Aa][Gg][Ss]\\'" | |
146 | "*Regular expression used by `generic-mode-find-file-hook'. | |
147 | Files whose names match this regular expression should not be put | |
148 | into Default-Generic mode, even if they have lines which match | |
149 | the regexp in `generic-find-file-regexp'. If the value is nil, | |
150 | `generic-mode-find-file-hook' does not check the file names." | |
151 | :group 'generic-x | |
152 | :type '(choice (const :tag "Don't check file names" nil) regexp)) | |
153 | ||
154 | ;; This generic mode is always defined | |
d4fb185d | 155 | (define-generic-mode default-generic-mode (list ?#) nil nil nil nil) |
9285b8bc LK |
156 | |
157 | ;; A more general solution would allow us to enter generic-mode for | |
158 | ;; *any* comment character, but would require us to synthesize a new | |
159 | ;; generic-mode on the fly. I think this gives us most of what we | |
160 | ;; want. | |
161 | (defun generic-mode-find-file-hook () | |
162 | "Hook function to enter Default-Generic mode automatically. | |
163 | ||
164 | Done if the first few lines of a file in Fundamental mode start | |
165 | with a match for the regexp in `generic-find-file-regexp', unless | |
166 | the file's name matches the regexp which is the value of the | |
167 | variable `generic-ignore-files-regexp'. | |
168 | ||
169 | This hook will be installed if the variable | |
170 | `generic-use-find-file-hook' is non-nil. The variable | |
171 | `generic-lines-to-scan' determines the number of lines to look at." | |
172 | (when (and (eq major-mode 'fundamental-mode) | |
173 | (or (null generic-ignore-files-regexp) | |
174 | (not (string-match | |
175 | generic-ignore-files-regexp | |
176 | (file-name-sans-versions buffer-file-name))))) | |
177 | (save-excursion | |
178 | (goto-char (point-min)) | |
179 | (when (re-search-forward generic-find-file-regexp | |
180 | (save-excursion | |
181 | (forward-line generic-lines-to-scan) | |
182 | (point)) t) | |
183 | (goto-char (point-min)) | |
184 | (default-generic-mode))))) | |
185 | ||
9285b8bc LK |
186 | (and generic-use-find-file-hook |
187 | (add-hook 'find-file-hook 'generic-mode-find-file-hook)) | |
188 | ||
189 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
190 | ;; Other Generic modes | |
191 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
192 | ||
1fffafda LK |
193 | ;; If you add a generic mode to this file, put it in one of these four |
194 | ;; lists as well. | |
195 | ||
196 | (defconst generic-default-modes | |
197 | '(apache-conf-generic-mode | |
198 | apache-log-generic-mode | |
199 | hosts-generic-mode | |
200 | java-manifest-generic-mode | |
201 | java-properties-generic-mode | |
202 | javascript-generic-mode | |
203 | show-tabs-generic-mode | |
204 | vrml-generic-mode) | |
205 | "List of generic modes that are defined by default.") | |
206 | ||
207 | (defconst generic-mswindows-modes | |
208 | '(bat-generic-mode | |
209 | inf-generic-mode | |
210 | ini-generic-mode | |
211 | rc-generic-mode | |
212 | reg-generic-mode | |
213 | rul-generic-mode) | |
214 | "List of generic modes that are defined by default on MS-Windows.") | |
215 | ||
216 | (defconst generic-unix-modes | |
217 | '(alias-generic-mode | |
218 | etc-fstab-generic-mode | |
219 | etc-modules-conf-generic-mode | |
220 | etc-passwd-generic-mode | |
221 | etc-services-generic-mode | |
5f33ef98 | 222 | etc-sudoers-generic-mode |
1fffafda LK |
223 | fvwm-generic-mode |
224 | inetd-conf-generic-mode | |
225 | mailagent-rules-generic-mode | |
226 | mailrc-generic-mode | |
227 | named-boot-generic-mode | |
228 | named-database-generic-mode | |
229 | prototype-generic-mode | |
230 | resolve-conf-generic-mode | |
231 | samba-generic-mode | |
232 | x-resource-generic-mode) | |
233 | "List of generic modes that are defined by default on Unix.") | |
234 | ||
235 | (defconst generic-other-modes | |
236 | '(astap-generic-mode | |
237 | ibis-generic-mode | |
238 | pkginfo-generic-mode | |
239 | spice-generic-mode) | |
240 | "List of generic mode that are not defined by default.") | |
ca1e63a5 | 241 | |
ffe0c7ef | 242 | (defcustom generic-define-mswindows-modes |
d8677156 | 243 | (memq system-type '(windows-nt ms-dos)) |
1fffafda LK |
244 | "*Non-nil means the modes in `generic-mswindows-modes' will be defined. |
245 | This is a list of MS-Windows specific generic modes. This variable | |
76ee7bd5 | 246 | only affects the default value of `generic-extras-enable-list'." |
ca1e63a5 | 247 | :group 'generic-x |
1fffafda LK |
248 | :type 'boolean |
249 | :version "22.1") | |
250 | (make-obsolete-variable 'generic-define-mswindows-modes 'generic-extras-enable-list "22.1") | |
ca1e63a5 RS |
251 | |
252 | (defcustom generic-define-unix-modes | |
d8677156 | 253 | (not (memq system-type '(windows-nt ms-dos))) |
1fffafda LK |
254 | "*Non-nil means the modes in `generic-unix-modes' will be defined. |
255 | This is a list of Unix specific generic modes. This variable only | |
76ee7bd5 | 256 | affects the default value of `generic-extras-enable-list'." |
ca1e63a5 | 257 | :group 'generic-x |
1fffafda LK |
258 | :type 'boolean |
259 | :version "22.1") | |
260 | (make-obsolete-variable 'generic-define-unix-modes 'generic-extras-enable-list "22.1") | |
261 | ||
262 | (defcustom generic-extras-enable-list | |
263 | (append generic-default-modes | |
264 | (if generic-define-mswindows-modes generic-mswindows-modes) | |
265 | (if generic-define-unix-modes generic-unix-modes) | |
266 | nil) | |
267 | "List of generic modes to define. | |
268 | Each entry in the list should be a symbol. If you set this variable | |
269 | directly, without using customize, you must reload generic-x to put | |
270 | your changes into effect." | |
271 | :group 'generic-x | |
272 | :type (let (list) | |
273 | (dolist (mode | |
274 | (sort (append generic-default-modes | |
275 | generic-mswindows-modes | |
276 | generic-unix-modes | |
277 | generic-other-modes | |
278 | nil) | |
279 | (lambda (a b) | |
280 | (string< (symbol-name b) | |
281 | (symbol-name a)))) | |
282 | (cons 'set list)) | |
283 | (push `(const ,mode) list))) | |
284 | :set (lambda (s v) | |
285 | (set-default s v) | |
286 | (unless load-in-progress | |
287 | (load "generic-x"))) | |
288 | :version "22.1") | |
ca1e63a5 | 289 | |
ca1e63a5 | 290 | ;;; Apache |
d8677156 LK |
291 | (when (memq 'apache-conf-generic-mode generic-extras-enable-list) |
292 | ||
293 | (define-generic-mode apache-conf-generic-mode | |
82e38f3e | 294 | '(?#) |
d8677156 | 295 | nil |
82e38f3e LK |
296 | '(("^\\s-*\\(<.*>\\)" 1 font-lock-constant-face) |
297 | ("^\\s-*\\(\\sw+\\)\\s-" 1 font-lock-variable-name-face)) | |
298 | '("srm\\.conf\\'" "httpd\\.conf\\'" "access\\.conf\\'") | |
d8677156 LK |
299 | (list |
300 | (function | |
301 | (lambda () | |
ffe0c7ef PB |
302 | (setq imenu-generic-expression |
303 | '((nil "^\\([-A-Za-z0-9_]+\\)" 1) | |
304 | ("*Directories*" "^\\s-*<Directory\\s-*\\([^>]+\\)>" 1) | |
d8677156 | 305 | ("*Locations*" "^\\s-*<Location\\s-*\\([^>]+\\)>" 1)))))) |
d4fb185d | 306 | "Generic mode for Apache or HTTPD configuration files.")) |
ffe0c7ef | 307 | |
d8677156 | 308 | (when (memq 'apache-log-generic-mode generic-extras-enable-list) |
ffe0c7ef | 309 | |
d8677156 | 310 | (define-generic-mode apache-log-generic-mode |
ffe0c7ef PB |
311 | nil |
312 | nil | |
313 | ;; Hostname ? user date request return-code number-of-bytes | |
314 | '(("^\\([-a-zA-z0-9.]+\\) - [-A-Za-z]+ \\(\\[.*\\]\\)" | |
315 | (1 font-lock-constant-face) | |
d8677156 | 316 | (2 font-lock-variable-name-face))) |
82e38f3e | 317 | '("access_log\\'") |
ffe0c7ef | 318 | nil |
76ee7bd5 | 319 | "Mode for Apache log files.")) |
ffe0c7ef | 320 | |
ca1e63a5 | 321 | ;;; Samba |
d8677156 LK |
322 | (when (memq 'samba-generic-mode generic-extras-enable-list) |
323 | ||
324 | (define-generic-mode samba-generic-mode | |
82e38f3e | 325 | '(?\; ?#) |
d8677156 | 326 | nil |
82e38f3e | 327 | '(("^\\(\\[.*\\]\\)" 1 font-lock-constant-face) |
d8677156 | 328 | ("^\\s-*\\(.+\\)=\\([^\r\n]*\\)" |
82e38f3e LK |
329 | (1 font-lock-variable-name-face) |
330 | (2 font-lock-type-face))) | |
331 | '("smb\\.conf\\'") | |
332 | '(generic-bracket-support) | |
d4fb185d | 333 | "Generic mode for Samba configuration files.")) |
ca1e63a5 RS |
334 | |
335 | ;;; Fvwm | |
336 | ;; This is pretty basic. Also, modes for other window managers could | |
337 | ;; be defined as well. | |
d8677156 | 338 | (when (memq 'fvwm-generic-mode generic-extras-enable-list) |
ca1e63a5 | 339 | |
d8677156 | 340 | (define-generic-mode fvwm-generic-mode |
82e38f3e LK |
341 | '(?#) |
342 | '("AddToMenu" | |
343 | "AddToFunc" | |
344 | "ButtonStyle" | |
345 | "EndFunction" | |
346 | "EndPopup" | |
347 | "Function" | |
348 | "IconPath" | |
349 | "Key" | |
350 | "ModulePath" | |
351 | "Mouse" | |
352 | "PixmapPath" | |
353 | "Popup" | |
354 | "Style") | |
d8677156 | 355 | nil |
82e38f3e | 356 | '("\\.fvwmrc\\'" "\\.fvwm2rc\\'") |
d8677156 | 357 | nil |
d4fb185d | 358 | "Generic mode for FVWM configuration files.")) |
ca1e63a5 RS |
359 | |
360 | ;;; X Resource | |
361 | ;; I'm pretty sure I've seen an actual mode to do this, but I don't | |
362 | ;; think it's standard with Emacs | |
d8677156 | 363 | (when (memq 'x-resource-generic-mode generic-extras-enable-list) |
ca1e63a5 | 364 | |
d8677156 | 365 | (define-generic-mode x-resource-generic-mode |
82e38f3e | 366 | '(?!) |
d8677156 | 367 | nil |
82e38f3e LK |
368 | '(("^\\([^:\n]+:\\)" 1 font-lock-variable-name-face)) |
369 | '("\\.Xdefaults\\'" "\\.Xresources\\'" "\\.Xenvironment\\'" "\\.ad\\'") | |
d8677156 | 370 | nil |
d4fb185d | 371 | "Generic mode for X Resource configuration files.")) |
ca1e63a5 RS |
372 | |
373 | ;;; Hosts | |
d8677156 | 374 | (when (memq 'hosts-generic-mode generic-extras-enable-list) |
ca1e63a5 | 375 | |
d8677156 | 376 | (define-generic-mode hosts-generic-mode |
82e38f3e LK |
377 | '(?#) |
378 | '("localhost") | |
379 | '(("\\([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+\\)" 1 font-lock-constant-face)) | |
380 | '("[hH][oO][sS][tT][sS]\\'") | |
d8677156 | 381 | nil |
d4fb185d | 382 | "Generic mode for HOSTS files.")) |
ca1e63a5 RS |
383 | |
384 | ;;; Windows INF files | |
97d9baef GM |
385 | |
386 | ;; If i-g-m-f-f-h is defined, then so is i-g-m. | |
387 | (declare-function ini-generic-mode "generic-x") | |
388 | ||
d8677156 | 389 | (when (memq 'inf-generic-mode generic-extras-enable-list) |
ca1e63a5 | 390 | |
d8677156 | 391 | (define-generic-mode inf-generic-mode |
82e38f3e | 392 | '(?\;) |
d8677156 | 393 | nil |
82e38f3e LK |
394 | '(("^\\(\\[.*\\]\\)" 1 font-lock-constant-face)) |
395 | '("\\.[iI][nN][fF]\\'") | |
396 | '(generic-bracket-support) | |
d4fb185d | 397 | "Generic mode for MS-Windows INF files.")) |
ca1e63a5 RS |
398 | |
399 | ;;; Windows INI files | |
400 | ;; Should define escape character as well! | |
d8677156 LK |
401 | (when (memq 'ini-generic-mode generic-extras-enable-list) |
402 | ||
403 | (define-generic-mode ini-generic-mode | |
82e38f3e | 404 | '(?\;) |
d8677156 | 405 | nil |
82e38f3e | 406 | '(("^\\(\\[.*\\]\\)" 1 font-lock-constant-face) |
d8677156 LK |
407 | ("^\\([^=\n\r]*\\)=\\([^\n\r]*\\)$" |
408 | (1 font-lock-function-name-face) | |
409 | (2 font-lock-variable-name-face))) | |
82e38f3e | 410 | '("\\.[iI][nN][iI]\\'") |
d8677156 LK |
411 | (list |
412 | (function | |
413 | (lambda () | |
414 | (setq imenu-generic-expression | |
415 | '((nil "^\\[\\(.*\\)\\]" 1) | |
416 | ("*Variables*" "^\\s-*\\([^=]+\\)\\s-*=" 1)))))) | |
a2d66c78 LK |
417 | "Generic mode for MS-Windows INI files. |
418 | You can use `ini-generic-mode-find-file-hook' to enter this mode | |
d4fb185d | 419 | automatically for INI files whose names do not end in \".ini\".") |
a2d66c78 LK |
420 | |
421 | (defun ini-generic-mode-find-file-hook () | |
422 | "Hook function to enter Ini-Generic mode automatically for INI files. | |
423 | Done if the first few lines of a file in Fundamental mode look | |
424 | like an INI file. You can add this hook to `find-file-hook'." | |
425 | (and (eq major-mode 'fundamental-mode) | |
426 | (save-excursion | |
427 | (goto-char (point-min)) | |
428 | (and (looking-at "^\\s-*\\[.*\\]") | |
429 | (ini-generic-mode))))) | |
430 | (defalias 'generic-mode-ini-file-find-file-hook 'ini-generic-mode-find-file-hook)) | |
ca1e63a5 RS |
431 | |
432 | ;;; Windows REG files | |
433 | ;;; Unfortunately, Windows 95 and Windows NT have different REG file syntax! | |
d8677156 LK |
434 | (when (memq 'reg-generic-mode generic-extras-enable-list) |
435 | ||
436 | (define-generic-mode reg-generic-mode | |
437 | '(?\;) | |
438 | '("key" "classes_root" "REGEDIT" "REGEDIT4") | |
ddb72af9 | 439 | '(("\\(\\[.*\\]\\)" 1 font-lock-constant-face) |
82e38f3e | 440 | ("^\\([^\n\r]*\\)\\s-*=" 1 font-lock-variable-name-face)) |
d8677156 LK |
441 | '("\\.[rR][eE][gG]\\'") |
442 | (list | |
443 | (function | |
444 | (lambda () | |
445 | (setq imenu-generic-expression | |
446 | '((nil "^\\s-*\\(.*\\)\\s-*=" 1)))))) | |
d4fb185d | 447 | "Generic mode for MS-Windows Registry files.")) |
ca1e63a5 | 448 | |
d5f05c46 DN |
449 | (declare-function w32-shell-name "w32-fns" ()) |
450 | ||
60bdd17f | 451 | ;;; DOS/Windows BAT files |
d8677156 LK |
452 | (when (memq 'bat-generic-mode generic-extras-enable-list) |
453 | ||
454 | (define-generic-mode bat-generic-mode | |
455 | nil | |
456 | nil | |
82e38f3e | 457 | (eval-when-compile |
ca1e63a5 | 458 | (list |
82e38f3e LK |
459 | ;; Make this one first in the list, otherwise comments will |
460 | ;; be over-written by other variables | |
461 | '("^[@ \t]*\\([rR][eE][mM][^\n\r]*\\)" 1 font-lock-comment-face t) | |
462 | '("^[ \t]*\\(::.*\\)" 1 font-lock-comment-face t) | |
463 | '("^[@ \t]*\\([bB][rR][eE][aA][kK]\\|[vV][eE][rR][iI][fF][yY]\\)[ \t]+\\([oO]\\([nN]\\|[fF][fF]\\)\\)" | |
464 | (1 font-lock-builtin-face) | |
465 | (2 font-lock-constant-face t t)) | |
466 | ;; Any text (except ON/OFF) following ECHO is a string. | |
467 | '("^[@ \t]*\\([eE][cC][hH][oO]\\)[ \t]+\\(\\([oO]\\([nN]\\|[fF][fF]\\)\\)\\|\\([^>|\r\n]+\\)\\)" | |
468 | (1 font-lock-builtin-face) | |
469 | (3 font-lock-constant-face t t) | |
470 | (5 font-lock-string-face t t)) | |
471 | ;; These keywords appear as the first word on a line. (Actually, they | |
472 | ;; can also appear after "if ..." or "for ..." clause, but since they | |
473 | ;; are frequently used in simple text, we punt.) | |
474 | ;; In `generic-bat-mode-setup-function' we make the keywords | |
475 | ;; case-insensitive | |
476 | (generic-make-keywords-list | |
477 | '("for" | |
478 | "if") | |
16a013c2 | 479 | font-lock-keyword-face "^[@ \t]*") |
82e38f3e LK |
480 | ;; These keywords can be anywhere on a line |
481 | ;; In `generic-bat-mode-setup-function' we make the keywords | |
482 | ;; case-insensitive | |
483 | (generic-make-keywords-list | |
484 | '("do" | |
485 | "exist" | |
486 | "errorlevel" | |
487 | "goto" | |
488 | "not") | |
16a013c2 | 489 | font-lock-keyword-face) |
82e38f3e LK |
490 | ;; These are built-in commands. Only frequently-used ones are listed. |
491 | (generic-make-keywords-list | |
492 | '("CALL" "call" "Call" | |
493 | "CD" "cd" "Cd" | |
494 | "CLS" "cls" "Cls" | |
495 | "COPY" "copy" "Copy" | |
496 | "DEL" "del" "Del" | |
497 | "ECHO" "echo" "Echo" | |
498 | "MD" "md" "Md" | |
499 | "PATH" "path" "Path" | |
500 | "PAUSE" "pause" "Pause" | |
903ec1ba | 501 | "PROMPT" "prompt" "Prompt" |
82e38f3e LK |
502 | "RD" "rd" "Rd" |
503 | "REN" "ren" "Ren" | |
504 | "SET" "set" "Set" | |
505 | "START" "start" "Start" | |
506 | "SHIFT" "shift" "Shift") | |
16a013c2 | 507 | font-lock-builtin-face "[ \t|\n]") |
82e38f3e LK |
508 | '("^[ \t]*\\(:\\sw+\\)" 1 font-lock-function-name-face t) |
509 | '("\\(%\\sw+%\\)" 1 font-lock-variable-name-face t) | |
510 | '("\\(%[0-9]\\)" 1 font-lock-variable-name-face t) | |
511 | '("\\(/[^/ \"\t\n]+\\)" 1 font-lock-type-face) | |
512 | '("[\t ]+\\([+-][^\t\n\" ]+\\)" 1 font-lock-type-face) | |
513 | '("[ \t\n|]\\<\\([gG][oO][tT][oO]\\)\\>[ \t]*\\(\\sw+\\)?" | |
514 | (1 font-lock-keyword-face) | |
515 | (2 font-lock-function-name-face nil t)) | |
516 | '("[ \t\n|]\\<\\([sS][eE][tT]\\)\\>[ \t]*\\(\\sw+\\)?[ \t]*=?" | |
517 | (1 font-lock-builtin-face) | |
518 | (2 font-lock-variable-name-face t t)))) | |
519 | '("\\.[bB][aA][tT]\\'" | |
6453a10e | 520 | "\\.[cC][mM][dD]\\'" |
82e38f3e LK |
521 | "\\`[cC][oO][nN][fF][iI][gG]\\." |
522 | "\\`[aA][uU][tT][oO][eE][xX][eE][cC]\\.") | |
523 | '(generic-bat-mode-setup-function) | |
6453a10e | 524 | "Generic mode for MS-Windows batch files.") |
d8677156 LK |
525 | |
526 | (defvar bat-generic-mode-syntax-table nil | |
1fffafda | 527 | "Syntax table in use in `bat-generic-mode' buffers.") |
d8677156 LK |
528 | |
529 | (defvar bat-generic-mode-keymap (make-sparse-keymap) | |
76ee7bd5 | 530 | "Keymap for `bat-generic-mode'.") |
d8677156 LK |
531 | |
532 | (defun bat-generic-mode-compile () | |
533 | "Run the current BAT file in a compilation buffer." | |
534 | (interactive) | |
535 | (let ((compilation-buffer-name-function | |
536 | (function | |
537 | (lambda(ign) | |
538 | (concat "*" (buffer-file-name) "*"))))) | |
539 | (compile | |
540 | (concat (w32-shell-name) " -c " (buffer-file-name))))) | |
541 | ||
a2d66c78 | 542 | (eval-when-compile (require 'comint)) |
d8677156 LK |
543 | (defun bat-generic-mode-run-as-comint () |
544 | "Run the current BAT file in a comint buffer." | |
545 | (interactive) | |
546 | (require 'comint) | |
547 | (let* ((file (buffer-file-name)) | |
548 | (buf-name (concat "*" file "*"))) | |
549 | (save-excursion | |
550 | (set-buffer | |
551 | (get-buffer-create buf-name)) | |
552 | (erase-buffer) | |
553 | (comint-mode) | |
554 | (comint-exec | |
555 | buf-name | |
556 | file | |
557 | (w32-shell-name) | |
558 | nil | |
559 | (list "-c" file)) | |
560 | (display-buffer buf-name)))) | |
561 | ||
562 | (define-key bat-generic-mode-keymap "\C-c\C-c" 'bat-generic-mode-compile) | |
563 | ||
564 | ;; Make underscores count as words | |
565 | (unless bat-generic-mode-syntax-table | |
566 | (setq bat-generic-mode-syntax-table (make-syntax-table)) | |
16a013c2 | 567 | (modify-syntax-entry ?_ "w" bat-generic-mode-syntax-table)) |
d8677156 | 568 | |
16a013c2 LK |
569 | ;; bat-generic-mode doesn't use the comment functionality of |
570 | ;; define-generic-mode because it has a three-letter comment-string, | |
571 | ;; so we do it here manually instead | |
d8677156 | 572 | (defun generic-bat-mode-setup-function () |
82e38f3e LK |
573 | (make-local-variable 'parse-sexp-ignore-comments) |
574 | (make-local-variable 'comment-start) | |
575 | (make-local-variable 'comment-start-skip) | |
576 | (make-local-variable 'comment-end) | |
577 | (setq imenu-generic-expression '((nil "^:\\(\\sw+\\)" 1)) | |
d8677156 | 578 | parse-sexp-ignore-comments t |
82e38f3e LK |
579 | comment-end "" |
580 | comment-start "REM " | |
581 | comment-start-skip "[Rr][Ee][Mm] *") | |
582 | (set-syntax-table bat-generic-mode-syntax-table) | |
d8677156 | 583 | ;; Make keywords case-insensitive |
16a013c2 | 584 | (setq font-lock-defaults '(generic-font-lock-keywords nil t)) |
d8677156 | 585 | (use-local-map bat-generic-mode-keymap))) |
ca1e63a5 RS |
586 | |
587 | ;;; Mailagent | |
82e38f3e LK |
588 | ;; Mailagent is a Unix mail filtering program. Anyone wanna do a |
589 | ;; generic mode for procmail? | |
d8677156 LK |
590 | (when (memq 'mailagent-rules-generic-mode generic-extras-enable-list) |
591 | ||
592 | (define-generic-mode mailagent-rules-generic-mode | |
82e38f3e LK |
593 | '(?#) |
594 | '("SAVE" "DELETE" "PIPE" "ANNOTATE" "REJECT") | |
595 | '(("^\\(\\sw+\\)\\s-*=" 1 font-lock-variable-name-face) | |
596 | ("\\s-/\\([^/]+\\)/[i, \t\n]" 1 font-lock-constant-face)) | |
597 | '("\\.rules\\'") | |
16a013c2 LK |
598 | (list |
599 | (function | |
600 | (lambda () | |
601 | (setq imenu-generic-expression | |
602 | '((nil "\\s-/\\([^/]+\\)/[i, \t\n]" 1)))))) | |
d4fb185d | 603 | "Mode for Mailagent rules files.")) |
ca1e63a5 RS |
604 | |
605 | ;; Solaris/Sys V prototype files | |
d8677156 LK |
606 | (when (memq 'prototype-generic-mode generic-extras-enable-list) |
607 | ||
608 | (define-generic-mode prototype-generic-mode | |
82e38f3e | 609 | '(?#) |
d8677156 LK |
610 | nil |
611 | '(("^\\([0-9]\\)?\\s-*\\([a-z]\\)\\s-+\\([A-Za-z_]+\\)\\s-+\\([^\n\r]*\\)$" | |
612 | (2 font-lock-constant-face) | |
613 | (3 font-lock-keyword-face)) | |
614 | ("^\\([a-z]\\) \\([A-Za-z_]+\\)=\\([^\n\r]*\\)$" | |
615 | (1 font-lock-constant-face) | |
616 | (2 font-lock-keyword-face) | |
617 | (3 font-lock-variable-name-face)) | |
618 | ("^\\(!\\s-*\\(search\\|include\\|default\\)\\)\\s-*\\([^\n\r]*\\)$" | |
619 | (1 font-lock-keyword-face) | |
620 | (3 font-lock-variable-name-face)) | |
621 | ("^\\(!\\s-*\\sw+\\)=\\([^\n\r]*\\)$" | |
622 | (1 font-lock-keyword-face) | |
623 | (2 font-lock-variable-name-face))) | |
82e38f3e | 624 | '("prototype\\'") |
d8677156 | 625 | nil |
d4fb185d | 626 | "Mode for Sys V prototype files.")) |
ca1e63a5 RS |
627 | |
628 | ;; Solaris/Sys V pkginfo files | |
d8677156 LK |
629 | (when (memq 'pkginfo-generic-mode generic-extras-enable-list) |
630 | ||
631 | (define-generic-mode pkginfo-generic-mode | |
82e38f3e | 632 | '(?#) |
d8677156 LK |
633 | nil |
634 | '(("^\\([A-Za-z_]+\\)=\\([^\n\r]*\\)$" | |
635 | (1 font-lock-keyword-face) | |
636 | (2 font-lock-variable-name-face))) | |
82e38f3e | 637 | '("pkginfo\\'") |
d8677156 | 638 | nil |
d4fb185d | 639 | "Mode for Sys V pkginfo files.")) |
ca1e63a5 RS |
640 | |
641 | ;; Javascript mode | |
ffe0c7ef | 642 | ;; Includes extra keywords from Armando Singer [asinger@MAIL.COLGATE.EDU] |
1fffafda LK |
643 | (when (memq 'javascript-generic-mode generic-extras-enable-list) |
644 | ||
d8677156 | 645 | (define-generic-mode javascript-generic-mode |
82e38f3e LK |
646 | '("//" ("/*" . "*/")) |
647 | '("break" | |
648 | "case" | |
649 | "continue" | |
650 | "default" | |
651 | "delete" | |
652 | "do" | |
653 | "else" | |
654 | "export" | |
655 | "for" | |
656 | "function" | |
657 | "if" | |
658 | "import" | |
659 | "in" | |
660 | "new" | |
661 | "return" | |
662 | "switch" | |
663 | "this" | |
664 | "typeof" | |
665 | "var" | |
666 | "void" | |
667 | "while" | |
668 | "with" | |
669 | ;; words reserved for ECMA extensions below | |
670 | "catch" | |
671 | "class" | |
672 | "const" | |
673 | "debugger" | |
674 | "enum" | |
675 | "extends" | |
676 | "finally" | |
677 | "super" | |
678 | "throw" | |
679 | "try" | |
680 | ;; Java Keywords reserved by JavaScript | |
681 | "abstract" | |
682 | "boolean" | |
683 | "byte" | |
684 | "char" | |
685 | "double" | |
686 | "false" | |
687 | "final" | |
688 | "float" | |
689 | "goto" | |
690 | "implements" | |
691 | "instanceof" | |
692 | "int" | |
693 | "interface" | |
694 | "long" | |
695 | "native" | |
696 | "null" | |
697 | "package" | |
698 | "private" | |
699 | "protected" | |
700 | "public" | |
701 | "short" | |
702 | "static" | |
703 | "synchronized" | |
704 | "throws" | |
705 | "transient" | |
706 | "true") | |
707 | '(("^\\s-*function\\s-+\\([A-Za-z0-9_]+\\)" | |
708 | (1 font-lock-function-name-face)) | |
709 | ("^\\s-*var\\s-+\\([A-Za-z0-9_]+\\)" | |
710 | (1 font-lock-variable-name-face))) | |
711 | '("\\.js\\'") | |
ca1e63a5 | 712 | (list |
ffe0c7ef | 713 | (function |
ca1e63a5 | 714 | (lambda () |
ffe0c7ef PB |
715 | (setq imenu-generic-expression |
716 | '((nil "^function\\s-+\\([A-Za-z0-9_]+\\)" 1) | |
d8677156 | 717 | ("*Variables*" "^var\\s-+\\([A-Za-z0-9_]+\\)" 1)))))) |
d4fb185d | 718 | "Mode for JavaScript files.")) |
ca1e63a5 RS |
719 | |
720 | ;; VRML files | |
1fffafda LK |
721 | (when (memq 'vrml-generic-mode generic-extras-enable-list) |
722 | ||
d8677156 | 723 | (define-generic-mode vrml-generic-mode |
82e38f3e LK |
724 | '(?#) |
725 | '("DEF" | |
726 | "NULL" | |
727 | "USE" | |
728 | "Viewpoint" | |
729 | "ambientIntensity" | |
730 | "appearance" | |
731 | "children" | |
732 | "color" | |
733 | "coord" | |
734 | "coordIndex" | |
735 | "creaseAngle" | |
736 | "diffuseColor" | |
737 | "emissiveColor" | |
738 | "fieldOfView" | |
739 | "geometry" | |
740 | "info" | |
741 | "material" | |
742 | "normal" | |
743 | "orientation" | |
744 | "position" | |
745 | "shininess" | |
746 | "specularColor" | |
747 | "texCoord" | |
748 | "texture" | |
749 | "textureTransform" | |
750 | "title" | |
751 | "transparency" | |
752 | "type") | |
753 | '(("USE\\s-+\\([-A-Za-z0-9_]+\\)" | |
754 | (1 font-lock-constant-face)) | |
755 | ("DEF\\s-+\\([-A-Za-z0-9_]+\\)\\s-+\\([A-Za-z0-9]+\\)\\s-*{" | |
756 | (1 font-lock-type-face) | |
757 | (2 font-lock-constant-face)) | |
758 | ("^\\s-*\\([-A-Za-z0-9_]+\\)\\s-*{" | |
759 | (1 font-lock-function-name-face)) | |
760 | ("^\\s-*\\(geometry\\|appearance\\|material\\)\\s-+\\([-A-Za-z0-9_]+\\)" | |
761 | (2 font-lock-variable-name-face))) | |
762 | '("\\.wrl\\'") | |
ca1e63a5 | 763 | (list |
ffe0c7ef | 764 | (function |
ca1e63a5 | 765 | (lambda () |
ffe0c7ef | 766 | (setq imenu-generic-expression |
ca1e63a5 | 767 | '((nil "^\\([A-Za-z0-9_]+\\)\\s-*{" 1) |
ffe0c7ef | 768 | ("*Definitions*" |
ca1e63a5 | 769 | "DEF\\s-+\\([-A-Za-z0-9_]+\\)\\s-+\\([A-Za-z0-9]+\\)\\s-*{" |
d8677156 | 770 | 1)))))) |
d4fb185d | 771 | "Generic Mode for VRML files.")) |
ca1e63a5 RS |
772 | |
773 | ;; Java Manifests | |
1fffafda LK |
774 | (when (memq 'java-manifest-generic-mode generic-extras-enable-list) |
775 | ||
d8677156 | 776 | (define-generic-mode java-manifest-generic-mode |
82e38f3e LK |
777 | '(?#) |
778 | '("Name" | |
779 | "Digest-Algorithms" | |
780 | "Manifest-Version" | |
781 | "Required-Version" | |
782 | "Signature-Version" | |
783 | "Magic" | |
784 | "Java-Bean" | |
785 | "Depends-On") | |
ca1e63a5 RS |
786 | '(("^Name:\\s-+\\([^\n\r]*\\)$" |
787 | (1 font-lock-variable-name-face)) | |
788 | ("^\\(Manifest\\|Required\\|Signature\\)-Version:\\s-+\\([^\n\r]*\\)$" | |
d8677156 | 789 | (2 font-lock-constant-face))) |
82e38f3e | 790 | '("[mM][aA][nN][iI][fF][eE][sS][tT]\\.[mM][fF]\\'") |
ca1e63a5 | 791 | nil |
76ee7bd5 | 792 | "Mode for Java Manifest files.")) |
ca1e63a5 RS |
793 | |
794 | ;; Java properties files | |
1fffafda LK |
795 | (when (memq 'java-properties-generic-mode generic-extras-enable-list) |
796 | ||
d8677156 | 797 | (define-generic-mode java-properties-generic-mode |
82e38f3e | 798 | '(?! ?#) |
ca1e63a5 | 799 | nil |
82e38f3e LK |
800 | (eval-when-compile |
801 | (let ((java-properties-key | |
802 | "\\(\\([-A-Za-z0-9_\\./]\\|\\(\\\\[ =:]\\)\\)+\\)") | |
803 | (java-properties-value | |
804 | "\\([^\r\n]*\\)")) | |
805 | ;; Property and value can be separated in a number of different ways: | |
806 | ;; * whitespace | |
807 | ;; * an equal sign | |
808 | ;; * a colon | |
809 | (mapcar | |
810 | (function | |
811 | (lambda (elt) | |
812 | (list | |
813 | (concat "^" java-properties-key elt java-properties-value "$") | |
814 | '(1 font-lock-constant-face) | |
815 | '(4 font-lock-variable-name-face)))) | |
816 | ;; These are the separators | |
817 | '(":\\s-*" "\\s-+" "\\s-*=\\s-*")))) | |
ca1e63a5 | 818 | nil |
bb53e1ee RS |
819 | (list |
820 | (function | |
821 | (lambda () | |
ffe0c7ef | 822 | (setq imenu-generic-expression |
d8677156 | 823 | '((nil "^\\([^#! \t\n\r=:]+\\)" 1)))))) |
d4fb185d | 824 | "Mode for Java properties files.")) |
ca1e63a5 RS |
825 | |
826 | ;; C shell alias definitions | |
d8677156 | 827 | (when (memq 'alias-generic-mode generic-extras-enable-list) |
ef1c5063 | 828 | |
d8677156 | 829 | (define-generic-mode alias-generic-mode |
82e38f3e LK |
830 | '(?#) |
831 | '("alias" "unalias") | |
ca1e63a5 RS |
832 | '(("^alias\\s-+\\([-A-Za-z0-9_]+\\)\\s-+" |
833 | (1 font-lock-variable-name-face)) | |
834 | ("^unalias\\s-+\\([-A-Za-z0-9_]+\\)\\s-*$" | |
d8677156 | 835 | (1 font-lock-variable-name-face))) |
82e38f3e | 836 | '("alias\\'") |
ca1e63a5 RS |
837 | (list |
838 | (function | |
839 | (lambda () | |
ffe0c7ef | 840 | (setq imenu-generic-expression |
d8677156 | 841 | '((nil "^\\(alias\\|unalias\\)\\s-+\\([-a-zA-Z0-9_]+\\)" 2)))))) |
d4fb185d | 842 | "Mode for C Shell alias files.")) |
ca1e63a5 RS |
843 | |
844 | ;;; Windows RC files | |
845 | ;; Contributed by ACorreir@pervasive-sw.com (Alfred Correira) | |
d8677156 LK |
846 | (when (memq 'rc-generic-mode generic-extras-enable-list) |
847 | ||
848 | (define-generic-mode rc-generic-mode | |
82e38f3e LK |
849 | ;; '(?\/) |
850 | '("//") | |
d8677156 LK |
851 | '("ACCELERATORS" |
852 | "AUTO3STATE" | |
853 | "AUTOCHECKBOX" | |
854 | "AUTORADIOBUTTON" | |
855 | "BITMAP" | |
856 | "BOTTOMMARGIN" | |
857 | "BUTTON" | |
858 | "CAPTION" | |
859 | "CHARACTERISTICS" | |
860 | "CHECKBOX" | |
861 | "CLASS" | |
862 | "COMBOBOX" | |
863 | "CONTROL" | |
864 | "CTEXT" | |
865 | "CURSOR" | |
866 | "DEFPUSHBUTTON" | |
867 | "DESIGNINFO" | |
868 | "DIALOG" | |
869 | "DISCARDABLE" | |
870 | "EDITTEXT" | |
871 | "EXSTYLE" | |
872 | "FONT" | |
873 | "GROUPBOX" | |
874 | "GUIDELINES" | |
875 | "ICON" | |
876 | "LANGUAGE" | |
877 | "LEFTMARGIN" | |
878 | "LISTBOX" | |
879 | "LTEXT" | |
880 | "MENUITEM SEPARATOR" | |
881 | "MENUITEM" | |
882 | "MENU" | |
883 | "MOVEABLE" | |
884 | "POPUP" | |
885 | "PRELOAD" | |
886 | "PURE" | |
887 | "PUSHBOX" | |
888 | "PUSHBUTTON" | |
889 | "RADIOBUTTON" | |
890 | "RCDATA" | |
891 | "RIGHTMARGIN" | |
892 | "RTEXT" | |
893 | "SCROLLBAR" | |
894 | "SEPARATOR" | |
895 | "STATE3" | |
896 | "STRINGTABLE" | |
897 | "STYLE" | |
898 | "TEXTINCLUDE" | |
899 | "TOOLBAR" | |
900 | "TOPMARGIN" | |
901 | "VERSIONINFO" | |
902 | "VERSION") | |
903 | ;; the choice of what tokens go where is somewhat arbitrary, | |
904 | ;; as is the choice of which value tokens are included, as | |
905 | ;; the choice of face for each token group | |
82e38f3e LK |
906 | (eval-when-compile |
907 | (list | |
d8677156 | 908 | (generic-make-keywords-list |
82e38f3e LK |
909 | '("FILEFLAGSMASK" |
910 | "FILEFLAGS" | |
911 | "FILEOS" | |
912 | "FILESUBTYPE" | |
913 | "FILETYPE" | |
914 | "FILEVERSION" | |
915 | "PRODUCTVERSION") | |
16a013c2 | 916 | font-lock-type-face) |
d8677156 | 917 | (generic-make-keywords-list |
82e38f3e LK |
918 | '("BEGIN" |
919 | "BLOCK" | |
920 | "END" | |
921 | "VALUE") | |
16a013c2 | 922 | font-lock-function-name-face) |
82e38f3e LK |
923 | '("^#[ \t]*include[ \t]+\\(<[^>\"\n]+>\\)" 1 font-lock-string-face) |
924 | '("^#[ \t]*define[ \t]+\\(\\sw+\\)(" 1 font-lock-function-name-face) | |
925 | '("^#[ \t]*\\(elif\\|if\\)\\>" | |
926 | ("\\<\\(defined\\)\\>[ \t]*(?\\(\\sw+\\)?" nil nil | |
927 | (1 font-lock-constant-face) | |
928 | (2 font-lock-variable-name-face nil t))) | |
929 | '("^#[ \t]*\\(\\sw+\\)\\>[ \t]*\\(\\sw+\\)?" | |
930 | (1 font-lock-constant-face) | |
931 | (2 font-lock-variable-name-face nil t)))) | |
60c19d5e | 932 | '("\\.[rR][cC]\\'") |
82e38f3e | 933 | nil |
d4fb185d | 934 | "Generic mode for MS-Windows Resource files.")) |
ca1e63a5 | 935 | |
ef1c5063 | 936 | ;; InstallShield RUL files |
ca1e63a5 | 937 | ;; Contributed by Alfred.Correira@Pervasive.Com |
9845e669 | 938 | ;; Bugfixes by "Rolf Sandau" <Rolf.Sandau@marconi.com> |
d8677156 LK |
939 | (when (memq 'rul-generic-mode generic-extras-enable-list) |
940 | ||
82e38f3e LK |
941 | (eval-when-compile |
942 | ||
ef1c5063 | 943 | ;;; build the regexp strings using regexp-opt |
82e38f3e LK |
944 | (defconst installshield-statement-keyword-list |
945 | '("abort" | |
946 | "begin" | |
947 | "call" | |
948 | "case" | |
949 | "declare" | |
950 | "default" | |
951 | "downto" | |
952 | "elseif" | |
953 | "else" | |
954 | "endfor" | |
955 | "endif" | |
956 | "endswitch" | |
957 | "endwhile" | |
958 | "end" | |
959 | "exit" | |
960 | "external" | |
961 | "for" | |
962 | "function" | |
963 | ;; "goto" -- handled elsewhere | |
964 | "if" | |
965 | "program" | |
966 | "prototype" | |
967 | "repeat" | |
968 | "return" | |
969 | "step" | |
970 | "switch" | |
971 | "then" | |
972 | "to" | |
973 | "typedef" | |
974 | "until" | |
975 | "void" | |
976 | "while") | |
ef1c5063 RS |
977 | "Statement keywords used in InstallShield 3 and 5.") |
978 | ||
82e38f3e LK |
979 | (defconst installshield-system-functions-list |
980 | '("AddFolderIcon" | |
981 | "AddProfString" | |
982 | "AddressString" | |
983 | "AppCommand" | |
984 | "AskDestPath" | |
985 | "AskOptions" | |
986 | "AskPath" | |
987 | "AskText" | |
988 | "AskYesNo" | |
989 | "BatchDeleteEx" | |
990 | "BatchFileLoad" | |
991 | "BatchFileSave" | |
992 | "BatchFind" | |
993 | "BatchGetFileName" | |
994 | "BatchMoveEx" | |
995 | "BatchSetFileName" | |
996 | "ChangeDirectory" | |
997 | "CloseFile" | |
998 | "CmdGetHwndDlg" | |
999 | "ComponentAddItem" ; differs between IS3 and IS5 | |
1000 | "ComponentCompareSizeRequired" ; IS5 only | |
1001 | "ComponentDialog" | |
1002 | "ComponentError" ; IS5 only | |
1003 | "ComponentFileEnum" ; IS5 only | |
1004 | "ComponentFileInfo" ; IS5 only | |
1005 | "ComponentFilterLanguage" ; IS5 only | |
1006 | "ComponentFilterOS" ; IS5 only | |
1007 | "ComponentGetData" ; IS5 only | |
1008 | "ComponentGetItemInfo" ; IS3 only | |
1009 | "ComponentGetItemSize" ; differs between IS3 and IS5 | |
1010 | "ComponentIsItemSelected" ; differs between IS3 and IS5 | |
1011 | "ComponentListItems" | |
1012 | "ComponentMoveData" ; IS5 only | |
1013 | "ComponentSelectItem" ; differs between IS3 and IS5 | |
1014 | "ComponentSetData" ; IS5 only | |
1015 | "ComponentSetItemInfo" ; IS3 only | |
1016 | "ComponentSetTarget" ; IS5 only | |
1017 | "ComponentSetupTypeEnum" ; IS5 only | |
1018 | "ComponentSetupTypeGetData" ; IS5 only | |
1019 | "ComponentSetupTypeSet" ; IS5 only | |
1020 | "ComponentTotalSize" | |
1021 | "ComponentValidate" ; IS5 only | |
1022 | "CompressAdd" ; IS3 only | |
1023 | "CompressDel" ; IS3 only | |
1024 | "CompressEnum" ; IS3 only | |
1025 | "CompressGet" ; IS3 only | |
1026 | "CompressInfo" ; IS3 only | |
1027 | "CopyFile" | |
1028 | "CreateDir" | |
1029 | "CreateFile" | |
1030 | "CreateProgramFolder" | |
1031 | "DeinstallSetReference" ; IS5 only | |
1032 | "DeinstallStart" | |
1033 | "Delay" | |
1034 | "DeleteDir" | |
1035 | "DeleteFile" | |
1036 | "DialogSetInfo" | |
1037 | "Disable" | |
1038 | "DoInstall" | |
1039 | "Do" | |
1040 | "Enable" | |
1041 | "EnterDisk" | |
1042 | "ExistsDir" | |
1043 | "ExistsDisk" | |
1044 | "ExitProgMan" | |
1045 | "EzBatchAddPath" | |
1046 | "EzBatchAddString" | |
1047 | "EzBatchReplace" | |
1048 | "EzConfigAddDriver" | |
1049 | "EzConfigAddString" | |
1050 | "EzConfigGetValue" | |
1051 | "EzConfigSetValue" | |
1052 | "EzDefineDialog" | |
1053 | "FileCompare" | |
1054 | "FileDeleteLine" | |
1055 | "FileGrep" | |
1056 | "FileInsertLine" | |
1057 | "FileSetBeginDefine" ; IS3 only | |
1058 | "FileSetEndDefine" ; IS3 only | |
1059 | "FileSetPerformEz" ; IS3 only | |
1060 | "FileSetPerform" ; IS3 only | |
1061 | "FileSetReset" ; IS3 only | |
1062 | "FileSetRoot" ; IS3 only | |
1063 | "FindAllDirs" | |
1064 | "FindAllFiles" | |
1065 | "FindFile" | |
1066 | "FindWindow" | |
1067 | "GetDiskSpace" | |
1068 | "GetDisk" | |
1069 | "GetEnvVar" | |
1070 | "GetExtents" | |
1071 | "GetFileInfo" | |
1072 | "GetLine" | |
1073 | "GetProfInt" | |
1074 | "GetProfString" | |
1075 | "GetSystemInfo" | |
1076 | "GetValidDrivesList" | |
1077 | "GetVersion" | |
1078 | "GetWindowHandle" | |
1079 | "InstallationInfo" | |
1080 | "Is" | |
1081 | "LaunchApp" | |
1082 | "LaunchAppAndWait" | |
1083 | "ListAddItem" | |
1084 | "ListAddString" | |
1085 | "ListCount" | |
1086 | "ListCreate" | |
1087 | "ListDestroy" | |
1088 | "ListFindItem" | |
1089 | "ListFindString" | |
1090 | "ListGetFirstItem" | |
1091 | "ListGetFirstString" | |
1092 | "ListGetNextItem" | |
1093 | "ListGetNextString" | |
1094 | "ListReadFromFile" | |
1095 | "ListSetCurrentItem" | |
1096 | "ListSetNextItem" | |
1097 | "ListSetNextString" | |
1098 | "ListSetIndex" | |
1099 | "ListWriteToFile" | |
1100 | "LongPathToQuote" | |
1101 | "LongPathToShortPath" | |
1102 | "MessageBox" | |
1103 | "NumToStr" | |
1104 | "OpenFileMode" | |
1105 | "OpenFile" | |
1106 | "ParsePath" | |
1107 | "PathAdd" | |
1108 | "PathDelete" | |
1109 | "PathFind" | |
1110 | "PathGet" | |
1111 | "PathMove" | |
1112 | "PathSet" | |
1113 | "Path" | |
1114 | "PlaceBitmap" | |
1115 | "PlaceWindow" | |
1116 | "PlayMMedia" ; IS5 only | |
1117 | "ProgDefGroupType" | |
1118 | "RegDBCreateKeyEx" | |
1119 | "RegDBDeleteValue" | |
1120 | "RegDBGetItem" | |
1121 | "RegDBKeyExist" | |
1122 | "RegDBSetItem" | |
1123 | "RegDBGetKeyValueEx" | |
1124 | "RegDBSetKeyValueEx" | |
1125 | "RegDBSetDefaultRoot" | |
1126 | "RenameFile" | |
1127 | "ReplaceFolderIcon" | |
1128 | "ReplaceProfString" | |
1129 | "SdAskDestPath" | |
1130 | "SdAskOptions" | |
1131 | "SdAskOptionsList" | |
1132 | "SdBitmap" | |
1133 | "SdCloseDlg" | |
1134 | "SdComponentAdvCheckSpace" | |
1135 | "SdComponentAdvInit" | |
1136 | "SdComponentAdvUpdateSpace" | |
1137 | "SdComponentDialog" | |
1138 | "SdComponentDialog2" | |
1139 | "SdComponentDialogAdv" | |
1140 | "SdComponentDialogEx" | |
1141 | "SdComponentDlgCheckSpace" | |
1142 | "SdComponentMult" | |
1143 | "SdConfirmNewDir" | |
1144 | "SdConfirmRegistration" | |
1145 | "SdDiskSpace" | |
1146 | "SdDisplayTopics" | |
1147 | "SdDoStdButton" | |
1148 | "SdEnablement" | |
1149 | "SdError" | |
1150 | "SdFinish" | |
1151 | "SdFinishInit32" | |
1152 | "SdFinishReboot" | |
1153 | "SdGeneralInit" | |
1154 | "SdGetItemName" | |
1155 | "SdGetTextExtent" | |
1156 | "SdGetUserCompanyInfo" | |
1157 | "SdInit" | |
1158 | "SdIsShellExplorer" | |
1159 | "SdIsStdButton" | |
1160 | "SdLicense" | |
1161 | "SdMakeName" | |
1162 | "SdOptionInit" | |
1163 | "SdOptionSetState" | |
1164 | "SdOptionsButtons" | |
1165 | "SdOptionsButtonsInit" | |
1166 | "SdPlugInProductName" | |
1167 | "SdProductName" | |
1168 | "SdRegEnableButton" | |
1169 | "SdRegExEnableButton" | |
1170 | "SdRegisterUser" | |
1171 | "SdRegisterUserEx" | |
1172 | "SdRemoveEndSpace" | |
1173 | "SdSelectFolder" | |
1174 | "SdSetSequentialItems" | |
1175 | "SdSetStatic" | |
1176 | "SdSetupTypeEx" ; IS5 only | |
1177 | "SdSetupType" | |
1178 | "SdShowAnyDialog" | |
1179 | "SdShowDlgEdit1" | |
1180 | "SdShowDlgEdit2" | |
1181 | "SdShowDlgEdit3" | |
1182 | "SdShowFileMods" | |
1183 | "SdShowInfoList" | |
1184 | "SdShowMsg" | |
1185 | "SdStartCopy" | |
1186 | "SdUnInit" | |
1187 | "SdUpdateComponentSelection" | |
1188 | "SdWelcome" | |
1189 | "SendMessage" | |
1190 | "SetColor" | |
1191 | "SetFont" | |
1192 | "SetDialogTitle" | |
1193 | "SetDisplayEffect" ; IS5 only | |
1194 | "SetFileInfo" | |
1195 | "SetForegroundWindow" | |
1196 | "SetStatusWindow" | |
1197 | "SetTitle" | |
1198 | "SetupType" | |
1199 | "ShowProgramFolder" | |
1200 | "Split" ; IS3 only | |
1201 | "SprintfBox" | |
1202 | "Sprintf" | |
1203 | "StatusUpdate" | |
1204 | "StrCompare" | |
1205 | "StrFind" | |
1206 | "StrGetTokens" | |
1207 | "StrLength" | |
1208 | "StrRemoveLastSlash" | |
1209 | "StrToLower" | |
1210 | "StrToNum" | |
1211 | "StrToUpper" | |
1212 | "StrSub" | |
1213 | "VarRestore" | |
1214 | "VarSave" | |
1215 | "VerCompare" | |
1216 | "VerGetFileVersion" | |
1217 | "WaitOnDialog" | |
1218 | "Welcome" | |
1219 | "WriteLine" | |
1220 | "WriteProfString" | |
1221 | "XCopyFile") | |
ef1c5063 RS |
1222 | "System functions defined in InstallShield 3 and 5.") |
1223 | ||
82e38f3e LK |
1224 | (defconst installshield-system-variables-list |
1225 | '("BATCH_INSTALL" | |
1226 | "CMDLINE" | |
1227 | "COMMONFILES" | |
1228 | "CORECOMPONENTHANDLING" | |
1229 | "DIALOGCACHE" | |
1230 | "ERRORFILENAME" | |
1231 | "FOLDER_DESKTOP" | |
1232 | "FOLDER_PROGRAMS" | |
1233 | "FOLDER_STARTMENU" | |
1234 | "FOLDER_STARTUP" | |
1235 | "INFOFILENAME" | |
1236 | "ISRES" | |
1237 | "ISUSER" | |
1238 | "ISVERSION" | |
1239 | "MEDIA" | |
1240 | "MODE" | |
1241 | "PROGRAMFILES" | |
1242 | "SELECTED_LANGUAGE" | |
1243 | "SRCDIR" | |
1244 | "SRCDISK" | |
1245 | "SUPPORTDIR" | |
1246 | "TARGETDIR" | |
1247 | "TARGETDISK" | |
1248 | "UNINST" | |
1249 | "WINDIR" | |
1250 | "WINDISK" | |
1251 | "WINMAJOR" | |
1252 | "WINSYSDIR" | |
1253 | "WINSYSDISK") | |
ef1c5063 RS |
1254 | "System variables used in InstallShield 3 and 5.") |
1255 | ||
82e38f3e LK |
1256 | (defconst installshield-types-list |
1257 | '("BOOL" | |
1258 | "BYREF" | |
1259 | "CHAR" | |
1260 | "HIWORD" | |
1261 | "HWND" | |
1262 | "INT" | |
1263 | "LIST" | |
1264 | "LONG" | |
1265 | "LOWORD" | |
1266 | "LPSTR" | |
1267 | "NUMBER" | |
1268 | "NUMBERLIST" | |
1269 | "POINTER" | |
1270 | "QUAD" | |
1271 | "RGB" | |
1272 | "SHORT" | |
1273 | "STRINGLIST" | |
1274 | "STRING") | |
ef1c5063 RS |
1275 | "Type keywords used in InstallShield 3 and 5.") |
1276 | ||
1277 | ;;; some might want to skip highlighting these to improve performance | |
82e38f3e LK |
1278 | (defconst installshield-funarg-constants-list |
1279 | '("AFTER" | |
1280 | "APPEND" | |
1281 | "ALLCONTENTS" | |
1282 | "BACKBUTTON" | |
1283 | "BACKGROUNDCAPTION" | |
1284 | "BACKGROUND" | |
1285 | "BACK" | |
1286 | "BASEMEMORY" | |
1287 | "BEFORE" | |
1288 | "BIOS" | |
1289 | "BITMAPICON" | |
1290 | "BK_BLUE" | |
1291 | "BK_GREEN" | |
1292 | "BK_RED" | |
1293 | "BLUE" | |
1294 | "BOOTUPDRIVE" | |
1295 | "CANCEL" | |
1296 | "CDROM_DRIVE" | |
1297 | "CDROM" | |
1298 | "CHECKBOX95" | |
1299 | "CHECKBOX" | |
1300 | "CHECKLINE" | |
1301 | "CHECKMARK" | |
1302 | "COLORS" | |
1303 | "COMMANDEX" | |
1304 | "COMMAND" | |
1305 | "COMP_NORMAL" | |
1306 | "COMP_UPDATE_DATE" | |
1307 | "COMP_UPDATE_SAME" | |
1308 | "COMP_UPDATE_VERSION" | |
1309 | "COMPACT" | |
1310 | "CONTINUE" | |
1311 | "CPU" | |
1312 | "CUSTOM" | |
1313 | "DATE" | |
1314 | "DEFWINDOWMODE" | |
1315 | "DIR_WRITEABLE" | |
1316 | "DIRECTORY" | |
1317 | "DISABLE" | |
1318 | "DISK_TOTALSPACE" | |
1319 | "DISK" | |
1320 | "DLG_OPTIONS" | |
1321 | "DLG_PATH" | |
1322 | "DLG_TEXT" | |
1323 | "DLG_ASK_YESNO" | |
1324 | "DLG_ENTER_DISK" | |
1325 | "DLG_ERR" | |
1326 | "DLG_INFO_ALTIMAGE" | |
1327 | "DLG_INFO_CHECKSELECTION" | |
1328 | "DLG_INFO_KUNITS" | |
1329 | "DLG_INFO_USEDECIMAL" | |
1330 | "DLG_MSG_INFORMATION" | |
1331 | "DLG_MSG_SEVERE" | |
1332 | "DLG_MSG_WARNING" | |
1333 | "DLG_STATUS" | |
1334 | "DLG_WARNING" | |
1335 | "DLG_USER_CAPTION" | |
1336 | "DRIVE" | |
1337 | "ENABLE" | |
1338 | "END_OF_FILE" | |
1339 | "END_OF_LIST" | |
1340 | "ENVSPACE" | |
1341 | "EQUALS" | |
1342 | "EXCLUDE_SUBDIR" | |
1343 | "EXCLUSIVE" | |
1344 | "EXISTS" | |
1345 | "EXIT" | |
1346 | "EXTENDED_MEMORY" | |
1347 | "EXTENSION_ONLY" | |
1348 | "FAILIFEXISTS" | |
1349 | "FALSE" | |
1350 | "FEEDBACK_FULL" | |
1351 | "FILE_ATTR_ARCHIVED" | |
1352 | "FILE_ATTR_DIRECTORY" | |
1353 | "FILE_ATTR_HIDDEN" | |
1354 | "FILE_ATTR_NORMAL" | |
1355 | "FILE_ATTR_READONLY" | |
1356 | "FILE_ATTR_SYSTEM" | |
1357 | "FILE_ATTRIBUTE" | |
1358 | "FILE_DATE" | |
1359 | "FILE_LINE_LENGTH" | |
1360 | "FILE_MODE_APPEND" | |
1361 | "FILE_MODE_BINARYREADONLY" | |
1362 | "FILE_MODE_BINARY" | |
1363 | "FILE_MODE_NORMAL" | |
1364 | "FILE_NO_VERSION" | |
1365 | "FILE_NOT_FOUND" | |
1366 | "FILE_SIZE" | |
1367 | "FILE_TIME" | |
1368 | "FILENAME_ONLY" | |
1369 | "FILENAME" | |
1370 | "FIXED_DRIVE" | |
1371 | "FOLDER_DESKTOP" | |
1372 | "FOLDER_PROGRAMS" | |
1373 | "FOLDER_STARTMENU" | |
1374 | "FOLDER_STARTUP" | |
1375 | "FREEENVSPACE" | |
1376 | "FULLWINDOWMODE" | |
1377 | "FULL" | |
1378 | "FONT_TITLE" | |
1379 | "GREATER_THAN" | |
1380 | "GREEN" | |
1381 | "HKEY_CLASSES_ROOT" | |
1382 | "HKEY_CURRENT_USER" | |
1383 | "HKEY_LOCAL_MACHINE" | |
1384 | "HKEY_USERS" | |
1385 | "HOURGLASS" | |
1386 | "INCLUDE_SUBDIR" | |
1387 | "INDVFILESTATUS" | |
1388 | "INFORMATION" | |
1389 | "IS_WINDOWSNT" | |
1390 | "IS_WINDOWS95" | |
1391 | "IS_WINDOWS" | |
1392 | "IS_WIN32S" | |
1393 | "ISTYPE" | |
1394 | "LANGUAGE_DRV" | |
1395 | "LANGUAGE" | |
1396 | "LESS_THAN" | |
1397 | "LIST_NULL" | |
1398 | "LISTFIRST" | |
1399 | "LISTNEXT" | |
1400 | "LOCKEDFILE" | |
1401 | "LOGGING" | |
1402 | "LOWER_LEFT" | |
1403 | "LOWER_RIGHT" | |
1404 | "MAGENTA" | |
1405 | "MOUSE_DRV" | |
1406 | "MOUSE" | |
1407 | "NETWORK_DRV" | |
1408 | "NETWORK" | |
1409 | "NEXT" | |
1410 | "NONEXCLUSIVE" | |
1411 | "NORMALMODE" | |
1412 | "NOSET" | |
1413 | "NOTEXISTS" | |
1414 | "NOWAIT" | |
1415 | "NO" | |
1416 | "OFF" | |
1417 | "ONLYDIR" | |
1418 | "ON" | |
1419 | "OSMAJOR" | |
1420 | "OSMINOR" | |
1421 | "OS" | |
1422 | "OTHER_FAILURE" | |
1423 | "PARALLEL" | |
1424 | "PARTIAL" | |
1425 | "PATH_EXISTS" | |
1426 | "PATH" | |
1427 | "RED" | |
1428 | "REGDB_APPPATH_DEFAULT" | |
1429 | "REGDB_APPPATH" | |
1430 | "REGDB_BINARY" | |
1431 | "REGDB_ERR_CONNECTIONEXISTS" | |
1432 | "REGDB_ERR_CORRUPTEDREGSITRY" | |
1433 | "REGDB_ERR_INITIALIZATION" | |
1434 | "REGDB_ERR_INVALIDHANDLE" | |
1435 | "REGDB_ERR_INVALIDNAME" | |
1436 | "REGDB_NUMBER" | |
1437 | "REGDB_STRING_EXPAND" | |
1438 | "REGDB_STRING_MULTI" | |
1439 | "REGDB_STRING" | |
1440 | "REGDB_UNINSTALL_NAME" | |
1441 | "REMOTE_DRIVE" | |
1442 | "REMOVALE_DRIVE" | |
1443 | "REPLACE_ITEM" | |
1444 | "REPLACE" | |
1445 | "RESET" | |
1446 | "RESTART" | |
1447 | "ROOT" | |
1448 | "SELFREGISTER" | |
1449 | "SERIAL" | |
1450 | "SET" | |
1451 | "SEVERE" | |
1452 | "SHAREDFILE" | |
1453 | "SHARE" | |
1454 | "SILENTMODE" | |
1455 | "SRCTARGETDIR" | |
1456 | "STATUSBAR" | |
1457 | "STATUSDLG" | |
1458 | "STATUSOLD" | |
1459 | "STATUS" | |
1460 | "STYLE_NORMAL" | |
1461 | "SW_MAXIMIZE" | |
1462 | "SW_MINIMIZE" | |
1463 | "SW_RESTORE" | |
1464 | "SW_SHOW" | |
1465 | "SYS_BOOTMACHINE" | |
1466 | "TIME" | |
1467 | "TRUE" | |
1468 | "TYPICAL" | |
1469 | "UPPER_LEFT" | |
1470 | "UPPER_RIGHT" | |
1471 | "VALID_PATH" | |
1472 | "VERSION" | |
1473 | "VIDEO" | |
1474 | "VOLUMELABEL" | |
1475 | "YELLOW" | |
1476 | "YES" | |
1477 | "WAIT" | |
1478 | "WARNING" | |
1479 | "WINMAJOR" | |
1480 | "WINMINOR" | |
1481 | "WIN32SINSTALLED" | |
1482 | "WIN32SMAJOR" | |
1483 | "WIN32SMINOR") | |
1484 | "Function argument constants used in InstallShield 3 and 5.")) | |
ca1e63a5 | 1485 | |
d8677156 | 1486 | (defvar rul-generic-mode-syntax-table nil |
1fffafda | 1487 | "Syntax table to use in `rul-generic-mode' buffers.") |
d8677156 LK |
1488 | |
1489 | (setq rul-generic-mode-syntax-table | |
1490 | (make-syntax-table c++-mode-syntax-table)) | |
1491 | ||
82e38f3e LK |
1492 | (modify-syntax-entry ?\r "> b" rul-generic-mode-syntax-table) |
1493 | (modify-syntax-entry ?\n "> b" rul-generic-mode-syntax-table) | |
d8677156 LK |
1494 | |
1495 | (modify-syntax-entry ?/ ". 124b" rul-generic-mode-syntax-table) | |
1496 | (modify-syntax-entry ?* ". 23" rul-generic-mode-syntax-table) | |
1497 | ||
1498 | ;; here manually instead | |
1499 | (defun generic-rul-mode-setup-function () | |
82e38f3e LK |
1500 | (make-local-variable 'parse-sexp-ignore-comments) |
1501 | (make-local-variable 'comment-start) | |
1502 | (make-local-variable 'comment-start-skip) | |
1503 | (make-local-variable 'comment-end) | |
d8677156 LK |
1504 | (setq imenu-generic-expression |
1505 | '((nil "^function\\s-+\\([A-Za-z0-9_]+\\)" 1)) | |
1506 | parse-sexp-ignore-comments t | |
1507 | comment-end "*/" | |
1508 | comment-start "/*" | |
1509 | ;;; comment-end "" | |
1510 | ;;; comment-start "//" | |
1511 | ;;; comment-start-skip "" | |
1512 | ) | |
82e38f3e | 1513 | ;; (set-syntax-table rul-generic-mode-syntax-table) |
d8677156 LK |
1514 | (setq font-lock-syntax-table rul-generic-mode-syntax-table)) |
1515 | ||
1516 | ;; moved mode-definition behind defun-definition to be warning-free - 15.11.02/RSan | |
1517 | (define-generic-mode rul-generic-mode | |
1518 | ;; Using "/*" and "*/" doesn't seem to be working right | |
82e38f3e LK |
1519 | '("//" ("/*" . "*/" )) |
1520 | (eval-when-compile installshield-statement-keyword-list) | |
1521 | (eval-when-compile | |
1522 | (list | |
1523 | ;; preprocessor constructs | |
1524 | '("#[ \t]*include[ \t]+\\(<[^>\"\n]+>\\)" | |
1525 | 1 font-lock-string-face) | |
1526 | '("#[ \t]*\\(\\sw+\\)\\>[ \t]*\\(\\sw+\\)?" | |
1527 | (1 font-lock-reference-face) | |
1528 | (2 font-lock-variable-name-face nil t)) | |
1529 | ;; indirect string constants | |
1530 | '("\\(@[A-Za-z][A-Za-z0-9_]+\\)" 1 font-lock-builtin-face) | |
1531 | ;; gotos | |
1532 | '("[ \t]*\\(\\sw+:\\)" 1 font-lock-reference-face) | |
1533 | '("\\<\\(goto\\)\\>[ \t]*\\(\\sw+\\)?" | |
1534 | (1 font-lock-keyword-face) | |
1535 | (2 font-lock-reference-face nil t)) | |
1536 | ;; system variables | |
1537 | (generic-make-keywords-list | |
1538 | installshield-system-variables-list | |
16a013c2 | 1539 | font-lock-variable-name-face "[^_]" "[^_]") |
82e38f3e LK |
1540 | ;; system functions |
1541 | (generic-make-keywords-list | |
1542 | installshield-system-functions-list | |
16a013c2 | 1543 | font-lock-function-name-face "[^_]" "[^_]") |
82e38f3e LK |
1544 | ;; type keywords |
1545 | (generic-make-keywords-list | |
1546 | installshield-types-list | |
16a013c2 | 1547 | font-lock-type-face "[^_]" "[^_]") |
82e38f3e LK |
1548 | ;; function argument constants |
1549 | (generic-make-keywords-list | |
1550 | installshield-funarg-constants-list | |
16a013c2 | 1551 | font-lock-variable-name-face "[^_]" "[^_]"))) ; is this face the best choice? |
60c19d5e | 1552 | '("\\.[rR][uU][lL]\\'") |
82e38f3e | 1553 | '(generic-rul-mode-setup-function) |
d4fb185d | 1554 | "Generic mode for InstallShield RUL files.") |
d8677156 | 1555 | |
ca1e63a5 | 1556 | (define-skeleton rul-if |
d8677156 LK |
1557 | "Insert an if statement." |
1558 | "condition: " | |
1559 | "if(" str ") then" \n | |
1560 | > _ \n | |
1561 | ( "other condition, %s: " | |
1562 | > "elseif(" str ") then" \n | |
1563 | > \n) | |
1564 | > "else" \n | |
1565 | > \n | |
1566 | resume: | |
1567 | > "endif;") | |
ca1e63a5 RS |
1568 | |
1569 | (define-skeleton rul-function | |
1570 | "Insert a function statement." | |
1571 | "function: " | |
1572 | "function " str " ()" \n | |
1573 | ( "local variables, %s: " | |
d8677156 | 1574 | > " " str ";" \n) |
ca1e63a5 RS |
1575 | > "begin" \n |
1576 | > _ \n | |
1577 | resume: | |
d8677156 | 1578 | > "end;")) |
ca1e63a5 RS |
1579 | |
1580 | ;; Additions by ACorreir@pervasive-sw.com (Alfred Correira) | |
1fffafda LK |
1581 | (when (memq 'mailrc-generic-mode generic-extras-enable-list) |
1582 | ||
d8677156 | 1583 | (define-generic-mode mailrc-generic-mode |
82e38f3e LK |
1584 | '(?#) |
1585 | '("alias" | |
1586 | "else" | |
1587 | "endif" | |
1588 | "group" | |
1589 | "if" | |
1590 | "ignore" | |
1591 | "set" | |
1592 | "source" | |
1593 | "unset") | |
ca1e63a5 | 1594 | '(("^\\s-*\\(alias\\|group\\)\\s-+\\([-A-Za-z0-9_]+\\)\\s-+\\([^\n\r#]*\\)\\(#.*\\)?$" |
16a013c2 LK |
1595 | (2 font-lock-constant-face) |
1596 | (3 font-lock-variable-name-face)) | |
ca1e63a5 | 1597 | ("^\\s-*\\(unset\\|set\\|ignore\\)\\s-+\\([-A-Za-z0-9_]+\\)=?\\([^\n\r#]*\\)\\(#.*\\)?$" |
16a013c2 LK |
1598 | (2 font-lock-constant-face) |
1599 | (3 font-lock-variable-name-face)) | |
5d1c5247 FP |
1600 | ("^\\s-*\\(source\\)\\s-+\\([^\n\r#]*\\)\\(#.*\\)?$" |
1601 | (2 font-lock-variable-name-face))) | |
82e38f3e | 1602 | '("\\.mailrc\\'") |
ca1e63a5 | 1603 | nil |
d4fb185d | 1604 | "Mode for mailrc files.")) |
ca1e63a5 | 1605 | |
bb53e1ee | 1606 | ;; Inetd.conf |
d8677156 | 1607 | (when (memq 'inetd-conf-generic-mode generic-extras-enable-list) |
bb53e1ee | 1608 | |
d8677156 | 1609 | (define-generic-mode inetd-conf-generic-mode |
82e38f3e LK |
1610 | '(?#) |
1611 | '("stream" | |
1612 | "dgram" | |
1613 | "tcp" | |
1614 | "udp" | |
1615 | "wait" | |
1616 | "nowait" | |
1617 | "internal") | |
1618 | '(("^\\([-A-Za-z0-9_]+\\)" 1 font-lock-type-face)) | |
bb53e1ee | 1619 | '("/etc/inetd.conf\\'") |
ffe0c7ef | 1620 | (list |
bb53e1ee RS |
1621 | (function |
1622 | (lambda () | |
ffe0c7ef | 1623 | (setq imenu-generic-expression |
d4fb185d | 1624 | '((nil "^\\([-A-Za-z0-9_]+\\)" 1)))))))) |
bb53e1ee RS |
1625 | |
1626 | ;; Services | |
d8677156 | 1627 | (when (memq 'etc-services-generic-mode generic-extras-enable-list) |
bb53e1ee | 1628 | |
d8677156 | 1629 | (define-generic-mode etc-services-generic-mode |
82e38f3e LK |
1630 | '(?#) |
1631 | '("tcp" | |
1632 | "udp" | |
1633 | "ddp") | |
d8677156 | 1634 | '(("^\\([-A-Za-z0-9_]+\\)\\s-+\\([0-9]+\\)/" |
82e38f3e LK |
1635 | (1 font-lock-type-face) |
1636 | (2 font-lock-variable-name-face))) | |
bb53e1ee | 1637 | '("/etc/services\\'") |
ffe0c7ef | 1638 | (list |
bb53e1ee RS |
1639 | (function |
1640 | (lambda () | |
ffe0c7ef | 1641 | (setq imenu-generic-expression |
d4fb185d | 1642 | '((nil "^\\([-A-Za-z0-9_]+\\)" 1)))))))) |
bb53e1ee RS |
1643 | |
1644 | ;; Password and Group files | |
d8677156 | 1645 | (when (memq 'etc-passwd-generic-mode generic-extras-enable-list) |
bb53e1ee | 1646 | |
d8677156 | 1647 | (define-generic-mode etc-passwd-generic-mode |
bb53e1ee | 1648 | nil ;; No comment characters |
82e38f3e LK |
1649 | '("root") ;; Only one keyword |
1650 | (eval-when-compile | |
1651 | (list | |
1652 | (list | |
1653 | (concat | |
1654 | "^" | |
1655 | ;; User name -- Never blank! | |
1656 | "\\([^:]+\\)" | |
1657 | ":" | |
1658 | ;; Password, UID and GID | |
1659 | (mapconcat | |
1660 | 'identity | |
1661 | (make-list 3 "\\([^:]+\\)") | |
1662 | ":") | |
1663 | ":" | |
1664 | ;; GECOS/Name -- might be blank | |
1665 | "\\([^:]*\\)" | |
1666 | ":" | |
1667 | ;; Home directory and shell | |
1668 | "\\([^:]+\\)" | |
1669 | ":?" | |
1670 | "\\([^:]*\\)" | |
1671 | "$") | |
1672 | '(1 font-lock-type-face) | |
1673 | '(5 font-lock-variable-name-face) | |
1674 | '(6 font-lock-constant-face) | |
1675 | '(7 font-lock-warning-face)) | |
1676 | '("^\\([^:]+\\):\\([^:]*\\):\\([0-9]+\\):\\(.*\\)$" | |
1677 | (1 font-lock-type-face) | |
1678 | (4 font-lock-variable-name-face)))) | |
bb53e1ee | 1679 | '("/etc/passwd\\'" "/etc/group\\'") |
ffe0c7ef | 1680 | (list |
bb53e1ee RS |
1681 | (function |
1682 | (lambda () | |
ffe0c7ef | 1683 | (setq imenu-generic-expression |
d4fb185d | 1684 | '((nil "^\\([-A-Za-z0-9_]+\\):" 1)))))))) |
bb53e1ee | 1685 | |
7aeb9d6f | 1686 | ;; Fstab |
d8677156 | 1687 | (when (memq 'etc-fstab-generic-mode generic-extras-enable-list) |
7aeb9d6f | 1688 | |
d8677156 | 1689 | (define-generic-mode etc-fstab-generic-mode |
82e38f3e LK |
1690 | '(?#) |
1691 | '("adfs" | |
1692 | "affs" | |
1693 | "autofs" | |
1694 | "coda" | |
1695 | "coherent" | |
1696 | "cramfs" | |
1697 | "devpts" | |
1698 | "efs" | |
1699 | "ext2" | |
1700 | "ext3" | |
1701 | "hfs" | |
1702 | "hpfs" | |
1703 | "iso9660" | |
1704 | "jfs" | |
1705 | "minix" | |
1706 | "msdos" | |
1707 | "ncpfs" | |
1708 | "nfs" | |
1709 | "ntfs" | |
1710 | "proc" | |
1711 | "qnx4" | |
1712 | "reiserfs" | |
1713 | "romfs" | |
1714 | "smbfs" | |
3e54ab6c LH |
1715 | "cifs" |
1716 | "usbdevfs" | |
82e38f3e LK |
1717 | "sysv" |
1718 | "tmpfs" | |
1719 | "udf" | |
1720 | "ufs" | |
1721 | "umsdos" | |
1722 | "vfat" | |
1723 | "xenix" | |
1724 | "xfs" | |
1725 | "swap" | |
1726 | "auto" | |
1727 | "ignore") | |
3e54ab6c | 1728 | '(("^\\([^# \t]+\\)\\s-+\\([^# \t]+\\)" |
60c19d5e LK |
1729 | (1 font-lock-type-face t) |
1730 | (2 font-lock-variable-name-face t))) | |
7aeb9d6f PB |
1731 | '("/etc/[v]*fstab\\'") |
1732 | (list | |
1733 | (function | |
1734 | (lambda () | |
1735 | (setq imenu-generic-expression | |
3e54ab6c | 1736 | '((nil "^\\([^# \t]+\\)\\s-+" 1)))))))) |
bb53e1ee | 1737 | |
5f33ef98 RS |
1738 | ;; /etc/sudoers |
1739 | (when (memq 'etc-sudoers-generic-mode generic-extras-enable-list) | |
1740 | ||
1741 | (define-generic-mode etc-sudoers-generic-mode | |
1742 | '(?#) | |
1743 | '("User_Alias" "Runas_Alias" "Host_Alias" "Cmnd_Alias" | |
1744 | "NOPASSWD" "PASSWD" "NOEXEC" "EXEC" | |
1745 | "ALL") | |
1746 | '(("\\<\\(root\\|su\\)\\>" 1 font-lock-warning-face) | |
1747 | ("\\(\\*\\)" 1 font-lock-warning-face) | |
1748 | ("\\<\\(%[A-Za-z0-9_]+\\)\\>" 1 font-lock-variable-name-face)) | |
1749 | '("/etc/sudoers\\'") | |
1750 | nil | |
1751 | "Generic mode for sudoers configuration files.")) | |
1752 | ||
bb53e1ee | 1753 | ;; From Jacques Duthen <jacques.duthen@sncf.fr> |
1fffafda LK |
1754 | (when (memq 'show-tabs-generic-mode generic-extras-enable-list) |
1755 | ||
16a013c2 LK |
1756 | (eval-when-compile |
1757 | ||
1758 | (defconst show-tabs-generic-mode-font-lock-defaults-1 | |
82e38f3e | 1759 | '(;; trailing spaces must come before... |
f0b3dcbf | 1760 | ("[ \t]+$" . 'show-tabs-space) |
d8677156 | 1761 | ;; ...embedded tabs |
f0b3dcbf | 1762 | ("[^\n\t]\\(\t+\\)" (1 'show-tabs-tab)))) |
bb53e1ee | 1763 | |
16a013c2 | 1764 | (defconst show-tabs-generic-mode-font-lock-defaults-2 |
82e38f3e | 1765 | '(;; trailing spaces must come before... |
f0b3dcbf | 1766 | ("[ \t]+$" . 'show-tabs-space) |
d8677156 | 1767 | ;; ...tabs |
f0b3dcbf | 1768 | ("\t+" . 'show-tabs-tab)))) |
bb53e1ee | 1769 | |
f0b3dcbf | 1770 | (defface show-tabs-tab |
16a013c2 LK |
1771 | '((((class grayscale) (background light)) (:background "DimGray" :weight bold)) |
1772 | (((class grayscale) (background dark)) (:background "LightGray" :weight bold)) | |
ea81d57e DN |
1773 | (((class color) (min-colors 88)) (:background "red1")) |
1774 | (((class color)) (:background "red")) | |
1fd714a4 | 1775 | (t (:weight bold))) |
bb53e1ee | 1776 | "Font Lock mode face used to highlight TABs." |
d4fb185d | 1777 | :group 'generic-x) |
f0b3dcbf MB |
1778 | ;; backward-compatibility alias |
1779 | (put 'show-tabs-tab-face 'face-alias 'show-tabs-tab) | |
bb53e1ee | 1780 | |
f0b3dcbf | 1781 | (defface show-tabs-space |
16a013c2 LK |
1782 | '((((class grayscale) (background light)) (:background "DimGray" :weight bold)) |
1783 | (((class grayscale) (background dark)) (:background "LightGray" :weight bold)) | |
ea81d57e DN |
1784 | (((class color) (min-colors 88)) (:background "yellow1")) |
1785 | (((class color)) (:background "yellow")) | |
1fd714a4 | 1786 | (t (:weight bold))) |
bb53e1ee | 1787 | "Font Lock mode face used to highlight spaces." |
d4fb185d | 1788 | :group 'generic-x) |
f0b3dcbf MB |
1789 | ;; backward-compatibility alias |
1790 | (put 'show-tabs-space-face 'face-alias 'show-tabs-space) | |
bb53e1ee | 1791 | |
d8677156 | 1792 | (define-generic-mode show-tabs-generic-mode |
82e38f3e LK |
1793 | nil ;; no comment char |
1794 | nil ;; no keywords | |
16a013c2 | 1795 | (eval-when-compile show-tabs-generic-mode-font-lock-defaults-1) |
82e38f3e LK |
1796 | nil ;; no auto-mode-alist |
1797 | ;; '(show-tabs-generic-mode-hook-fun) | |
bb53e1ee | 1798 | nil |
76ee7bd5 | 1799 | "Generic mode to show tabs and trailing spaces.")) |
bb53e1ee | 1800 | |
ffe0c7ef PB |
1801 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
1802 | ;; DNS modes | |
1803 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
1804 | ||
1fffafda LK |
1805 | (when (memq 'named-boot-generic-mode generic-extras-enable-list) |
1806 | ||
d8677156 LK |
1807 | (define-generic-mode named-boot-generic-mode |
1808 | ;; List of comment characters | |
82e38f3e | 1809 | '(?\;) |
d8677156 | 1810 | ;; List of keywords |
82e38f3e LK |
1811 | '("cache" "primary" "secondary" "forwarders" "limit" "options" |
1812 | "directory" "check-names") | |
d8677156 | 1813 | ;; List of additional font-lock-expressions |
82e38f3e LK |
1814 | '(("\\([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+\\)" 1 font-lock-constant-face) |
1815 | ("^directory\\s-+\\(.*\\)" 1 font-lock-variable-name-face) | |
1816 | ("^\\(primary\\|cache\\)\\s-+\\([.A-Za-z]+\\)\\s-+\\(.*\\)" | |
1817 | (2 font-lock-variable-name-face) | |
1818 | (3 font-lock-constant-face))) | |
d8677156 | 1819 | ;; List of additional automode-alist expressions |
82e38f3e | 1820 | '("/etc/named.boot\\'") |
d8677156 | 1821 | ;; List of set up functions to call |
d4fb185d | 1822 | nil)) |
1fffafda LK |
1823 | |
1824 | (when (memq 'named-database-generic-mode generic-extras-enable-list) | |
ffe0c7ef | 1825 | |
d8677156 LK |
1826 | (define-generic-mode named-database-generic-mode |
1827 | ;; List of comment characters | |
82e38f3e | 1828 | '(?\;) |
d8677156 | 1829 | ;; List of keywords |
82e38f3e | 1830 | '("IN" "NS" "CNAME" "SOA" "PTR" "MX" "A") |
d8677156 | 1831 | ;; List of additional font-lock-expressions |
82e38f3e LK |
1832 | '(("\\([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+\\)" 1 font-lock-constant-face) |
1833 | ("^\\([.A-Za-z0-9]+\\)" 1 font-lock-variable-name-face)) | |
60c19d5e | 1834 | ;; List of additional auto-mode-alist expressions |
ffe0c7ef | 1835 | nil |
d8677156 | 1836 | ;; List of set up functions to call |
d4fb185d | 1837 | nil) |
ffe0c7ef PB |
1838 | |
1839 | (defvar named-database-time-string "%Y%m%d%H" | |
1840 | "Timestring for named serial numbers.") | |
1841 | ||
1842 | (defun named-database-print-serial () | |
1843 | "Print a serial number based on the current date." | |
1844 | (interactive) | |
1fffafda LK |
1845 | (insert (format-time-string named-database-time-string (current-time))))) |
1846 | ||
1847 | (when (memq 'resolve-conf-generic-mode generic-extras-enable-list) | |
ffe0c7ef | 1848 | |
d8677156 LK |
1849 | (define-generic-mode resolve-conf-generic-mode |
1850 | ;; List of comment characters | |
82e38f3e | 1851 | '(?#) |
d8677156 | 1852 | ;; List of keywords |
82e38f3e | 1853 | '("nameserver" "domain" "search" "sortlist" "options") |
d8677156 | 1854 | ;; List of additional font-lock-expressions |
ffe0c7ef | 1855 | nil |
60c19d5e | 1856 | ;; List of additional auto-mode-alist expressions |
82e38f3e | 1857 | '("/etc/resolv[e]?.conf\\'") |
d8677156 | 1858 | ;; List of set up functions to call |
d4fb185d | 1859 | nil)) |
ffe0c7ef PB |
1860 | |
1861 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
1862 | ;; Modes for spice and common electrical engineering circuit netlist formats | |
1863 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
1864 | ||
1fffafda LK |
1865 | (when (memq 'spice-generic-mode generic-extras-enable-list) |
1866 | ||
d8677156 | 1867 | (define-generic-mode spice-generic-mode |
ffe0c7ef | 1868 | nil |
82e38f3e LK |
1869 | '("and" |
1870 | "cccs" | |
1871 | "ccvs" | |
1872 | "delay" | |
1873 | "nand" | |
1874 | "nor" | |
1875 | "npwl" | |
1876 | "or" | |
1877 | "par" | |
1878 | "ppwl" | |
1879 | "pwl" | |
1880 | "vccap" | |
1881 | "vccs" | |
1882 | "vcr" | |
1883 | "vcvs") | |
1884 | '(("^\\s-*\\([*].*\\)" 1 font-lock-comment-face) | |
1885 | (" \\(\\$ .*\\)$" 1 font-lock-comment-face) | |
1886 | ("^\\(\\$ .*\\)$" 1 font-lock-comment-face) | |
1887 | ("\\([*].*\\)" 1 font-lock-comment-face) | |
1888 | ("^\\([+]\\)" 1 font-lock-string-face) | |
1889 | ("^\\s-*\\([.]\\w+\\>\\)" 1 font-lock-keyword-face) | |
1890 | ("\\(\\([.]\\|_\\|\\w\\)+\\)\\s-*=" 1 font-lock-variable-name-face) | |
1891 | ("\\('[^']+'\\)" 1 font-lock-string-face) | |
1892 | ("\\(\"[^\"]+\"\\)" 1 font-lock-string-face)) | |
1893 | '("\\.[sS][pP]\\'" | |
1894 | "\\.[sS][pP][iI]\\'" | |
1895 | "\\.[sS][pP][iI][cC][eE]\\'" | |
1896 | "\\.[iI][nN][cC]\\'") | |
ffe0c7ef PB |
1897 | (list |
1898 | 'generic-bracket-support | |
1899 | ;; Make keywords case-insensitive | |
1900 | (function | |
1901 | (lambda() | |
16a013c2 | 1902 | (setq font-lock-defaults '(generic-font-lock-keywords nil t))))) |
d4fb185d | 1903 | "Generic mode for SPICE circuit netlist files.")) |
1fffafda LK |
1904 | |
1905 | (when (memq 'ibis-generic-mode generic-extras-enable-list) | |
ffe0c7ef | 1906 | |
d8677156 | 1907 | (define-generic-mode ibis-generic-mode |
82e38f3e | 1908 | '(?|) |
ffe0c7ef | 1909 | nil |
82e38f3e LK |
1910 | '(("[[]\\([^]]*\\)[]]" 1 font-lock-keyword-face) |
1911 | ("\\(\\(_\\|\\w\\)+\\)\\s-*=" 1 font-lock-variable-name-face)) | |
1912 | '("\\.[iI][bB][sS]\\'") | |
1913 | '(generic-bracket-support) | |
d4fb185d | 1914 | "Generic mode for IBIS circuit netlist files.")) |
1fffafda LK |
1915 | |
1916 | (when (memq 'astap-generic-mode generic-extras-enable-list) | |
ffe0c7ef | 1917 | |
d8677156 | 1918 | (define-generic-mode astap-generic-mode |
ffe0c7ef | 1919 | nil |
82e38f3e LK |
1920 | '("analyze" |
1921 | "description" | |
1922 | "elements" | |
1923 | "execution" | |
1924 | "features" | |
1925 | "functions" | |
1926 | "ground" | |
1927 | "model" | |
1928 | "outputs" | |
1929 | "print" | |
1930 | "run" | |
1931 | "controls" | |
1932 | "table") | |
1933 | '(("^\\s-*\\([*].*\\)" 1 font-lock-comment-face) | |
1934 | (";\\s-*\\([*].*\\)" 1 font-lock-comment-face) | |
1935 | ("^\\s-*\\([.]\\w+\\>\\)" 1 font-lock-keyword-face) | |
1936 | ("\\('[^']+'\\)" 1 font-lock-string-face) | |
1937 | ("\\(\"[^\"]+\"\\)" 1 font-lock-string-face) | |
1938 | ("[(,]\\s-*\\(\\([.]\\|_\\|\\w\\)+\\)\\s-*=" 1 font-lock-variable-name-face)) | |
1939 | '("\\.[aA][pP]\\'" | |
1940 | "\\.[aA][sS][xX]\\'" | |
1941 | "\\.[aA][sS][tT][aA][pP]\\'" | |
1942 | "\\.[pP][sS][pP]\\'" | |
1943 | "\\.[dD][eE][cC][kK]\\'" | |
1944 | "\\.[gG][oO][dD][aA][tT][aA]") | |
ffe0c7ef PB |
1945 | (list |
1946 | 'generic-bracket-support | |
1947 | ;; Make keywords case-insensitive | |
1948 | (function | |
1949 | (lambda() | |
16a013c2 | 1950 | (setq font-lock-defaults '(generic-font-lock-keywords nil t))))) |
d4fb185d | 1951 | "Generic mode for ASTAP circuit netlist files.")) |
1fffafda LK |
1952 | |
1953 | (when (memq 'etc-modules-conf-generic-mode generic-extras-enable-list) | |
ffe0c7ef | 1954 | |
d8677156 LK |
1955 | (define-generic-mode etc-modules-conf-generic-mode |
1956 | ;; List of comment characters | |
82e38f3e | 1957 | '(?#) |
d8677156 | 1958 | ;; List of keywords |
82e38f3e LK |
1959 | '("above" |
1960 | "alias" | |
1961 | "below" | |
1962 | "define" | |
1963 | "depfile" | |
1964 | "else" | |
1965 | "elseif" | |
1966 | "endif" | |
1967 | "if" | |
1968 | "include" | |
1969 | "insmod_opt" | |
1970 | "install" | |
1971 | "keep" | |
1972 | "options" | |
1973 | "path" | |
1974 | "generic_stringfile" | |
1975 | "pcimapfile" | |
1976 | "isapnpmapfile" | |
1977 | "usbmapfile" | |
1978 | "parportmapfile" | |
1979 | "ieee1394mapfile" | |
1980 | "pnpbiosmapfile" | |
1981 | "probe" | |
1982 | "probeall" | |
1983 | "prune" | |
1984 | "post-install" | |
1985 | "post-remove" | |
1986 | "pre-install" | |
1987 | "pre-remove" | |
1988 | "remove" | |
1989 | "persistdir") | |
d8677156 | 1990 | ;; List of additional font-lock-expressions |
9845e669 | 1991 | nil |
d8677156 | 1992 | ;; List of additional automode-alist expressions |
82e38f3e | 1993 | '("/etc/modules.conf" "/etc/conf.modules") |
d8677156 | 1994 | ;; List of set up functions to call |
d4fb185d | 1995 | nil)) |
ffe0c7ef | 1996 | |
ca1e63a5 RS |
1997 | (provide 'generic-x) |
1998 | ||
cbee283d | 1999 | ;; arch-tag: cde692a5-9ff6-4506-9999-c67999c2bdb5 |
ca1e63a5 | 2000 | ;;; generic-x.el ends here |