Commit | Line | Data |
---|---|---|
1fffafda | 1 | ;;; generic-x.el --- A collection of generic modes |
ca1e63a5 | 2 | |
ba318903 | 3 | ;; Copyright (C) 1997-1998, 2001-2014 Free Software Foundation, Inc. |
ca1e63a5 RS |
4 | |
5 | ;; Author: Peter Breton <pbreton@cs.umb.edu> | |
6 | ;; Created: Tue Oct 08 1996 | |
7 | ;; Keywords: generic, comment, font-lock | |
aad4679e | 8 | ;; Package: emacs |
ca1e63a5 RS |
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 | ;; | |
865fe16f | 31 | ;; Add this line to your init file: |
ca1e63a5 RS |
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 | |
4b8643d3 | 123 | "If non-nil, add a hook to enter `default-generic-mode' automatically. |
9285b8bc LK |
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 | |
4b8643d3 | 130 | "Number of lines that `generic-mode-find-file-hook' looks at. |
9285b8bc LK |
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 "^#" | |
4b8643d3 | 137 | "Regular expression used by `generic-mode-find-file-hook'. |
9285b8bc LK |
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]\\'" | |
4b8643d3 | 146 | "Regular expression used by `generic-mode-find-file-hook'. |
9285b8bc LK |
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) | |
4b8643d3 | 174 | (not (string-match-p |
9285b8bc LK |
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 | |
79a0fb58 GM |
232 | x-resource-generic-mode |
233 | xmodmap-generic-mode) | |
1fffafda LK |
234 | "List of generic modes that are defined by default on Unix.") |
235 | ||
236 | (defconst generic-other-modes | |
237 | '(astap-generic-mode | |
238 | ibis-generic-mode | |
239 | pkginfo-generic-mode | |
240 | spice-generic-mode) | |
4b8643d3 | 241 | "List of generic modes that are not defined by default.") |
ca1e63a5 | 242 | |
ffe0c7ef | 243 | (defcustom generic-define-mswindows-modes |
d8677156 | 244 | (memq system-type '(windows-nt ms-dos)) |
4b8643d3 | 245 | "Non-nil means the modes in `generic-mswindows-modes' will be defined. |
1fffafda | 246 | This is a list of MS-Windows specific generic modes. This variable |
76ee7bd5 | 247 | only affects the default value of `generic-extras-enable-list'." |
ca1e63a5 | 248 | :group 'generic-x |
1fffafda LK |
249 | :type 'boolean |
250 | :version "22.1") | |
251 | (make-obsolete-variable 'generic-define-mswindows-modes 'generic-extras-enable-list "22.1") | |
ca1e63a5 RS |
252 | |
253 | (defcustom generic-define-unix-modes | |
d8677156 | 254 | (not (memq system-type '(windows-nt ms-dos))) |
4b8643d3 | 255 | "Non-nil means the modes in `generic-unix-modes' will be defined. |
1fffafda | 256 | This is a list of Unix specific generic modes. This variable only |
76ee7bd5 | 257 | affects the default value of `generic-extras-enable-list'." |
ca1e63a5 | 258 | :group 'generic-x |
1fffafda LK |
259 | :type 'boolean |
260 | :version "22.1") | |
261 | (make-obsolete-variable 'generic-define-unix-modes 'generic-extras-enable-list "22.1") | |
262 | ||
263 | (defcustom generic-extras-enable-list | |
264 | (append generic-default-modes | |
265 | (if generic-define-mswindows-modes generic-mswindows-modes) | |
266 | (if generic-define-unix-modes generic-unix-modes) | |
267 | nil) | |
268 | "List of generic modes to define. | |
269 | Each entry in the list should be a symbol. If you set this variable | |
270 | directly, without using customize, you must reload generic-x to put | |
271 | your changes into effect." | |
272 | :group 'generic-x | |
273 | :type (let (list) | |
274 | (dolist (mode | |
275 | (sort (append generic-default-modes | |
276 | generic-mswindows-modes | |
277 | generic-unix-modes | |
278 | generic-other-modes | |
279 | nil) | |
280 | (lambda (a b) | |
281 | (string< (symbol-name b) | |
282 | (symbol-name a)))) | |
283 | (cons 'set list)) | |
284 | (push `(const ,mode) list))) | |
285 | :set (lambda (s v) | |
286 | (set-default s v) | |
287 | (unless load-in-progress | |
288 | (load "generic-x"))) | |
289 | :version "22.1") | |
ca1e63a5 | 290 | |
ca1e63a5 | 291 | ;;; Apache |
d8677156 LK |
292 | (when (memq 'apache-conf-generic-mode generic-extras-enable-list) |
293 | ||
294 | (define-generic-mode apache-conf-generic-mode | |
82e38f3e | 295 | '(?#) |
d8677156 | 296 | nil |
82e38f3e LK |
297 | '(("^\\s-*\\(<.*>\\)" 1 font-lock-constant-face) |
298 | ("^\\s-*\\(\\sw+\\)\\s-" 1 font-lock-variable-name-face)) | |
299 | '("srm\\.conf\\'" "httpd\\.conf\\'" "access\\.conf\\'") | |
d8677156 LK |
300 | (list |
301 | (function | |
302 | (lambda () | |
ffe0c7ef PB |
303 | (setq imenu-generic-expression |
304 | '((nil "^\\([-A-Za-z0-9_]+\\)" 1) | |
305 | ("*Directories*" "^\\s-*<Directory\\s-*\\([^>]+\\)>" 1) | |
d8677156 | 306 | ("*Locations*" "^\\s-*<Location\\s-*\\([^>]+\\)>" 1)))))) |
d4fb185d | 307 | "Generic mode for Apache or HTTPD configuration files.")) |
ffe0c7ef | 308 | |
d8677156 | 309 | (when (memq 'apache-log-generic-mode generic-extras-enable-list) |
ffe0c7ef | 310 | |
d8677156 | 311 | (define-generic-mode apache-log-generic-mode |
ffe0c7ef PB |
312 | nil |
313 | nil | |
314 | ;; Hostname ? user date request return-code number-of-bytes | |
315 | '(("^\\([-a-zA-z0-9.]+\\) - [-A-Za-z]+ \\(\\[.*\\]\\)" | |
316 | (1 font-lock-constant-face) | |
d8677156 | 317 | (2 font-lock-variable-name-face))) |
82e38f3e | 318 | '("access_log\\'") |
ffe0c7ef | 319 | nil |
4b8643d3 | 320 | "Generic mode for Apache log files.")) |
ffe0c7ef | 321 | |
ca1e63a5 | 322 | ;;; Samba |
d8677156 LK |
323 | (when (memq 'samba-generic-mode generic-extras-enable-list) |
324 | ||
325 | (define-generic-mode samba-generic-mode | |
82e38f3e | 326 | '(?\; ?#) |
d8677156 | 327 | nil |
82e38f3e | 328 | '(("^\\(\\[.*\\]\\)" 1 font-lock-constant-face) |
d8677156 | 329 | ("^\\s-*\\(.+\\)=\\([^\r\n]*\\)" |
82e38f3e LK |
330 | (1 font-lock-variable-name-face) |
331 | (2 font-lock-type-face))) | |
332 | '("smb\\.conf\\'") | |
333 | '(generic-bracket-support) | |
d4fb185d | 334 | "Generic mode for Samba configuration files.")) |
ca1e63a5 RS |
335 | |
336 | ;;; Fvwm | |
337 | ;; This is pretty basic. Also, modes for other window managers could | |
338 | ;; be defined as well. | |
d8677156 | 339 | (when (memq 'fvwm-generic-mode generic-extras-enable-list) |
ca1e63a5 | 340 | |
d8677156 | 341 | (define-generic-mode fvwm-generic-mode |
82e38f3e LK |
342 | '(?#) |
343 | '("AddToMenu" | |
344 | "AddToFunc" | |
345 | "ButtonStyle" | |
346 | "EndFunction" | |
347 | "EndPopup" | |
348 | "Function" | |
349 | "IconPath" | |
350 | "Key" | |
351 | "ModulePath" | |
352 | "Mouse" | |
353 | "PixmapPath" | |
354 | "Popup" | |
355 | "Style") | |
d8677156 | 356 | nil |
82e38f3e | 357 | '("\\.fvwmrc\\'" "\\.fvwm2rc\\'") |
d8677156 | 358 | nil |
d4fb185d | 359 | "Generic mode for FVWM configuration files.")) |
ca1e63a5 RS |
360 | |
361 | ;;; X Resource | |
362 | ;; I'm pretty sure I've seen an actual mode to do this, but I don't | |
363 | ;; think it's standard with Emacs | |
d8677156 | 364 | (when (memq 'x-resource-generic-mode generic-extras-enable-list) |
ca1e63a5 | 365 | |
d8677156 | 366 | (define-generic-mode x-resource-generic-mode |
82e38f3e | 367 | '(?!) |
d8677156 | 368 | nil |
82e38f3e LK |
369 | '(("^\\([^:\n]+:\\)" 1 font-lock-variable-name-face)) |
370 | '("\\.Xdefaults\\'" "\\.Xresources\\'" "\\.Xenvironment\\'" "\\.ad\\'") | |
d8677156 | 371 | nil |
d4fb185d | 372 | "Generic mode for X Resource configuration files.")) |
ca1e63a5 | 373 | |
79a0fb58 | 374 | (if (memq 'xmodmap-generic-mode generic-extras-enable-list) |
ffd0a502 DC |
375 | (define-generic-mode xmodmap-generic-mode |
376 | '(?!) | |
377 | '("add" "clear" "keycode" "keysym" "remove" "pointer") | |
378 | nil | |
379 | '("[xX]modmap\\(rc\\)?\\'") | |
380 | nil | |
79a0fb58 | 381 | "Simple mode for xmodmap files.")) |
ffd0a502 | 382 | |
ca1e63a5 | 383 | ;;; Hosts |
d8677156 | 384 | (when (memq 'hosts-generic-mode generic-extras-enable-list) |
ca1e63a5 | 385 | |
d8677156 | 386 | (define-generic-mode hosts-generic-mode |
82e38f3e LK |
387 | '(?#) |
388 | '("localhost") | |
d1501442 | 389 | '(("\\([0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+\\)" 1 font-lock-constant-face)) |
82e38f3e | 390 | '("[hH][oO][sS][tT][sS]\\'") |
d8677156 | 391 | nil |
d4fb185d | 392 | "Generic mode for HOSTS files.")) |
ca1e63a5 RS |
393 | |
394 | ;;; Windows INF files | |
97d9baef GM |
395 | |
396 | ;; If i-g-m-f-f-h is defined, then so is i-g-m. | |
397 | (declare-function ini-generic-mode "generic-x") | |
398 | ||
d8677156 | 399 | (when (memq 'inf-generic-mode generic-extras-enable-list) |
ca1e63a5 | 400 | |
d8677156 | 401 | (define-generic-mode inf-generic-mode |
82e38f3e | 402 | '(?\;) |
d8677156 | 403 | nil |
82e38f3e LK |
404 | '(("^\\(\\[.*\\]\\)" 1 font-lock-constant-face)) |
405 | '("\\.[iI][nN][fF]\\'") | |
406 | '(generic-bracket-support) | |
d4fb185d | 407 | "Generic mode for MS-Windows INF files.")) |
ca1e63a5 RS |
408 | |
409 | ;;; Windows INI files | |
410 | ;; Should define escape character as well! | |
d8677156 LK |
411 | (when (memq 'ini-generic-mode generic-extras-enable-list) |
412 | ||
413 | (define-generic-mode ini-generic-mode | |
82e38f3e | 414 | '(?\;) |
d8677156 | 415 | nil |
82e38f3e | 416 | '(("^\\(\\[.*\\]\\)" 1 font-lock-constant-face) |
d8677156 LK |
417 | ("^\\([^=\n\r]*\\)=\\([^\n\r]*\\)$" |
418 | (1 font-lock-function-name-face) | |
419 | (2 font-lock-variable-name-face))) | |
82e38f3e | 420 | '("\\.[iI][nN][iI]\\'") |
d8677156 LK |
421 | (list |
422 | (function | |
423 | (lambda () | |
424 | (setq imenu-generic-expression | |
425 | '((nil "^\\[\\(.*\\)\\]" 1) | |
426 | ("*Variables*" "^\\s-*\\([^=]+\\)\\s-*=" 1)))))) | |
a2d66c78 LK |
427 | "Generic mode for MS-Windows INI files. |
428 | You can use `ini-generic-mode-find-file-hook' to enter this mode | |
d4fb185d | 429 | automatically for INI files whose names do not end in \".ini\".") |
a2d66c78 LK |
430 | |
431 | (defun ini-generic-mode-find-file-hook () | |
432 | "Hook function to enter Ini-Generic mode automatically for INI files. | |
433 | Done if the first few lines of a file in Fundamental mode look | |
434 | like an INI file. You can add this hook to `find-file-hook'." | |
435 | (and (eq major-mode 'fundamental-mode) | |
436 | (save-excursion | |
437 | (goto-char (point-min)) | |
438 | (and (looking-at "^\\s-*\\[.*\\]") | |
439 | (ini-generic-mode))))) | |
440 | (defalias 'generic-mode-ini-file-find-file-hook 'ini-generic-mode-find-file-hook)) | |
ca1e63a5 RS |
441 | |
442 | ;;; Windows REG files | |
443 | ;;; Unfortunately, Windows 95 and Windows NT have different REG file syntax! | |
d8677156 LK |
444 | (when (memq 'reg-generic-mode generic-extras-enable-list) |
445 | ||
446 | (define-generic-mode reg-generic-mode | |
447 | '(?\;) | |
448 | '("key" "classes_root" "REGEDIT" "REGEDIT4") | |
ddb72af9 | 449 | '(("\\(\\[.*\\]\\)" 1 font-lock-constant-face) |
82e38f3e | 450 | ("^\\([^\n\r]*\\)\\s-*=" 1 font-lock-variable-name-face)) |
d8677156 LK |
451 | '("\\.[rR][eE][gG]\\'") |
452 | (list | |
453 | (function | |
454 | (lambda () | |
455 | (setq imenu-generic-expression | |
456 | '((nil "^\\s-*\\(.*\\)\\s-*=" 1)))))) | |
d4fb185d | 457 | "Generic mode for MS-Windows Registry files.")) |
ca1e63a5 | 458 | |
d5f05c46 DN |
459 | (declare-function w32-shell-name "w32-fns" ()) |
460 | ||
60bdd17f | 461 | ;;; DOS/Windows BAT files |
d8677156 | 462 | (when (memq 'bat-generic-mode generic-extras-enable-list) |
7679edb1 | 463 | (define-obsolete-function-alias 'bat-generic-mode 'bat-mode "24.4")) |
ca1e63a5 RS |
464 | |
465 | ;;; Mailagent | |
82e38f3e LK |
466 | ;; Mailagent is a Unix mail filtering program. Anyone wanna do a |
467 | ;; generic mode for procmail? | |
d8677156 LK |
468 | (when (memq 'mailagent-rules-generic-mode generic-extras-enable-list) |
469 | ||
470 | (define-generic-mode mailagent-rules-generic-mode | |
82e38f3e LK |
471 | '(?#) |
472 | '("SAVE" "DELETE" "PIPE" "ANNOTATE" "REJECT") | |
473 | '(("^\\(\\sw+\\)\\s-*=" 1 font-lock-variable-name-face) | |
474 | ("\\s-/\\([^/]+\\)/[i, \t\n]" 1 font-lock-constant-face)) | |
475 | '("\\.rules\\'") | |
16a013c2 LK |
476 | (list |
477 | (function | |
478 | (lambda () | |
479 | (setq imenu-generic-expression | |
480 | '((nil "\\s-/\\([^/]+\\)/[i, \t\n]" 1)))))) | |
4b8643d3 | 481 | "Generic mode for Mailagent rules files.")) |
ca1e63a5 RS |
482 | |
483 | ;; Solaris/Sys V prototype files | |
d8677156 LK |
484 | (when (memq 'prototype-generic-mode generic-extras-enable-list) |
485 | ||
486 | (define-generic-mode prototype-generic-mode | |
82e38f3e | 487 | '(?#) |
d8677156 LK |
488 | nil |
489 | '(("^\\([0-9]\\)?\\s-*\\([a-z]\\)\\s-+\\([A-Za-z_]+\\)\\s-+\\([^\n\r]*\\)$" | |
490 | (2 font-lock-constant-face) | |
491 | (3 font-lock-keyword-face)) | |
492 | ("^\\([a-z]\\) \\([A-Za-z_]+\\)=\\([^\n\r]*\\)$" | |
493 | (1 font-lock-constant-face) | |
494 | (2 font-lock-keyword-face) | |
495 | (3 font-lock-variable-name-face)) | |
496 | ("^\\(!\\s-*\\(search\\|include\\|default\\)\\)\\s-*\\([^\n\r]*\\)$" | |
497 | (1 font-lock-keyword-face) | |
498 | (3 font-lock-variable-name-face)) | |
499 | ("^\\(!\\s-*\\sw+\\)=\\([^\n\r]*\\)$" | |
500 | (1 font-lock-keyword-face) | |
501 | (2 font-lock-variable-name-face))) | |
82e38f3e | 502 | '("prototype\\'") |
d8677156 | 503 | nil |
4b8643d3 | 504 | "Generic mode for Sys V prototype files.")) |
ca1e63a5 RS |
505 | |
506 | ;; Solaris/Sys V pkginfo files | |
d8677156 LK |
507 | (when (memq 'pkginfo-generic-mode generic-extras-enable-list) |
508 | ||
509 | (define-generic-mode pkginfo-generic-mode | |
82e38f3e | 510 | '(?#) |
d8677156 LK |
511 | nil |
512 | '(("^\\([A-Za-z_]+\\)=\\([^\n\r]*\\)$" | |
513 | (1 font-lock-keyword-face) | |
514 | (2 font-lock-variable-name-face))) | |
82e38f3e | 515 | '("pkginfo\\'") |
d8677156 | 516 | nil |
4b8643d3 | 517 | "Generic mode for Sys V pkginfo files.")) |
ca1e63a5 RS |
518 | |
519 | ;; Javascript mode | |
13373538 | 520 | ;; Obsolete; defer to js-mode from js.el. |
1fffafda | 521 | (when (memq 'javascript-generic-mode generic-extras-enable-list) |
13373538 JB |
522 | (define-obsolete-function-alias 'javascript-generic-mode 'js-mode "24.3") |
523 | (define-obsolete-variable-alias 'javascript-generic-mode-hook 'js-mode-hook "24.3")) | |
ca1e63a5 RS |
524 | |
525 | ;; VRML files | |
1fffafda LK |
526 | (when (memq 'vrml-generic-mode generic-extras-enable-list) |
527 | ||
d8677156 | 528 | (define-generic-mode vrml-generic-mode |
82e38f3e LK |
529 | '(?#) |
530 | '("DEF" | |
531 | "NULL" | |
532 | "USE" | |
533 | "Viewpoint" | |
534 | "ambientIntensity" | |
535 | "appearance" | |
536 | "children" | |
537 | "color" | |
538 | "coord" | |
539 | "coordIndex" | |
540 | "creaseAngle" | |
541 | "diffuseColor" | |
542 | "emissiveColor" | |
543 | "fieldOfView" | |
544 | "geometry" | |
545 | "info" | |
546 | "material" | |
547 | "normal" | |
548 | "orientation" | |
549 | "position" | |
550 | "shininess" | |
551 | "specularColor" | |
552 | "texCoord" | |
553 | "texture" | |
554 | "textureTransform" | |
555 | "title" | |
556 | "transparency" | |
557 | "type") | |
558 | '(("USE\\s-+\\([-A-Za-z0-9_]+\\)" | |
559 | (1 font-lock-constant-face)) | |
560 | ("DEF\\s-+\\([-A-Za-z0-9_]+\\)\\s-+\\([A-Za-z0-9]+\\)\\s-*{" | |
561 | (1 font-lock-type-face) | |
562 | (2 font-lock-constant-face)) | |
563 | ("^\\s-*\\([-A-Za-z0-9_]+\\)\\s-*{" | |
564 | (1 font-lock-function-name-face)) | |
565 | ("^\\s-*\\(geometry\\|appearance\\|material\\)\\s-+\\([-A-Za-z0-9_]+\\)" | |
566 | (2 font-lock-variable-name-face))) | |
567 | '("\\.wrl\\'") | |
ca1e63a5 | 568 | (list |
ffe0c7ef | 569 | (function |
ca1e63a5 | 570 | (lambda () |
ffe0c7ef | 571 | (setq imenu-generic-expression |
ca1e63a5 | 572 | '((nil "^\\([A-Za-z0-9_]+\\)\\s-*{" 1) |
ffe0c7ef | 573 | ("*Definitions*" |
ca1e63a5 | 574 | "DEF\\s-+\\([-A-Za-z0-9_]+\\)\\s-+\\([A-Za-z0-9]+\\)\\s-*{" |
d8677156 | 575 | 1)))))) |
d4fb185d | 576 | "Generic Mode for VRML files.")) |
ca1e63a5 RS |
577 | |
578 | ;; Java Manifests | |
1fffafda LK |
579 | (when (memq 'java-manifest-generic-mode generic-extras-enable-list) |
580 | ||
d8677156 | 581 | (define-generic-mode java-manifest-generic-mode |
82e38f3e LK |
582 | '(?#) |
583 | '("Name" | |
584 | "Digest-Algorithms" | |
585 | "Manifest-Version" | |
586 | "Required-Version" | |
587 | "Signature-Version" | |
588 | "Magic" | |
589 | "Java-Bean" | |
590 | "Depends-On") | |
ca1e63a5 RS |
591 | '(("^Name:\\s-+\\([^\n\r]*\\)$" |
592 | (1 font-lock-variable-name-face)) | |
593 | ("^\\(Manifest\\|Required\\|Signature\\)-Version:\\s-+\\([^\n\r]*\\)$" | |
d8677156 | 594 | (2 font-lock-constant-face))) |
82e38f3e | 595 | '("[mM][aA][nN][iI][fF][eE][sS][tT]\\.[mM][fF]\\'") |
ca1e63a5 | 596 | nil |
4b8643d3 | 597 | "Generic mode for Java Manifest files.")) |
ca1e63a5 RS |
598 | |
599 | ;; Java properties files | |
1fffafda LK |
600 | (when (memq 'java-properties-generic-mode generic-extras-enable-list) |
601 | ||
d8677156 | 602 | (define-generic-mode java-properties-generic-mode |
82e38f3e | 603 | '(?! ?#) |
ca1e63a5 | 604 | nil |
82e38f3e LK |
605 | (eval-when-compile |
606 | (let ((java-properties-key | |
607 | "\\(\\([-A-Za-z0-9_\\./]\\|\\(\\\\[ =:]\\)\\)+\\)") | |
608 | (java-properties-value | |
609 | "\\([^\r\n]*\\)")) | |
610 | ;; Property and value can be separated in a number of different ways: | |
611 | ;; * whitespace | |
612 | ;; * an equal sign | |
613 | ;; * a colon | |
614 | (mapcar | |
615 | (function | |
616 | (lambda (elt) | |
617 | (list | |
618 | (concat "^" java-properties-key elt java-properties-value "$") | |
619 | '(1 font-lock-constant-face) | |
620 | '(4 font-lock-variable-name-face)))) | |
621 | ;; These are the separators | |
622 | '(":\\s-*" "\\s-+" "\\s-*=\\s-*")))) | |
ca1e63a5 | 623 | nil |
bb53e1ee RS |
624 | (list |
625 | (function | |
626 | (lambda () | |
ffe0c7ef | 627 | (setq imenu-generic-expression |
d8677156 | 628 | '((nil "^\\([^#! \t\n\r=:]+\\)" 1)))))) |
4b8643d3 | 629 | "Generic mode for Java properties files.")) |
ca1e63a5 RS |
630 | |
631 | ;; C shell alias definitions | |
d8677156 | 632 | (when (memq 'alias-generic-mode generic-extras-enable-list) |
ef1c5063 | 633 | |
d8677156 | 634 | (define-generic-mode alias-generic-mode |
82e38f3e LK |
635 | '(?#) |
636 | '("alias" "unalias") | |
ca1e63a5 RS |
637 | '(("^alias\\s-+\\([-A-Za-z0-9_]+\\)\\s-+" |
638 | (1 font-lock-variable-name-face)) | |
639 | ("^unalias\\s-+\\([-A-Za-z0-9_]+\\)\\s-*$" | |
d8677156 | 640 | (1 font-lock-variable-name-face))) |
82e38f3e | 641 | '("alias\\'") |
ca1e63a5 RS |
642 | (list |
643 | (function | |
644 | (lambda () | |
ffe0c7ef | 645 | (setq imenu-generic-expression |
d8677156 | 646 | '((nil "^\\(alias\\|unalias\\)\\s-+\\([-a-zA-Z0-9_]+\\)" 2)))))) |
4b8643d3 | 647 | "Generic mode for C Shell alias files.")) |
ca1e63a5 RS |
648 | |
649 | ;;; Windows RC files | |
650 | ;; Contributed by ACorreir@pervasive-sw.com (Alfred Correira) | |
d8677156 LK |
651 | (when (memq 'rc-generic-mode generic-extras-enable-list) |
652 | ||
653 | (define-generic-mode rc-generic-mode | |
82e38f3e LK |
654 | ;; '(?\/) |
655 | '("//") | |
d8677156 LK |
656 | '("ACCELERATORS" |
657 | "AUTO3STATE" | |
658 | "AUTOCHECKBOX" | |
659 | "AUTORADIOBUTTON" | |
660 | "BITMAP" | |
661 | "BOTTOMMARGIN" | |
662 | "BUTTON" | |
663 | "CAPTION" | |
664 | "CHARACTERISTICS" | |
665 | "CHECKBOX" | |
666 | "CLASS" | |
667 | "COMBOBOX" | |
668 | "CONTROL" | |
669 | "CTEXT" | |
670 | "CURSOR" | |
671 | "DEFPUSHBUTTON" | |
672 | "DESIGNINFO" | |
673 | "DIALOG" | |
674 | "DISCARDABLE" | |
675 | "EDITTEXT" | |
676 | "EXSTYLE" | |
677 | "FONT" | |
678 | "GROUPBOX" | |
679 | "GUIDELINES" | |
680 | "ICON" | |
681 | "LANGUAGE" | |
682 | "LEFTMARGIN" | |
683 | "LISTBOX" | |
684 | "LTEXT" | |
685 | "MENUITEM SEPARATOR" | |
686 | "MENUITEM" | |
687 | "MENU" | |
688 | "MOVEABLE" | |
689 | "POPUP" | |
690 | "PRELOAD" | |
691 | "PURE" | |
692 | "PUSHBOX" | |
693 | "PUSHBUTTON" | |
694 | "RADIOBUTTON" | |
695 | "RCDATA" | |
696 | "RIGHTMARGIN" | |
697 | "RTEXT" | |
698 | "SCROLLBAR" | |
699 | "SEPARATOR" | |
700 | "STATE3" | |
701 | "STRINGTABLE" | |
702 | "STYLE" | |
703 | "TEXTINCLUDE" | |
704 | "TOOLBAR" | |
705 | "TOPMARGIN" | |
706 | "VERSIONINFO" | |
707 | "VERSION") | |
708 | ;; the choice of what tokens go where is somewhat arbitrary, | |
709 | ;; as is the choice of which value tokens are included, as | |
710 | ;; the choice of face for each token group | |
82e38f3e LK |
711 | (eval-when-compile |
712 | (list | |
9445f99b GM |
713 | (list (regexp-opt '("FILEFLAGSMASK" |
714 | "FILEFLAGS" | |
715 | "FILEOS" | |
716 | "FILESUBTYPE" | |
717 | "FILETYPE" | |
718 | "FILEVERSION" | |
719 | "PRODUCTVERSION") 'symbols) | |
720 | 1 font-lock-type-face) | |
721 | (list (regexp-opt '("BEGIN" "BLOCK" "END" "VALUE") 'symbols) | |
722 | 1 font-lock-function-name-face) | |
82e38f3e LK |
723 | '("^#[ \t]*include[ \t]+\\(<[^>\"\n]+>\\)" 1 font-lock-string-face) |
724 | '("^#[ \t]*define[ \t]+\\(\\sw+\\)(" 1 font-lock-function-name-face) | |
725 | '("^#[ \t]*\\(elif\\|if\\)\\>" | |
726 | ("\\<\\(defined\\)\\>[ \t]*(?\\(\\sw+\\)?" nil nil | |
727 | (1 font-lock-constant-face) | |
728 | (2 font-lock-variable-name-face nil t))) | |
729 | '("^#[ \t]*\\(\\sw+\\)\\>[ \t]*\\(\\sw+\\)?" | |
730 | (1 font-lock-constant-face) | |
731 | (2 font-lock-variable-name-face nil t)))) | |
60c19d5e | 732 | '("\\.[rR][cC]\\'") |
82e38f3e | 733 | nil |
d4fb185d | 734 | "Generic mode for MS-Windows Resource files.")) |
ca1e63a5 | 735 | |
ef1c5063 | 736 | ;; InstallShield RUL files |
ca1e63a5 | 737 | ;; Contributed by Alfred.Correira@Pervasive.Com |
9845e669 | 738 | ;; Bugfixes by "Rolf Sandau" <Rolf.Sandau@marconi.com> |
d8677156 LK |
739 | (when (memq 'rul-generic-mode generic-extras-enable-list) |
740 | ||
82e38f3e LK |
741 | (eval-when-compile |
742 | ||
ef1c5063 | 743 | ;;; build the regexp strings using regexp-opt |
82e38f3e LK |
744 | (defconst installshield-statement-keyword-list |
745 | '("abort" | |
746 | "begin" | |
747 | "call" | |
748 | "case" | |
749 | "declare" | |
750 | "default" | |
751 | "downto" | |
752 | "elseif" | |
753 | "else" | |
754 | "endfor" | |
755 | "endif" | |
756 | "endswitch" | |
757 | "endwhile" | |
758 | "end" | |
759 | "exit" | |
760 | "external" | |
761 | "for" | |
762 | "function" | |
763 | ;; "goto" -- handled elsewhere | |
764 | "if" | |
765 | "program" | |
766 | "prototype" | |
767 | "repeat" | |
768 | "return" | |
769 | "step" | |
770 | "switch" | |
771 | "then" | |
772 | "to" | |
773 | "typedef" | |
774 | "until" | |
775 | "void" | |
776 | "while") | |
ef1c5063 RS |
777 | "Statement keywords used in InstallShield 3 and 5.") |
778 | ||
82e38f3e LK |
779 | (defconst installshield-system-functions-list |
780 | '("AddFolderIcon" | |
781 | "AddProfString" | |
782 | "AddressString" | |
783 | "AppCommand" | |
784 | "AskDestPath" | |
785 | "AskOptions" | |
786 | "AskPath" | |
787 | "AskText" | |
788 | "AskYesNo" | |
789 | "BatchDeleteEx" | |
790 | "BatchFileLoad" | |
791 | "BatchFileSave" | |
792 | "BatchFind" | |
793 | "BatchGetFileName" | |
794 | "BatchMoveEx" | |
795 | "BatchSetFileName" | |
796 | "ChangeDirectory" | |
797 | "CloseFile" | |
798 | "CmdGetHwndDlg" | |
799 | "ComponentAddItem" ; differs between IS3 and IS5 | |
800 | "ComponentCompareSizeRequired" ; IS5 only | |
801 | "ComponentDialog" | |
802 | "ComponentError" ; IS5 only | |
803 | "ComponentFileEnum" ; IS5 only | |
804 | "ComponentFileInfo" ; IS5 only | |
805 | "ComponentFilterLanguage" ; IS5 only | |
806 | "ComponentFilterOS" ; IS5 only | |
807 | "ComponentGetData" ; IS5 only | |
808 | "ComponentGetItemInfo" ; IS3 only | |
809 | "ComponentGetItemSize" ; differs between IS3 and IS5 | |
810 | "ComponentIsItemSelected" ; differs between IS3 and IS5 | |
811 | "ComponentListItems" | |
812 | "ComponentMoveData" ; IS5 only | |
813 | "ComponentSelectItem" ; differs between IS3 and IS5 | |
814 | "ComponentSetData" ; IS5 only | |
815 | "ComponentSetItemInfo" ; IS3 only | |
816 | "ComponentSetTarget" ; IS5 only | |
817 | "ComponentSetupTypeEnum" ; IS5 only | |
818 | "ComponentSetupTypeGetData" ; IS5 only | |
819 | "ComponentSetupTypeSet" ; IS5 only | |
820 | "ComponentTotalSize" | |
821 | "ComponentValidate" ; IS5 only | |
822 | "CompressAdd" ; IS3 only | |
823 | "CompressDel" ; IS3 only | |
824 | "CompressEnum" ; IS3 only | |
825 | "CompressGet" ; IS3 only | |
826 | "CompressInfo" ; IS3 only | |
827 | "CopyFile" | |
828 | "CreateDir" | |
829 | "CreateFile" | |
830 | "CreateProgramFolder" | |
831 | "DeinstallSetReference" ; IS5 only | |
832 | "DeinstallStart" | |
833 | "Delay" | |
834 | "DeleteDir" | |
835 | "DeleteFile" | |
836 | "DialogSetInfo" | |
837 | "Disable" | |
838 | "DoInstall" | |
839 | "Do" | |
840 | "Enable" | |
841 | "EnterDisk" | |
842 | "ExistsDir" | |
843 | "ExistsDisk" | |
844 | "ExitProgMan" | |
845 | "EzBatchAddPath" | |
846 | "EzBatchAddString" | |
847 | "EzBatchReplace" | |
848 | "EzConfigAddDriver" | |
849 | "EzConfigAddString" | |
850 | "EzConfigGetValue" | |
851 | "EzConfigSetValue" | |
852 | "EzDefineDialog" | |
853 | "FileCompare" | |
854 | "FileDeleteLine" | |
855 | "FileGrep" | |
856 | "FileInsertLine" | |
857 | "FileSetBeginDefine" ; IS3 only | |
858 | "FileSetEndDefine" ; IS3 only | |
859 | "FileSetPerformEz" ; IS3 only | |
860 | "FileSetPerform" ; IS3 only | |
861 | "FileSetReset" ; IS3 only | |
862 | "FileSetRoot" ; IS3 only | |
863 | "FindAllDirs" | |
864 | "FindAllFiles" | |
865 | "FindFile" | |
866 | "FindWindow" | |
867 | "GetDiskSpace" | |
868 | "GetDisk" | |
869 | "GetEnvVar" | |
870 | "GetExtents" | |
871 | "GetFileInfo" | |
872 | "GetLine" | |
873 | "GetProfInt" | |
874 | "GetProfString" | |
875 | "GetSystemInfo" | |
876 | "GetValidDrivesList" | |
877 | "GetVersion" | |
878 | "GetWindowHandle" | |
879 | "InstallationInfo" | |
880 | "Is" | |
881 | "LaunchApp" | |
882 | "LaunchAppAndWait" | |
883 | "ListAddItem" | |
884 | "ListAddString" | |
885 | "ListCount" | |
886 | "ListCreate" | |
887 | "ListDestroy" | |
888 | "ListFindItem" | |
889 | "ListFindString" | |
890 | "ListGetFirstItem" | |
891 | "ListGetFirstString" | |
892 | "ListGetNextItem" | |
893 | "ListGetNextString" | |
894 | "ListReadFromFile" | |
895 | "ListSetCurrentItem" | |
896 | "ListSetNextItem" | |
897 | "ListSetNextString" | |
898 | "ListSetIndex" | |
899 | "ListWriteToFile" | |
900 | "LongPathToQuote" | |
901 | "LongPathToShortPath" | |
902 | "MessageBox" | |
903 | "NumToStr" | |
904 | "OpenFileMode" | |
905 | "OpenFile" | |
906 | "ParsePath" | |
907 | "PathAdd" | |
908 | "PathDelete" | |
909 | "PathFind" | |
910 | "PathGet" | |
911 | "PathMove" | |
912 | "PathSet" | |
913 | "Path" | |
914 | "PlaceBitmap" | |
915 | "PlaceWindow" | |
916 | "PlayMMedia" ; IS5 only | |
917 | "ProgDefGroupType" | |
918 | "RegDBCreateKeyEx" | |
919 | "RegDBDeleteValue" | |
920 | "RegDBGetItem" | |
921 | "RegDBKeyExist" | |
922 | "RegDBSetItem" | |
923 | "RegDBGetKeyValueEx" | |
924 | "RegDBSetKeyValueEx" | |
925 | "RegDBSetDefaultRoot" | |
926 | "RenameFile" | |
927 | "ReplaceFolderIcon" | |
928 | "ReplaceProfString" | |
929 | "SdAskDestPath" | |
930 | "SdAskOptions" | |
931 | "SdAskOptionsList" | |
932 | "SdBitmap" | |
933 | "SdCloseDlg" | |
934 | "SdComponentAdvCheckSpace" | |
935 | "SdComponentAdvInit" | |
936 | "SdComponentAdvUpdateSpace" | |
937 | "SdComponentDialog" | |
938 | "SdComponentDialog2" | |
939 | "SdComponentDialogAdv" | |
940 | "SdComponentDialogEx" | |
941 | "SdComponentDlgCheckSpace" | |
942 | "SdComponentMult" | |
943 | "SdConfirmNewDir" | |
944 | "SdConfirmRegistration" | |
945 | "SdDiskSpace" | |
946 | "SdDisplayTopics" | |
947 | "SdDoStdButton" | |
948 | "SdEnablement" | |
949 | "SdError" | |
950 | "SdFinish" | |
951 | "SdFinishInit32" | |
952 | "SdFinishReboot" | |
953 | "SdGeneralInit" | |
954 | "SdGetItemName" | |
955 | "SdGetTextExtent" | |
956 | "SdGetUserCompanyInfo" | |
957 | "SdInit" | |
958 | "SdIsShellExplorer" | |
959 | "SdIsStdButton" | |
960 | "SdLicense" | |
961 | "SdMakeName" | |
962 | "SdOptionInit" | |
963 | "SdOptionSetState" | |
964 | "SdOptionsButtons" | |
965 | "SdOptionsButtonsInit" | |
966 | "SdPlugInProductName" | |
967 | "SdProductName" | |
968 | "SdRegEnableButton" | |
969 | "SdRegExEnableButton" | |
970 | "SdRegisterUser" | |
971 | "SdRegisterUserEx" | |
972 | "SdRemoveEndSpace" | |
973 | "SdSelectFolder" | |
974 | "SdSetSequentialItems" | |
975 | "SdSetStatic" | |
976 | "SdSetupTypeEx" ; IS5 only | |
977 | "SdSetupType" | |
978 | "SdShowAnyDialog" | |
979 | "SdShowDlgEdit1" | |
980 | "SdShowDlgEdit2" | |
981 | "SdShowDlgEdit3" | |
982 | "SdShowFileMods" | |
983 | "SdShowInfoList" | |
984 | "SdShowMsg" | |
985 | "SdStartCopy" | |
986 | "SdUnInit" | |
987 | "SdUpdateComponentSelection" | |
988 | "SdWelcome" | |
989 | "SendMessage" | |
990 | "SetColor" | |
991 | "SetFont" | |
992 | "SetDialogTitle" | |
993 | "SetDisplayEffect" ; IS5 only | |
994 | "SetFileInfo" | |
995 | "SetForegroundWindow" | |
996 | "SetStatusWindow" | |
997 | "SetTitle" | |
998 | "SetupType" | |
999 | "ShowProgramFolder" | |
1000 | "Split" ; IS3 only | |
1001 | "SprintfBox" | |
1002 | "Sprintf" | |
1003 | "StatusUpdate" | |
1004 | "StrCompare" | |
1005 | "StrFind" | |
1006 | "StrGetTokens" | |
1007 | "StrLength" | |
1008 | "StrRemoveLastSlash" | |
1009 | "StrToLower" | |
1010 | "StrToNum" | |
1011 | "StrToUpper" | |
1012 | "StrSub" | |
1013 | "VarRestore" | |
1014 | "VarSave" | |
1015 | "VerCompare" | |
1016 | "VerGetFileVersion" | |
1017 | "WaitOnDialog" | |
1018 | "Welcome" | |
1019 | "WriteLine" | |
1020 | "WriteProfString" | |
1021 | "XCopyFile") | |
ef1c5063 RS |
1022 | "System functions defined in InstallShield 3 and 5.") |
1023 | ||
82e38f3e LK |
1024 | (defconst installshield-system-variables-list |
1025 | '("BATCH_INSTALL" | |
1026 | "CMDLINE" | |
1027 | "COMMONFILES" | |
1028 | "CORECOMPONENTHANDLING" | |
1029 | "DIALOGCACHE" | |
1030 | "ERRORFILENAME" | |
1031 | "FOLDER_DESKTOP" | |
1032 | "FOLDER_PROGRAMS" | |
1033 | "FOLDER_STARTMENU" | |
1034 | "FOLDER_STARTUP" | |
1035 | "INFOFILENAME" | |
1036 | "ISRES" | |
1037 | "ISUSER" | |
1038 | "ISVERSION" | |
1039 | "MEDIA" | |
1040 | "MODE" | |
1041 | "PROGRAMFILES" | |
1042 | "SELECTED_LANGUAGE" | |
1043 | "SRCDIR" | |
1044 | "SRCDISK" | |
1045 | "SUPPORTDIR" | |
1046 | "TARGETDIR" | |
1047 | "TARGETDISK" | |
1048 | "UNINST" | |
1049 | "WINDIR" | |
1050 | "WINDISK" | |
1051 | "WINMAJOR" | |
1052 | "WINSYSDIR" | |
1053 | "WINSYSDISK") | |
ef1c5063 RS |
1054 | "System variables used in InstallShield 3 and 5.") |
1055 | ||
82e38f3e LK |
1056 | (defconst installshield-types-list |
1057 | '("BOOL" | |
1058 | "BYREF" | |
1059 | "CHAR" | |
1060 | "HIWORD" | |
1061 | "HWND" | |
1062 | "INT" | |
1063 | "LIST" | |
1064 | "LONG" | |
1065 | "LOWORD" | |
1066 | "LPSTR" | |
1067 | "NUMBER" | |
1068 | "NUMBERLIST" | |
1069 | "POINTER" | |
1070 | "QUAD" | |
1071 | "RGB" | |
1072 | "SHORT" | |
1073 | "STRINGLIST" | |
1074 | "STRING") | |
ef1c5063 RS |
1075 | "Type keywords used in InstallShield 3 and 5.") |
1076 | ||
1077 | ;;; some might want to skip highlighting these to improve performance | |
82e38f3e LK |
1078 | (defconst installshield-funarg-constants-list |
1079 | '("AFTER" | |
1080 | "APPEND" | |
1081 | "ALLCONTENTS" | |
1082 | "BACKBUTTON" | |
1083 | "BACKGROUNDCAPTION" | |
1084 | "BACKGROUND" | |
1085 | "BACK" | |
1086 | "BASEMEMORY" | |
1087 | "BEFORE" | |
1088 | "BIOS" | |
1089 | "BITMAPICON" | |
1090 | "BK_BLUE" | |
1091 | "BK_GREEN" | |
1092 | "BK_RED" | |
1093 | "BLUE" | |
1094 | "BOOTUPDRIVE" | |
1095 | "CANCEL" | |
1096 | "CDROM_DRIVE" | |
1097 | "CDROM" | |
1098 | "CHECKBOX95" | |
1099 | "CHECKBOX" | |
1100 | "CHECKLINE" | |
1101 | "CHECKMARK" | |
1102 | "COLORS" | |
1103 | "COMMANDEX" | |
1104 | "COMMAND" | |
1105 | "COMP_NORMAL" | |
1106 | "COMP_UPDATE_DATE" | |
1107 | "COMP_UPDATE_SAME" | |
1108 | "COMP_UPDATE_VERSION" | |
1109 | "COMPACT" | |
1110 | "CONTINUE" | |
1111 | "CPU" | |
1112 | "CUSTOM" | |
1113 | "DATE" | |
1114 | "DEFWINDOWMODE" | |
1115 | "DIR_WRITEABLE" | |
1116 | "DIRECTORY" | |
1117 | "DISABLE" | |
1118 | "DISK_TOTALSPACE" | |
1119 | "DISK" | |
1120 | "DLG_OPTIONS" | |
1121 | "DLG_PATH" | |
1122 | "DLG_TEXT" | |
1123 | "DLG_ASK_YESNO" | |
1124 | "DLG_ENTER_DISK" | |
1125 | "DLG_ERR" | |
1126 | "DLG_INFO_ALTIMAGE" | |
1127 | "DLG_INFO_CHECKSELECTION" | |
1128 | "DLG_INFO_KUNITS" | |
1129 | "DLG_INFO_USEDECIMAL" | |
1130 | "DLG_MSG_INFORMATION" | |
1131 | "DLG_MSG_SEVERE" | |
1132 | "DLG_MSG_WARNING" | |
1133 | "DLG_STATUS" | |
1134 | "DLG_WARNING" | |
1135 | "DLG_USER_CAPTION" | |
1136 | "DRIVE" | |
1137 | "ENABLE" | |
1138 | "END_OF_FILE" | |
1139 | "END_OF_LIST" | |
1140 | "ENVSPACE" | |
1141 | "EQUALS" | |
1142 | "EXCLUDE_SUBDIR" | |
1143 | "EXCLUSIVE" | |
1144 | "EXISTS" | |
1145 | "EXIT" | |
1146 | "EXTENDED_MEMORY" | |
1147 | "EXTENSION_ONLY" | |
1148 | "FAILIFEXISTS" | |
1149 | "FALSE" | |
1150 | "FEEDBACK_FULL" | |
1151 | "FILE_ATTR_ARCHIVED" | |
1152 | "FILE_ATTR_DIRECTORY" | |
1153 | "FILE_ATTR_HIDDEN" | |
1154 | "FILE_ATTR_NORMAL" | |
1155 | "FILE_ATTR_READONLY" | |
1156 | "FILE_ATTR_SYSTEM" | |
1157 | "FILE_ATTRIBUTE" | |
1158 | "FILE_DATE" | |
1159 | "FILE_LINE_LENGTH" | |
1160 | "FILE_MODE_APPEND" | |
1161 | "FILE_MODE_BINARYREADONLY" | |
1162 | "FILE_MODE_BINARY" | |
1163 | "FILE_MODE_NORMAL" | |
1164 | "FILE_NO_VERSION" | |
1165 | "FILE_NOT_FOUND" | |
1166 | "FILE_SIZE" | |
1167 | "FILE_TIME" | |
1168 | "FILENAME_ONLY" | |
1169 | "FILENAME" | |
1170 | "FIXED_DRIVE" | |
1171 | "FOLDER_DESKTOP" | |
1172 | "FOLDER_PROGRAMS" | |
1173 | "FOLDER_STARTMENU" | |
1174 | "FOLDER_STARTUP" | |
1175 | "FREEENVSPACE" | |
1176 | "FULLWINDOWMODE" | |
1177 | "FULL" | |
1178 | "FONT_TITLE" | |
1179 | "GREATER_THAN" | |
1180 | "GREEN" | |
1181 | "HKEY_CLASSES_ROOT" | |
1182 | "HKEY_CURRENT_USER" | |
1183 | "HKEY_LOCAL_MACHINE" | |
1184 | "HKEY_USERS" | |
1185 | "HOURGLASS" | |
1186 | "INCLUDE_SUBDIR" | |
1187 | "INDVFILESTATUS" | |
1188 | "INFORMATION" | |
1189 | "IS_WINDOWSNT" | |
1190 | "IS_WINDOWS95" | |
1191 | "IS_WINDOWS" | |
1192 | "IS_WIN32S" | |
1193 | "ISTYPE" | |
1194 | "LANGUAGE_DRV" | |
1195 | "LANGUAGE" | |
1196 | "LESS_THAN" | |
1197 | "LIST_NULL" | |
1198 | "LISTFIRST" | |
1199 | "LISTNEXT" | |
1200 | "LOCKEDFILE" | |
1201 | "LOGGING" | |
1202 | "LOWER_LEFT" | |
1203 | "LOWER_RIGHT" | |
1204 | "MAGENTA" | |
1205 | "MOUSE_DRV" | |
1206 | "MOUSE" | |
1207 | "NETWORK_DRV" | |
1208 | "NETWORK" | |
1209 | "NEXT" | |
1210 | "NONEXCLUSIVE" | |
1211 | "NORMALMODE" | |
1212 | "NOSET" | |
1213 | "NOTEXISTS" | |
1214 | "NOWAIT" | |
1215 | "NO" | |
1216 | "OFF" | |
1217 | "ONLYDIR" | |
1218 | "ON" | |
1219 | "OSMAJOR" | |
1220 | "OSMINOR" | |
1221 | "OS" | |
1222 | "OTHER_FAILURE" | |
1223 | "PARALLEL" | |
1224 | "PARTIAL" | |
1225 | "PATH_EXISTS" | |
1226 | "PATH" | |
1227 | "RED" | |
1228 | "REGDB_APPPATH_DEFAULT" | |
1229 | "REGDB_APPPATH" | |
1230 | "REGDB_BINARY" | |
1231 | "REGDB_ERR_CONNECTIONEXISTS" | |
fe3c5669 | 1232 | "REGDB_ERR_CORRUPTEDREGISTRY" |
82e38f3e LK |
1233 | "REGDB_ERR_INITIALIZATION" |
1234 | "REGDB_ERR_INVALIDHANDLE" | |
1235 | "REGDB_ERR_INVALIDNAME" | |
1236 | "REGDB_NUMBER" | |
1237 | "REGDB_STRING_EXPAND" | |
1238 | "REGDB_STRING_MULTI" | |
1239 | "REGDB_STRING" | |
1240 | "REGDB_UNINSTALL_NAME" | |
1241 | "REMOTE_DRIVE" | |
09e80d9f | 1242 | "REMOVEABLE_DRIVE" |
82e38f3e LK |
1243 | "REPLACE_ITEM" |
1244 | "REPLACE" | |
1245 | "RESET" | |
1246 | "RESTART" | |
1247 | "ROOT" | |
1248 | "SELFREGISTER" | |
1249 | "SERIAL" | |
1250 | "SET" | |
1251 | "SEVERE" | |
1252 | "SHAREDFILE" | |
1253 | "SHARE" | |
1254 | "SILENTMODE" | |
1255 | "SRCTARGETDIR" | |
1256 | "STATUSBAR" | |
1257 | "STATUSDLG" | |
1258 | "STATUSOLD" | |
1259 | "STATUS" | |
1260 | "STYLE_NORMAL" | |
1261 | "SW_MAXIMIZE" | |
1262 | "SW_MINIMIZE" | |
1263 | "SW_RESTORE" | |
1264 | "SW_SHOW" | |
1265 | "SYS_BOOTMACHINE" | |
1266 | "TIME" | |
1267 | "TRUE" | |
1268 | "TYPICAL" | |
1269 | "UPPER_LEFT" | |
1270 | "UPPER_RIGHT" | |
1271 | "VALID_PATH" | |
1272 | "VERSION" | |
1273 | "VIDEO" | |
1274 | "VOLUMELABEL" | |
1275 | "YELLOW" | |
1276 | "YES" | |
1277 | "WAIT" | |
1278 | "WARNING" | |
1279 | "WINMAJOR" | |
1280 | "WINMINOR" | |
1281 | "WIN32SINSTALLED" | |
1282 | "WIN32SMAJOR" | |
1283 | "WIN32SMINOR") | |
1284 | "Function argument constants used in InstallShield 3 and 5.")) | |
ca1e63a5 | 1285 | |
1c3ac2e5 GM |
1286 | ;; c++-mode-syntax-table used to be autoloaded, with an initial nil value. |
1287 | ;; This file did not load cc-mode, and therefore rul-generic-mode-syntax-table | |
1288 | ;; would have different values according to whether or not cc-mode | |
1289 | ;; happened to be loaded before this file was. | |
1290 | (require 'cc-mode) | |
1291 | (defvar c++-mode-syntax-table) | |
1292 | ||
1293 | (defvar rul-generic-mode-syntax-table | |
1294 | (let ((table (make-syntax-table c++-mode-syntax-table))) | |
1295 | (modify-syntax-entry ?\r "> b" table) | |
1296 | (modify-syntax-entry ?\n "> b" table) | |
1297 | (modify-syntax-entry ?/ ". 124b" table) | |
1298 | (modify-syntax-entry ?* ". 23" table) | |
1299 | table) | |
1fffafda | 1300 | "Syntax table to use in `rul-generic-mode' buffers.") |
d8677156 | 1301 | |
d8677156 LK |
1302 | ;; here manually instead |
1303 | (defun generic-rul-mode-setup-function () | |
82e38f3e LK |
1304 | (make-local-variable 'parse-sexp-ignore-comments) |
1305 | (make-local-variable 'comment-start) | |
1306 | (make-local-variable 'comment-start-skip) | |
1307 | (make-local-variable 'comment-end) | |
d8677156 LK |
1308 | (setq imenu-generic-expression |
1309 | '((nil "^function\\s-+\\([A-Za-z0-9_]+\\)" 1)) | |
1310 | parse-sexp-ignore-comments t | |
1311 | comment-end "*/" | |
1312 | comment-start "/*" | |
1313 | ;;; comment-end "" | |
1314 | ;;; comment-start "//" | |
1315 | ;;; comment-start-skip "" | |
1316 | ) | |
82e38f3e | 1317 | ;; (set-syntax-table rul-generic-mode-syntax-table) |
d8677156 LK |
1318 | (setq font-lock-syntax-table rul-generic-mode-syntax-table)) |
1319 | ||
1320 | ;; moved mode-definition behind defun-definition to be warning-free - 15.11.02/RSan | |
1321 | (define-generic-mode rul-generic-mode | |
1322 | ;; Using "/*" and "*/" doesn't seem to be working right | |
82e38f3e LK |
1323 | '("//" ("/*" . "*/" )) |
1324 | (eval-when-compile installshield-statement-keyword-list) | |
1325 | (eval-when-compile | |
1326 | (list | |
1327 | ;; preprocessor constructs | |
1328 | '("#[ \t]*include[ \t]+\\(<[^>\"\n]+>\\)" | |
1329 | 1 font-lock-string-face) | |
1330 | '("#[ \t]*\\(\\sw+\\)\\>[ \t]*\\(\\sw+\\)?" | |
6c27f0f8 | 1331 | (1 font-lock-constant-face) |
82e38f3e LK |
1332 | (2 font-lock-variable-name-face nil t)) |
1333 | ;; indirect string constants | |
1334 | '("\\(@[A-Za-z][A-Za-z0-9_]+\\)" 1 font-lock-builtin-face) | |
1335 | ;; gotos | |
6c27f0f8 | 1336 | '("[ \t]*\\(\\sw+:\\)" 1 font-lock-constant-face) |
82e38f3e LK |
1337 | '("\\<\\(goto\\)\\>[ \t]*\\(\\sw+\\)?" |
1338 | (1 font-lock-keyword-face) | |
6c27f0f8 | 1339 | (2 font-lock-constant-face nil t)) |
82e38f3e | 1340 | ;; system variables |
9445f99b GM |
1341 | (list (concat "[^_]" |
1342 | (regexp-opt installshield-system-variables-list 'symbols) | |
1343 | "[^_]") | |
1344 | 1 font-lock-variable-name-face) | |
82e38f3e | 1345 | ;; system functions |
9445f99b GM |
1346 | (list (concat "[^_]" |
1347 | (regexp-opt installshield-system-functions-list 'symbols) | |
1348 | "[^_]") | |
1349 | 1 font-lock-function-name-face) | |
82e38f3e | 1350 | ;; type keywords |
9445f99b GM |
1351 | (list (concat "[^_]" |
1352 | (regexp-opt installshield-types-list 'symbols) | |
1353 | "[^_]") | |
1354 | 1 font-lock-type-face) | |
82e38f3e | 1355 | ;; function argument constants |
9445f99b GM |
1356 | (list (concat "[^_]" |
1357 | (regexp-opt installshield-funarg-constants-list 'symbols) | |
1358 | "[^_]") | |
1359 | 1 font-lock-variable-name-face))) ; is this face the best choice? | |
60c19d5e | 1360 | '("\\.[rR][uU][lL]\\'") |
82e38f3e | 1361 | '(generic-rul-mode-setup-function) |
d4fb185d | 1362 | "Generic mode for InstallShield RUL files.") |
d8677156 | 1363 | |
ca1e63a5 | 1364 | (define-skeleton rul-if |
d8677156 LK |
1365 | "Insert an if statement." |
1366 | "condition: " | |
1367 | "if(" str ") then" \n | |
1368 | > _ \n | |
1369 | ( "other condition, %s: " | |
1370 | > "elseif(" str ") then" \n | |
1371 | > \n) | |
1372 | > "else" \n | |
1373 | > \n | |
1374 | resume: | |
1375 | > "endif;") | |
ca1e63a5 RS |
1376 | |
1377 | (define-skeleton rul-function | |
1378 | "Insert a function statement." | |
1379 | "function: " | |
1380 | "function " str " ()" \n | |
1381 | ( "local variables, %s: " | |
d8677156 | 1382 | > " " str ";" \n) |
ca1e63a5 RS |
1383 | > "begin" \n |
1384 | > _ \n | |
1385 | resume: | |
d8677156 | 1386 | > "end;")) |
ca1e63a5 RS |
1387 | |
1388 | ;; Additions by ACorreir@pervasive-sw.com (Alfred Correira) | |
1fffafda LK |
1389 | (when (memq 'mailrc-generic-mode generic-extras-enable-list) |
1390 | ||
d8677156 | 1391 | (define-generic-mode mailrc-generic-mode |
82e38f3e LK |
1392 | '(?#) |
1393 | '("alias" | |
1394 | "else" | |
1395 | "endif" | |
1396 | "group" | |
1397 | "if" | |
1398 | "ignore" | |
1399 | "set" | |
1400 | "source" | |
1401 | "unset") | |
ca1e63a5 | 1402 | '(("^\\s-*\\(alias\\|group\\)\\s-+\\([-A-Za-z0-9_]+\\)\\s-+\\([^\n\r#]*\\)\\(#.*\\)?$" |
16a013c2 LK |
1403 | (2 font-lock-constant-face) |
1404 | (3 font-lock-variable-name-face)) | |
ca1e63a5 | 1405 | ("^\\s-*\\(unset\\|set\\|ignore\\)\\s-+\\([-A-Za-z0-9_]+\\)=?\\([^\n\r#]*\\)\\(#.*\\)?$" |
16a013c2 LK |
1406 | (2 font-lock-constant-face) |
1407 | (3 font-lock-variable-name-face)) | |
5d1c5247 FP |
1408 | ("^\\s-*\\(source\\)\\s-+\\([^\n\r#]*\\)\\(#.*\\)?$" |
1409 | (2 font-lock-variable-name-face))) | |
82e38f3e | 1410 | '("\\.mailrc\\'") |
ca1e63a5 | 1411 | nil |
d4fb185d | 1412 | "Mode for mailrc files.")) |
ca1e63a5 | 1413 | |
bb53e1ee | 1414 | ;; Inetd.conf |
d8677156 | 1415 | (when (memq 'inetd-conf-generic-mode generic-extras-enable-list) |
bb53e1ee | 1416 | |
d8677156 | 1417 | (define-generic-mode inetd-conf-generic-mode |
82e38f3e LK |
1418 | '(?#) |
1419 | '("stream" | |
1420 | "dgram" | |
1421 | "tcp" | |
1422 | "udp" | |
1423 | "wait" | |
1424 | "nowait" | |
1425 | "internal") | |
1426 | '(("^\\([-A-Za-z0-9_]+\\)" 1 font-lock-type-face)) | |
bb53e1ee | 1427 | '("/etc/inetd.conf\\'") |
ffe0c7ef | 1428 | (list |
bb53e1ee RS |
1429 | (function |
1430 | (lambda () | |
ffe0c7ef | 1431 | (setq imenu-generic-expression |
d4fb185d | 1432 | '((nil "^\\([-A-Za-z0-9_]+\\)" 1)))))))) |
bb53e1ee RS |
1433 | |
1434 | ;; Services | |
d8677156 | 1435 | (when (memq 'etc-services-generic-mode generic-extras-enable-list) |
bb53e1ee | 1436 | |
d8677156 | 1437 | (define-generic-mode etc-services-generic-mode |
82e38f3e LK |
1438 | '(?#) |
1439 | '("tcp" | |
1440 | "udp" | |
1441 | "ddp") | |
d8677156 | 1442 | '(("^\\([-A-Za-z0-9_]+\\)\\s-+\\([0-9]+\\)/" |
82e38f3e LK |
1443 | (1 font-lock-type-face) |
1444 | (2 font-lock-variable-name-face))) | |
bb53e1ee | 1445 | '("/etc/services\\'") |
ffe0c7ef | 1446 | (list |
bb53e1ee RS |
1447 | (function |
1448 | (lambda () | |
ffe0c7ef | 1449 | (setq imenu-generic-expression |
d4fb185d | 1450 | '((nil "^\\([-A-Za-z0-9_]+\\)" 1)))))))) |
bb53e1ee RS |
1451 | |
1452 | ;; Password and Group files | |
d8677156 | 1453 | (when (memq 'etc-passwd-generic-mode generic-extras-enable-list) |
bb53e1ee | 1454 | |
d8677156 | 1455 | (define-generic-mode etc-passwd-generic-mode |
bb53e1ee | 1456 | nil ;; No comment characters |
82e38f3e LK |
1457 | '("root") ;; Only one keyword |
1458 | (eval-when-compile | |
1459 | (list | |
1460 | (list | |
1461 | (concat | |
1462 | "^" | |
1463 | ;; User name -- Never blank! | |
1464 | "\\([^:]+\\)" | |
1465 | ":" | |
1466 | ;; Password, UID and GID | |
1467 | (mapconcat | |
1468 | 'identity | |
1469 | (make-list 3 "\\([^:]+\\)") | |
1470 | ":") | |
1471 | ":" | |
1472 | ;; GECOS/Name -- might be blank | |
1473 | "\\([^:]*\\)" | |
1474 | ":" | |
1475 | ;; Home directory and shell | |
1476 | "\\([^:]+\\)" | |
1477 | ":?" | |
1478 | "\\([^:]*\\)" | |
1479 | "$") | |
1480 | '(1 font-lock-type-face) | |
1481 | '(5 font-lock-variable-name-face) | |
1482 | '(6 font-lock-constant-face) | |
1483 | '(7 font-lock-warning-face)) | |
1484 | '("^\\([^:]+\\):\\([^:]*\\):\\([0-9]+\\):\\(.*\\)$" | |
1485 | (1 font-lock-type-face) | |
1486 | (4 font-lock-variable-name-face)))) | |
bb53e1ee | 1487 | '("/etc/passwd\\'" "/etc/group\\'") |
ffe0c7ef | 1488 | (list |
bb53e1ee RS |
1489 | (function |
1490 | (lambda () | |
ffe0c7ef | 1491 | (setq imenu-generic-expression |
d4fb185d | 1492 | '((nil "^\\([-A-Za-z0-9_]+\\):" 1)))))))) |
bb53e1ee | 1493 | |
7aeb9d6f | 1494 | ;; Fstab |
d8677156 | 1495 | (when (memq 'etc-fstab-generic-mode generic-extras-enable-list) |
7aeb9d6f | 1496 | |
d8677156 | 1497 | (define-generic-mode etc-fstab-generic-mode |
82e38f3e LK |
1498 | '(?#) |
1499 | '("adfs" | |
1500 | "affs" | |
1501 | "autofs" | |
1502 | "coda" | |
1503 | "coherent" | |
1504 | "cramfs" | |
1505 | "devpts" | |
1506 | "efs" | |
1507 | "ext2" | |
1508 | "ext3" | |
cba6e77e | 1509 | "ext4" |
82e38f3e LK |
1510 | "hfs" |
1511 | "hpfs" | |
1512 | "iso9660" | |
1513 | "jfs" | |
1514 | "minix" | |
1515 | "msdos" | |
1516 | "ncpfs" | |
1517 | "nfs" | |
1518 | "ntfs" | |
1519 | "proc" | |
1520 | "qnx4" | |
1521 | "reiserfs" | |
1522 | "romfs" | |
1523 | "smbfs" | |
3e54ab6c LH |
1524 | "cifs" |
1525 | "usbdevfs" | |
82e38f3e | 1526 | "sysv" |
cba6e77e | 1527 | "sysfs" |
82e38f3e LK |
1528 | "tmpfs" |
1529 | "udf" | |
1530 | "ufs" | |
1531 | "umsdos" | |
1532 | "vfat" | |
1533 | "xenix" | |
1534 | "xfs" | |
1535 | "swap" | |
1536 | "auto" | |
1537 | "ignore") | |
3e54ab6c | 1538 | '(("^\\([^# \t]+\\)\\s-+\\([^# \t]+\\)" |
60c19d5e LK |
1539 | (1 font-lock-type-face t) |
1540 | (2 font-lock-variable-name-face t))) | |
7aeb9d6f PB |
1541 | '("/etc/[v]*fstab\\'") |
1542 | (list | |
1543 | (function | |
1544 | (lambda () | |
1545 | (setq imenu-generic-expression | |
3e54ab6c | 1546 | '((nil "^\\([^# \t]+\\)\\s-+" 1)))))))) |
bb53e1ee | 1547 | |
5f33ef98 RS |
1548 | ;; /etc/sudoers |
1549 | (when (memq 'etc-sudoers-generic-mode generic-extras-enable-list) | |
1550 | ||
1551 | (define-generic-mode etc-sudoers-generic-mode | |
1552 | '(?#) | |
1553 | '("User_Alias" "Runas_Alias" "Host_Alias" "Cmnd_Alias" | |
1554 | "NOPASSWD" "PASSWD" "NOEXEC" "EXEC" | |
1555 | "ALL") | |
1556 | '(("\\<\\(root\\|su\\)\\>" 1 font-lock-warning-face) | |
1557 | ("\\(\\*\\)" 1 font-lock-warning-face) | |
1558 | ("\\<\\(%[A-Za-z0-9_]+\\)\\>" 1 font-lock-variable-name-face)) | |
1559 | '("/etc/sudoers\\'") | |
1560 | nil | |
1561 | "Generic mode for sudoers configuration files.")) | |
1562 | ||
bb53e1ee | 1563 | ;; From Jacques Duthen <jacques.duthen@sncf.fr> |
1fffafda LK |
1564 | (when (memq 'show-tabs-generic-mode generic-extras-enable-list) |
1565 | ||
16a013c2 LK |
1566 | (eval-when-compile |
1567 | ||
1568 | (defconst show-tabs-generic-mode-font-lock-defaults-1 | |
82e38f3e | 1569 | '(;; trailing spaces must come before... |
f0b3dcbf | 1570 | ("[ \t]+$" . 'show-tabs-space) |
d8677156 | 1571 | ;; ...embedded tabs |
f0b3dcbf | 1572 | ("[^\n\t]\\(\t+\\)" (1 'show-tabs-tab)))) |
bb53e1ee | 1573 | |
16a013c2 | 1574 | (defconst show-tabs-generic-mode-font-lock-defaults-2 |
82e38f3e | 1575 | '(;; trailing spaces must come before... |
f0b3dcbf | 1576 | ("[ \t]+$" . 'show-tabs-space) |
d8677156 | 1577 | ;; ...tabs |
f0b3dcbf | 1578 | ("\t+" . 'show-tabs-tab)))) |
bb53e1ee | 1579 | |
f0b3dcbf | 1580 | (defface show-tabs-tab |
16a013c2 LK |
1581 | '((((class grayscale) (background light)) (:background "DimGray" :weight bold)) |
1582 | (((class grayscale) (background dark)) (:background "LightGray" :weight bold)) | |
ea81d57e DN |
1583 | (((class color) (min-colors 88)) (:background "red1")) |
1584 | (((class color)) (:background "red")) | |
1fd714a4 | 1585 | (t (:weight bold))) |
bb53e1ee | 1586 | "Font Lock mode face used to highlight TABs." |
d4fb185d | 1587 | :group 'generic-x) |
c4f6e489 | 1588 | (define-obsolete-face-alias 'show-tabs-tab-face 'show-tabs-tab "22.1") |
bb53e1ee | 1589 | |
f0b3dcbf | 1590 | (defface show-tabs-space |
16a013c2 LK |
1591 | '((((class grayscale) (background light)) (:background "DimGray" :weight bold)) |
1592 | (((class grayscale) (background dark)) (:background "LightGray" :weight bold)) | |
ea81d57e DN |
1593 | (((class color) (min-colors 88)) (:background "yellow1")) |
1594 | (((class color)) (:background "yellow")) | |
1fd714a4 | 1595 | (t (:weight bold))) |
bb53e1ee | 1596 | "Font Lock mode face used to highlight spaces." |
d4fb185d | 1597 | :group 'generic-x) |
c4f6e489 | 1598 | (define-obsolete-face-alias 'show-tabs-space-face 'show-tabs-space "22.1") |
bb53e1ee | 1599 | |
d8677156 | 1600 | (define-generic-mode show-tabs-generic-mode |
82e38f3e LK |
1601 | nil ;; no comment char |
1602 | nil ;; no keywords | |
16a013c2 | 1603 | (eval-when-compile show-tabs-generic-mode-font-lock-defaults-1) |
82e38f3e LK |
1604 | nil ;; no auto-mode-alist |
1605 | ;; '(show-tabs-generic-mode-hook-fun) | |
bb53e1ee | 1606 | nil |
76ee7bd5 | 1607 | "Generic mode to show tabs and trailing spaces.")) |
bb53e1ee | 1608 | |
ffe0c7ef PB |
1609 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
1610 | ;; DNS modes | |
1611 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
1612 | ||
1fffafda LK |
1613 | (when (memq 'named-boot-generic-mode generic-extras-enable-list) |
1614 | ||
d8677156 LK |
1615 | (define-generic-mode named-boot-generic-mode |
1616 | ;; List of comment characters | |
82e38f3e | 1617 | '(?\;) |
d8677156 | 1618 | ;; List of keywords |
82e38f3e LK |
1619 | '("cache" "primary" "secondary" "forwarders" "limit" "options" |
1620 | "directory" "check-names") | |
d8677156 | 1621 | ;; List of additional font-lock-expressions |
d1501442 | 1622 | '(("\\([0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+\\)" 1 font-lock-constant-face) |
82e38f3e LK |
1623 | ("^directory\\s-+\\(.*\\)" 1 font-lock-variable-name-face) |
1624 | ("^\\(primary\\|cache\\)\\s-+\\([.A-Za-z]+\\)\\s-+\\(.*\\)" | |
1625 | (2 font-lock-variable-name-face) | |
1626 | (3 font-lock-constant-face))) | |
d8677156 | 1627 | ;; List of additional automode-alist expressions |
82e38f3e | 1628 | '("/etc/named.boot\\'") |
d8677156 | 1629 | ;; List of set up functions to call |
d4fb185d | 1630 | nil)) |
1fffafda LK |
1631 | |
1632 | (when (memq 'named-database-generic-mode generic-extras-enable-list) | |
ffe0c7ef | 1633 | |
d8677156 LK |
1634 | (define-generic-mode named-database-generic-mode |
1635 | ;; List of comment characters | |
82e38f3e | 1636 | '(?\;) |
d8677156 | 1637 | ;; List of keywords |
82e38f3e | 1638 | '("IN" "NS" "CNAME" "SOA" "PTR" "MX" "A") |
d8677156 | 1639 | ;; List of additional font-lock-expressions |
d1501442 | 1640 | '(("\\([0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+\\)" 1 font-lock-constant-face) |
82e38f3e | 1641 | ("^\\([.A-Za-z0-9]+\\)" 1 font-lock-variable-name-face)) |
60c19d5e | 1642 | ;; List of additional auto-mode-alist expressions |
ffe0c7ef | 1643 | nil |
d8677156 | 1644 | ;; List of set up functions to call |
d4fb185d | 1645 | nil) |
ffe0c7ef PB |
1646 | |
1647 | (defvar named-database-time-string "%Y%m%d%H" | |
1648 | "Timestring for named serial numbers.") | |
1649 | ||
1650 | (defun named-database-print-serial () | |
1651 | "Print a serial number based on the current date." | |
1652 | (interactive) | |
1fffafda LK |
1653 | (insert (format-time-string named-database-time-string (current-time))))) |
1654 | ||
1655 | (when (memq 'resolve-conf-generic-mode generic-extras-enable-list) | |
ffe0c7ef | 1656 | |
d8677156 LK |
1657 | (define-generic-mode resolve-conf-generic-mode |
1658 | ;; List of comment characters | |
82e38f3e | 1659 | '(?#) |
d8677156 | 1660 | ;; List of keywords |
82e38f3e | 1661 | '("nameserver" "domain" "search" "sortlist" "options") |
d8677156 | 1662 | ;; List of additional font-lock-expressions |
ffe0c7ef | 1663 | nil |
60c19d5e | 1664 | ;; List of additional auto-mode-alist expressions |
82e38f3e | 1665 | '("/etc/resolv[e]?.conf\\'") |
d8677156 | 1666 | ;; List of set up functions to call |
d4fb185d | 1667 | nil)) |
ffe0c7ef PB |
1668 | |
1669 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
1670 | ;; Modes for spice and common electrical engineering circuit netlist formats | |
1671 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
1672 | ||
1fffafda LK |
1673 | (when (memq 'spice-generic-mode generic-extras-enable-list) |
1674 | ||
d8677156 | 1675 | (define-generic-mode spice-generic-mode |
ffe0c7ef | 1676 | nil |
82e38f3e LK |
1677 | '("and" |
1678 | "cccs" | |
1679 | "ccvs" | |
1680 | "delay" | |
1681 | "nand" | |
1682 | "nor" | |
1683 | "npwl" | |
1684 | "or" | |
1685 | "par" | |
1686 | "ppwl" | |
1687 | "pwl" | |
1688 | "vccap" | |
1689 | "vccs" | |
1690 | "vcr" | |
1691 | "vcvs") | |
1692 | '(("^\\s-*\\([*].*\\)" 1 font-lock-comment-face) | |
1693 | (" \\(\\$ .*\\)$" 1 font-lock-comment-face) | |
1694 | ("^\\(\\$ .*\\)$" 1 font-lock-comment-face) | |
1695 | ("\\([*].*\\)" 1 font-lock-comment-face) | |
1696 | ("^\\([+]\\)" 1 font-lock-string-face) | |
1697 | ("^\\s-*\\([.]\\w+\\>\\)" 1 font-lock-keyword-face) | |
1698 | ("\\(\\([.]\\|_\\|\\w\\)+\\)\\s-*=" 1 font-lock-variable-name-face) | |
1699 | ("\\('[^']+'\\)" 1 font-lock-string-face) | |
1700 | ("\\(\"[^\"]+\"\\)" 1 font-lock-string-face)) | |
1701 | '("\\.[sS][pP]\\'" | |
1702 | "\\.[sS][pP][iI]\\'" | |
1703 | "\\.[sS][pP][iI][cC][eE]\\'" | |
1704 | "\\.[iI][nN][cC]\\'") | |
ffe0c7ef PB |
1705 | (list |
1706 | 'generic-bracket-support | |
1707 | ;; Make keywords case-insensitive | |
1708 | (function | |
1709 | (lambda() | |
16a013c2 | 1710 | (setq font-lock-defaults '(generic-font-lock-keywords nil t))))) |
d4fb185d | 1711 | "Generic mode for SPICE circuit netlist files.")) |
1fffafda LK |
1712 | |
1713 | (when (memq 'ibis-generic-mode generic-extras-enable-list) | |
ffe0c7ef | 1714 | |
d8677156 | 1715 | (define-generic-mode ibis-generic-mode |
82e38f3e | 1716 | '(?|) |
ffe0c7ef | 1717 | nil |
82e38f3e LK |
1718 | '(("[[]\\([^]]*\\)[]]" 1 font-lock-keyword-face) |
1719 | ("\\(\\(_\\|\\w\\)+\\)\\s-*=" 1 font-lock-variable-name-face)) | |
1720 | '("\\.[iI][bB][sS]\\'") | |
1721 | '(generic-bracket-support) | |
d4fb185d | 1722 | "Generic mode for IBIS circuit netlist files.")) |
1fffafda LK |
1723 | |
1724 | (when (memq 'astap-generic-mode generic-extras-enable-list) | |
ffe0c7ef | 1725 | |
d8677156 | 1726 | (define-generic-mode astap-generic-mode |
ffe0c7ef | 1727 | nil |
82e38f3e LK |
1728 | '("analyze" |
1729 | "description" | |
1730 | "elements" | |
1731 | "execution" | |
1732 | "features" | |
1733 | "functions" | |
1734 | "ground" | |
1735 | "model" | |
1736 | "outputs" | |
1737 | "print" | |
1738 | "run" | |
1739 | "controls" | |
1740 | "table") | |
1741 | '(("^\\s-*\\([*].*\\)" 1 font-lock-comment-face) | |
1742 | (";\\s-*\\([*].*\\)" 1 font-lock-comment-face) | |
1743 | ("^\\s-*\\([.]\\w+\\>\\)" 1 font-lock-keyword-face) | |
1744 | ("\\('[^']+'\\)" 1 font-lock-string-face) | |
1745 | ("\\(\"[^\"]+\"\\)" 1 font-lock-string-face) | |
1746 | ("[(,]\\s-*\\(\\([.]\\|_\\|\\w\\)+\\)\\s-*=" 1 font-lock-variable-name-face)) | |
1747 | '("\\.[aA][pP]\\'" | |
1748 | "\\.[aA][sS][xX]\\'" | |
1749 | "\\.[aA][sS][tT][aA][pP]\\'" | |
1750 | "\\.[pP][sS][pP]\\'" | |
1751 | "\\.[dD][eE][cC][kK]\\'" | |
1752 | "\\.[gG][oO][dD][aA][tT][aA]") | |
ffe0c7ef PB |
1753 | (list |
1754 | 'generic-bracket-support | |
1755 | ;; Make keywords case-insensitive | |
1756 | (function | |
1757 | (lambda() | |
16a013c2 | 1758 | (setq font-lock-defaults '(generic-font-lock-keywords nil t))))) |
d4fb185d | 1759 | "Generic mode for ASTAP circuit netlist files.")) |
1fffafda LK |
1760 | |
1761 | (when (memq 'etc-modules-conf-generic-mode generic-extras-enable-list) | |
ffe0c7ef | 1762 | |
d8677156 LK |
1763 | (define-generic-mode etc-modules-conf-generic-mode |
1764 | ;; List of comment characters | |
82e38f3e | 1765 | '(?#) |
d8677156 | 1766 | ;; List of keywords |
82e38f3e LK |
1767 | '("above" |
1768 | "alias" | |
1769 | "below" | |
1770 | "define" | |
1771 | "depfile" | |
1772 | "else" | |
1773 | "elseif" | |
1774 | "endif" | |
1775 | "if" | |
1776 | "include" | |
1777 | "insmod_opt" | |
1778 | "install" | |
1779 | "keep" | |
1780 | "options" | |
1781 | "path" | |
1782 | "generic_stringfile" | |
1783 | "pcimapfile" | |
1784 | "isapnpmapfile" | |
1785 | "usbmapfile" | |
1786 | "parportmapfile" | |
1787 | "ieee1394mapfile" | |
1788 | "pnpbiosmapfile" | |
1789 | "probe" | |
1790 | "probeall" | |
1791 | "prune" | |
1792 | "post-install" | |
1793 | "post-remove" | |
1794 | "pre-install" | |
1795 | "pre-remove" | |
1796 | "remove" | |
1797 | "persistdir") | |
d8677156 | 1798 | ;; List of additional font-lock-expressions |
9845e669 | 1799 | nil |
d8677156 | 1800 | ;; List of additional automode-alist expressions |
82e38f3e | 1801 | '("/etc/modules.conf" "/etc/conf.modules") |
d8677156 | 1802 | ;; List of set up functions to call |
d4fb185d | 1803 | nil)) |
ffe0c7ef | 1804 | |
ca1e63a5 RS |
1805 | (provide 'generic-x) |
1806 | ||
1807 | ;;; generic-x.el ends here |