Fix typos.
[bpt/emacs.git] / lisp / generic-x.el
CommitLineData
1fffafda 1;;; generic-x.el --- A collection of generic modes
ca1e63a5 2
73b0cd50 3;; Copyright (C) 1997-1998, 2001-2011 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;;
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
4b8643d3 123 "If non-nil, add a hook to enter `default-generic-mode' automatically.
9285b8bc
LK
124This is done if the first few lines of a file in fundamental mode
125start 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
131Relevant when deciding whether to enter Default-Generic mode automatically.
132This 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
138Files in fundamental mode whose first few lines contain a match
139for this regexp, should be put into Default-Generic mode instead.
140The number of lines tested for the matches is specified by the
141value 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
147Files whose names match this regular expression should not be put
148into Default-Generic mode, even if they have lines which match
149the 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
164Done if the first few lines of a file in Fundamental mode start
165with a match for the regexp in `generic-find-file-regexp', unless
166the file's name matches the regexp which is the value of the
167variable `generic-ignore-files-regexp'.
168
169This 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
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)
4b8643d3 240 "List of generic modes that are not defined by default.")
ca1e63a5 241
ffe0c7ef 242(defcustom generic-define-mswindows-modes
d8677156 243 (memq system-type '(windows-nt ms-dos))
4b8643d3 244 "Non-nil means the modes in `generic-mswindows-modes' will be defined.
1fffafda 245This is a list of MS-Windows specific generic modes. This variable
76ee7bd5 246only 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)))
4b8643d3 254 "Non-nil means the modes in `generic-unix-modes' will be defined.
1fffafda 255This is a list of Unix specific generic modes. This variable only
76ee7bd5 256affects 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.
268Each entry in the list should be a symbol. If you set this variable
269directly, without using customize, you must reload generic-x to put
270your 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
4b8643d3 319 "Generic 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")
d1501442 379 '(("\\([0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+\\)" 1 font-lock-constant-face))
82e38f3e 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.
418You can use `ini-generic-mode-find-file-hook' to enter this mode
d4fb185d 419automatically 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.
423Done if the first few lines of a file in Fundamental mode look
424like 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)
dfc6544c 511 '("[\t ]+\\([+-/][^\t\n\" ]+\\)" 1 font-lock-type-face)
82e38f3e
LK
512 '("[ \t\n|]\\<\\([gG][oO][tT][oO]\\)\\>[ \t]*\\(\\sw+\\)?"
513 (1 font-lock-keyword-face)
514 (2 font-lock-function-name-face nil t))
515 '("[ \t\n|]\\<\\([sS][eE][tT]\\)\\>[ \t]*\\(\\sw+\\)?[ \t]*=?"
516 (1 font-lock-builtin-face)
517 (2 font-lock-variable-name-face t t))))
518 '("\\.[bB][aA][tT]\\'"
6453a10e 519 "\\.[cC][mM][dD]\\'"
82e38f3e
LK
520 "\\`[cC][oO][nN][fF][iI][gG]\\."
521 "\\`[aA][uU][tT][oO][eE][xX][eE][cC]\\.")
522 '(generic-bat-mode-setup-function)
6453a10e 523 "Generic mode for MS-Windows batch files.")
d8677156
LK
524
525(defvar bat-generic-mode-syntax-table nil
1fffafda 526 "Syntax table in use in `bat-generic-mode' buffers.")
d8677156
LK
527
528(defvar bat-generic-mode-keymap (make-sparse-keymap)
76ee7bd5 529 "Keymap for `bat-generic-mode'.")
d8677156
LK
530
531(defun bat-generic-mode-compile ()
532 "Run the current BAT file in a compilation buffer."
533 (interactive)
534 (let ((compilation-buffer-name-function
535 (function
536 (lambda(ign)
537 (concat "*" (buffer-file-name) "*")))))
538 (compile
539 (concat (w32-shell-name) " -c " (buffer-file-name)))))
540
a2d66c78 541(eval-when-compile (require 'comint))
d8677156
LK
542(defun bat-generic-mode-run-as-comint ()
543 "Run the current BAT file in a comint buffer."
544 (interactive)
545 (require 'comint)
546 (let* ((file (buffer-file-name))
547 (buf-name (concat "*" file "*")))
7fdbcd83 548 (with-current-buffer (get-buffer-create buf-name)
d8677156
LK
549 (erase-buffer)
550 (comint-mode)
551 (comint-exec
552 buf-name
553 file
554 (w32-shell-name)
555 nil
556 (list "-c" file))
557 (display-buffer buf-name))))
558
559(define-key bat-generic-mode-keymap "\C-c\C-c" 'bat-generic-mode-compile)
560
561;; Make underscores count as words
562(unless bat-generic-mode-syntax-table
563 (setq bat-generic-mode-syntax-table (make-syntax-table))
16a013c2 564 (modify-syntax-entry ?_ "w" bat-generic-mode-syntax-table))
d8677156 565
16a013c2
LK
566;; bat-generic-mode doesn't use the comment functionality of
567;; define-generic-mode because it has a three-letter comment-string,
568;; so we do it here manually instead
d8677156 569(defun generic-bat-mode-setup-function ()
82e38f3e
LK
570 (make-local-variable 'parse-sexp-ignore-comments)
571 (make-local-variable 'comment-start)
572 (make-local-variable 'comment-start-skip)
573 (make-local-variable 'comment-end)
574 (setq imenu-generic-expression '((nil "^:\\(\\sw+\\)" 1))
d8677156 575 parse-sexp-ignore-comments t
82e38f3e
LK
576 comment-end ""
577 comment-start "REM "
578 comment-start-skip "[Rr][Ee][Mm] *")
579 (set-syntax-table bat-generic-mode-syntax-table)
d8677156 580 ;; Make keywords case-insensitive
16a013c2 581 (setq font-lock-defaults '(generic-font-lock-keywords nil t))
d8677156 582 (use-local-map bat-generic-mode-keymap)))
ca1e63a5
RS
583
584;;; Mailagent
82e38f3e
LK
585;; Mailagent is a Unix mail filtering program. Anyone wanna do a
586;; generic mode for procmail?
d8677156
LK
587(when (memq 'mailagent-rules-generic-mode generic-extras-enable-list)
588
589(define-generic-mode mailagent-rules-generic-mode
82e38f3e
LK
590 '(?#)
591 '("SAVE" "DELETE" "PIPE" "ANNOTATE" "REJECT")
592 '(("^\\(\\sw+\\)\\s-*=" 1 font-lock-variable-name-face)
593 ("\\s-/\\([^/]+\\)/[i, \t\n]" 1 font-lock-constant-face))
594 '("\\.rules\\'")
16a013c2
LK
595 (list
596 (function
597 (lambda ()
598 (setq imenu-generic-expression
599 '((nil "\\s-/\\([^/]+\\)/[i, \t\n]" 1))))))
4b8643d3 600 "Generic mode for Mailagent rules files."))
ca1e63a5
RS
601
602;; Solaris/Sys V prototype files
d8677156
LK
603(when (memq 'prototype-generic-mode generic-extras-enable-list)
604
605(define-generic-mode prototype-generic-mode
82e38f3e 606 '(?#)
d8677156
LK
607 nil
608 '(("^\\([0-9]\\)?\\s-*\\([a-z]\\)\\s-+\\([A-Za-z_]+\\)\\s-+\\([^\n\r]*\\)$"
609 (2 font-lock-constant-face)
610 (3 font-lock-keyword-face))
611 ("^\\([a-z]\\) \\([A-Za-z_]+\\)=\\([^\n\r]*\\)$"
612 (1 font-lock-constant-face)
613 (2 font-lock-keyword-face)
614 (3 font-lock-variable-name-face))
615 ("^\\(!\\s-*\\(search\\|include\\|default\\)\\)\\s-*\\([^\n\r]*\\)$"
616 (1 font-lock-keyword-face)
617 (3 font-lock-variable-name-face))
618 ("^\\(!\\s-*\\sw+\\)=\\([^\n\r]*\\)$"
619 (1 font-lock-keyword-face)
620 (2 font-lock-variable-name-face)))
82e38f3e 621 '("prototype\\'")
d8677156 622 nil
4b8643d3 623 "Generic mode for Sys V prototype files."))
ca1e63a5
RS
624
625;; Solaris/Sys V pkginfo files
d8677156
LK
626(when (memq 'pkginfo-generic-mode generic-extras-enable-list)
627
628(define-generic-mode pkginfo-generic-mode
82e38f3e 629 '(?#)
d8677156
LK
630 nil
631 '(("^\\([A-Za-z_]+\\)=\\([^\n\r]*\\)$"
632 (1 font-lock-keyword-face)
633 (2 font-lock-variable-name-face)))
82e38f3e 634 '("pkginfo\\'")
d8677156 635 nil
4b8643d3 636 "Generic mode for Sys V pkginfo files."))
ca1e63a5
RS
637
638;; Javascript mode
ffe0c7ef 639;; Includes extra keywords from Armando Singer [asinger@MAIL.COLGATE.EDU]
1fffafda
LK
640(when (memq 'javascript-generic-mode generic-extras-enable-list)
641
d8677156 642(define-generic-mode javascript-generic-mode
82e38f3e
LK
643 '("//" ("/*" . "*/"))
644 '("break"
645 "case"
646 "continue"
647 "default"
648 "delete"
649 "do"
650 "else"
651 "export"
652 "for"
653 "function"
654 "if"
655 "import"
656 "in"
657 "new"
658 "return"
659 "switch"
660 "this"
661 "typeof"
662 "var"
663 "void"
664 "while"
665 "with"
666 ;; words reserved for ECMA extensions below
667 "catch"
668 "class"
669 "const"
670 "debugger"
671 "enum"
672 "extends"
673 "finally"
674 "super"
675 "throw"
676 "try"
677 ;; Java Keywords reserved by JavaScript
678 "abstract"
679 "boolean"
680 "byte"
681 "char"
682 "double"
683 "false"
684 "final"
685 "float"
686 "goto"
687 "implements"
688 "instanceof"
689 "int"
690 "interface"
691 "long"
692 "native"
693 "null"
694 "package"
695 "private"
696 "protected"
697 "public"
698 "short"
699 "static"
700 "synchronized"
701 "throws"
702 "transient"
703 "true")
704 '(("^\\s-*function\\s-+\\([A-Za-z0-9_]+\\)"
705 (1 font-lock-function-name-face))
706 ("^\\s-*var\\s-+\\([A-Za-z0-9_]+\\)"
707 (1 font-lock-variable-name-face)))
708 '("\\.js\\'")
ca1e63a5 709 (list
ffe0c7ef 710 (function
ca1e63a5 711 (lambda ()
ffe0c7ef
PB
712 (setq imenu-generic-expression
713 '((nil "^function\\s-+\\([A-Za-z0-9_]+\\)" 1)
d8677156 714 ("*Variables*" "^var\\s-+\\([A-Za-z0-9_]+\\)" 1))))))
4b8643d3 715 "Generic mode for JavaScript files."))
ca1e63a5
RS
716
717;; VRML files
1fffafda
LK
718(when (memq 'vrml-generic-mode generic-extras-enable-list)
719
d8677156 720(define-generic-mode vrml-generic-mode
82e38f3e
LK
721 '(?#)
722 '("DEF"
723 "NULL"
724 "USE"
725 "Viewpoint"
726 "ambientIntensity"
727 "appearance"
728 "children"
729 "color"
730 "coord"
731 "coordIndex"
732 "creaseAngle"
733 "diffuseColor"
734 "emissiveColor"
735 "fieldOfView"
736 "geometry"
737 "info"
738 "material"
739 "normal"
740 "orientation"
741 "position"
742 "shininess"
743 "specularColor"
744 "texCoord"
745 "texture"
746 "textureTransform"
747 "title"
748 "transparency"
749 "type")
750 '(("USE\\s-+\\([-A-Za-z0-9_]+\\)"
751 (1 font-lock-constant-face))
752 ("DEF\\s-+\\([-A-Za-z0-9_]+\\)\\s-+\\([A-Za-z0-9]+\\)\\s-*{"
753 (1 font-lock-type-face)
754 (2 font-lock-constant-face))
755 ("^\\s-*\\([-A-Za-z0-9_]+\\)\\s-*{"
756 (1 font-lock-function-name-face))
757 ("^\\s-*\\(geometry\\|appearance\\|material\\)\\s-+\\([-A-Za-z0-9_]+\\)"
758 (2 font-lock-variable-name-face)))
759 '("\\.wrl\\'")
ca1e63a5 760 (list
ffe0c7ef 761 (function
ca1e63a5 762 (lambda ()
ffe0c7ef 763 (setq imenu-generic-expression
ca1e63a5 764 '((nil "^\\([A-Za-z0-9_]+\\)\\s-*{" 1)
ffe0c7ef 765 ("*Definitions*"
ca1e63a5 766 "DEF\\s-+\\([-A-Za-z0-9_]+\\)\\s-+\\([A-Za-z0-9]+\\)\\s-*{"
d8677156 767 1))))))
d4fb185d 768 "Generic Mode for VRML files."))
ca1e63a5
RS
769
770;; Java Manifests
1fffafda
LK
771(when (memq 'java-manifest-generic-mode generic-extras-enable-list)
772
d8677156 773(define-generic-mode java-manifest-generic-mode
82e38f3e
LK
774 '(?#)
775 '("Name"
776 "Digest-Algorithms"
777 "Manifest-Version"
778 "Required-Version"
779 "Signature-Version"
780 "Magic"
781 "Java-Bean"
782 "Depends-On")
ca1e63a5
RS
783 '(("^Name:\\s-+\\([^\n\r]*\\)$"
784 (1 font-lock-variable-name-face))
785 ("^\\(Manifest\\|Required\\|Signature\\)-Version:\\s-+\\([^\n\r]*\\)$"
d8677156 786 (2 font-lock-constant-face)))
82e38f3e 787 '("[mM][aA][nN][iI][fF][eE][sS][tT]\\.[mM][fF]\\'")
ca1e63a5 788 nil
4b8643d3 789 "Generic mode for Java Manifest files."))
ca1e63a5
RS
790
791;; Java properties files
1fffafda
LK
792(when (memq 'java-properties-generic-mode generic-extras-enable-list)
793
d8677156 794(define-generic-mode java-properties-generic-mode
82e38f3e 795 '(?! ?#)
ca1e63a5 796 nil
82e38f3e
LK
797 (eval-when-compile
798 (let ((java-properties-key
799 "\\(\\([-A-Za-z0-9_\\./]\\|\\(\\\\[ =:]\\)\\)+\\)")
800 (java-properties-value
801 "\\([^\r\n]*\\)"))
802 ;; Property and value can be separated in a number of different ways:
803 ;; * whitespace
804 ;; * an equal sign
805 ;; * a colon
806 (mapcar
807 (function
808 (lambda (elt)
809 (list
810 (concat "^" java-properties-key elt java-properties-value "$")
811 '(1 font-lock-constant-face)
812 '(4 font-lock-variable-name-face))))
813 ;; These are the separators
814 '(":\\s-*" "\\s-+" "\\s-*=\\s-*"))))
ca1e63a5 815 nil
bb53e1ee
RS
816 (list
817 (function
818 (lambda ()
ffe0c7ef 819 (setq imenu-generic-expression
d8677156 820 '((nil "^\\([^#! \t\n\r=:]+\\)" 1))))))
4b8643d3 821 "Generic mode for Java properties files."))
ca1e63a5
RS
822
823;; C shell alias definitions
d8677156 824(when (memq 'alias-generic-mode generic-extras-enable-list)
ef1c5063 825
d8677156 826(define-generic-mode alias-generic-mode
82e38f3e
LK
827 '(?#)
828 '("alias" "unalias")
ca1e63a5
RS
829 '(("^alias\\s-+\\([-A-Za-z0-9_]+\\)\\s-+"
830 (1 font-lock-variable-name-face))
831 ("^unalias\\s-+\\([-A-Za-z0-9_]+\\)\\s-*$"
d8677156 832 (1 font-lock-variable-name-face)))
82e38f3e 833 '("alias\\'")
ca1e63a5
RS
834 (list
835 (function
836 (lambda ()
ffe0c7ef 837 (setq imenu-generic-expression
d8677156 838 '((nil "^\\(alias\\|unalias\\)\\s-+\\([-a-zA-Z0-9_]+\\)" 2))))))
4b8643d3 839 "Generic mode for C Shell alias files."))
ca1e63a5
RS
840
841;;; Windows RC files
842;; Contributed by ACorreir@pervasive-sw.com (Alfred Correira)
d8677156
LK
843(when (memq 'rc-generic-mode generic-extras-enable-list)
844
845(define-generic-mode rc-generic-mode
82e38f3e
LK
846 ;; '(?\/)
847 '("//")
d8677156
LK
848 '("ACCELERATORS"
849 "AUTO3STATE"
850 "AUTOCHECKBOX"
851 "AUTORADIOBUTTON"
852 "BITMAP"
853 "BOTTOMMARGIN"
854 "BUTTON"
855 "CAPTION"
856 "CHARACTERISTICS"
857 "CHECKBOX"
858 "CLASS"
859 "COMBOBOX"
860 "CONTROL"
861 "CTEXT"
862 "CURSOR"
863 "DEFPUSHBUTTON"
864 "DESIGNINFO"
865 "DIALOG"
866 "DISCARDABLE"
867 "EDITTEXT"
868 "EXSTYLE"
869 "FONT"
870 "GROUPBOX"
871 "GUIDELINES"
872 "ICON"
873 "LANGUAGE"
874 "LEFTMARGIN"
875 "LISTBOX"
876 "LTEXT"
877 "MENUITEM SEPARATOR"
878 "MENUITEM"
879 "MENU"
880 "MOVEABLE"
881 "POPUP"
882 "PRELOAD"
883 "PURE"
884 "PUSHBOX"
885 "PUSHBUTTON"
886 "RADIOBUTTON"
887 "RCDATA"
888 "RIGHTMARGIN"
889 "RTEXT"
890 "SCROLLBAR"
891 "SEPARATOR"
892 "STATE3"
893 "STRINGTABLE"
894 "STYLE"
895 "TEXTINCLUDE"
896 "TOOLBAR"
897 "TOPMARGIN"
898 "VERSIONINFO"
899 "VERSION")
900 ;; the choice of what tokens go where is somewhat arbitrary,
901 ;; as is the choice of which value tokens are included, as
902 ;; the choice of face for each token group
82e38f3e
LK
903 (eval-when-compile
904 (list
d8677156 905 (generic-make-keywords-list
82e38f3e
LK
906 '("FILEFLAGSMASK"
907 "FILEFLAGS"
908 "FILEOS"
909 "FILESUBTYPE"
910 "FILETYPE"
911 "FILEVERSION"
912 "PRODUCTVERSION")
16a013c2 913 font-lock-type-face)
d8677156 914 (generic-make-keywords-list
82e38f3e
LK
915 '("BEGIN"
916 "BLOCK"
917 "END"
918 "VALUE")
16a013c2 919 font-lock-function-name-face)
82e38f3e
LK
920 '("^#[ \t]*include[ \t]+\\(<[^>\"\n]+>\\)" 1 font-lock-string-face)
921 '("^#[ \t]*define[ \t]+\\(\\sw+\\)(" 1 font-lock-function-name-face)
922 '("^#[ \t]*\\(elif\\|if\\)\\>"
923 ("\\<\\(defined\\)\\>[ \t]*(?\\(\\sw+\\)?" nil nil
924 (1 font-lock-constant-face)
925 (2 font-lock-variable-name-face nil t)))
926 '("^#[ \t]*\\(\\sw+\\)\\>[ \t]*\\(\\sw+\\)?"
927 (1 font-lock-constant-face)
928 (2 font-lock-variable-name-face nil t))))
60c19d5e 929 '("\\.[rR][cC]\\'")
82e38f3e 930 nil
d4fb185d 931 "Generic mode for MS-Windows Resource files."))
ca1e63a5 932
ef1c5063 933;; InstallShield RUL files
ca1e63a5 934;; Contributed by Alfred.Correira@Pervasive.Com
9845e669 935;; Bugfixes by "Rolf Sandau" <Rolf.Sandau@marconi.com>
d8677156
LK
936(when (memq 'rul-generic-mode generic-extras-enable-list)
937
82e38f3e
LK
938(eval-when-compile
939
ef1c5063 940;;; build the regexp strings using regexp-opt
82e38f3e
LK
941(defconst installshield-statement-keyword-list
942 '("abort"
943 "begin"
944 "call"
945 "case"
946 "declare"
947 "default"
948 "downto"
949 "elseif"
950 "else"
951 "endfor"
952 "endif"
953 "endswitch"
954 "endwhile"
955 "end"
956 "exit"
957 "external"
958 "for"
959 "function"
960 ;; "goto" -- handled elsewhere
961 "if"
962 "program"
963 "prototype"
964 "repeat"
965 "return"
966 "step"
967 "switch"
968 "then"
969 "to"
970 "typedef"
971 "until"
972 "void"
973 "while")
ef1c5063
RS
974 "Statement keywords used in InstallShield 3 and 5.")
975
82e38f3e
LK
976(defconst installshield-system-functions-list
977 '("AddFolderIcon"
978 "AddProfString"
979 "AddressString"
980 "AppCommand"
981 "AskDestPath"
982 "AskOptions"
983 "AskPath"
984 "AskText"
985 "AskYesNo"
986 "BatchDeleteEx"
987 "BatchFileLoad"
988 "BatchFileSave"
989 "BatchFind"
990 "BatchGetFileName"
991 "BatchMoveEx"
992 "BatchSetFileName"
993 "ChangeDirectory"
994 "CloseFile"
995 "CmdGetHwndDlg"
996 "ComponentAddItem" ; differs between IS3 and IS5
997 "ComponentCompareSizeRequired" ; IS5 only
998 "ComponentDialog"
999 "ComponentError" ; IS5 only
1000 "ComponentFileEnum" ; IS5 only
1001 "ComponentFileInfo" ; IS5 only
1002 "ComponentFilterLanguage" ; IS5 only
1003 "ComponentFilterOS" ; IS5 only
1004 "ComponentGetData" ; IS5 only
1005 "ComponentGetItemInfo" ; IS3 only
1006 "ComponentGetItemSize" ; differs between IS3 and IS5
1007 "ComponentIsItemSelected" ; differs between IS3 and IS5
1008 "ComponentListItems"
1009 "ComponentMoveData" ; IS5 only
1010 "ComponentSelectItem" ; differs between IS3 and IS5
1011 "ComponentSetData" ; IS5 only
1012 "ComponentSetItemInfo" ; IS3 only
1013 "ComponentSetTarget" ; IS5 only
1014 "ComponentSetupTypeEnum" ; IS5 only
1015 "ComponentSetupTypeGetData" ; IS5 only
1016 "ComponentSetupTypeSet" ; IS5 only
1017 "ComponentTotalSize"
1018 "ComponentValidate" ; IS5 only
1019 "CompressAdd" ; IS3 only
1020 "CompressDel" ; IS3 only
1021 "CompressEnum" ; IS3 only
1022 "CompressGet" ; IS3 only
1023 "CompressInfo" ; IS3 only
1024 "CopyFile"
1025 "CreateDir"
1026 "CreateFile"
1027 "CreateProgramFolder"
1028 "DeinstallSetReference" ; IS5 only
1029 "DeinstallStart"
1030 "Delay"
1031 "DeleteDir"
1032 "DeleteFile"
1033 "DialogSetInfo"
1034 "Disable"
1035 "DoInstall"
1036 "Do"
1037 "Enable"
1038 "EnterDisk"
1039 "ExistsDir"
1040 "ExistsDisk"
1041 "ExitProgMan"
1042 "EzBatchAddPath"
1043 "EzBatchAddString"
1044 "EzBatchReplace"
1045 "EzConfigAddDriver"
1046 "EzConfigAddString"
1047 "EzConfigGetValue"
1048 "EzConfigSetValue"
1049 "EzDefineDialog"
1050 "FileCompare"
1051 "FileDeleteLine"
1052 "FileGrep"
1053 "FileInsertLine"
1054 "FileSetBeginDefine" ; IS3 only
1055 "FileSetEndDefine" ; IS3 only
1056 "FileSetPerformEz" ; IS3 only
1057 "FileSetPerform" ; IS3 only
1058 "FileSetReset" ; IS3 only
1059 "FileSetRoot" ; IS3 only
1060 "FindAllDirs"
1061 "FindAllFiles"
1062 "FindFile"
1063 "FindWindow"
1064 "GetDiskSpace"
1065 "GetDisk"
1066 "GetEnvVar"
1067 "GetExtents"
1068 "GetFileInfo"
1069 "GetLine"
1070 "GetProfInt"
1071 "GetProfString"
1072 "GetSystemInfo"
1073 "GetValidDrivesList"
1074 "GetVersion"
1075 "GetWindowHandle"
1076 "InstallationInfo"
1077 "Is"
1078 "LaunchApp"
1079 "LaunchAppAndWait"
1080 "ListAddItem"
1081 "ListAddString"
1082 "ListCount"
1083 "ListCreate"
1084 "ListDestroy"
1085 "ListFindItem"
1086 "ListFindString"
1087 "ListGetFirstItem"
1088 "ListGetFirstString"
1089 "ListGetNextItem"
1090 "ListGetNextString"
1091 "ListReadFromFile"
1092 "ListSetCurrentItem"
1093 "ListSetNextItem"
1094 "ListSetNextString"
1095 "ListSetIndex"
1096 "ListWriteToFile"
1097 "LongPathToQuote"
1098 "LongPathToShortPath"
1099 "MessageBox"
1100 "NumToStr"
1101 "OpenFileMode"
1102 "OpenFile"
1103 "ParsePath"
1104 "PathAdd"
1105 "PathDelete"
1106 "PathFind"
1107 "PathGet"
1108 "PathMove"
1109 "PathSet"
1110 "Path"
1111 "PlaceBitmap"
1112 "PlaceWindow"
1113 "PlayMMedia" ; IS5 only
1114 "ProgDefGroupType"
1115 "RegDBCreateKeyEx"
1116 "RegDBDeleteValue"
1117 "RegDBGetItem"
1118 "RegDBKeyExist"
1119 "RegDBSetItem"
1120 "RegDBGetKeyValueEx"
1121 "RegDBSetKeyValueEx"
1122 "RegDBSetDefaultRoot"
1123 "RenameFile"
1124 "ReplaceFolderIcon"
1125 "ReplaceProfString"
1126 "SdAskDestPath"
1127 "SdAskOptions"
1128 "SdAskOptionsList"
1129 "SdBitmap"
1130 "SdCloseDlg"
1131 "SdComponentAdvCheckSpace"
1132 "SdComponentAdvInit"
1133 "SdComponentAdvUpdateSpace"
1134 "SdComponentDialog"
1135 "SdComponentDialog2"
1136 "SdComponentDialogAdv"
1137 "SdComponentDialogEx"
1138 "SdComponentDlgCheckSpace"
1139 "SdComponentMult"
1140 "SdConfirmNewDir"
1141 "SdConfirmRegistration"
1142 "SdDiskSpace"
1143 "SdDisplayTopics"
1144 "SdDoStdButton"
1145 "SdEnablement"
1146 "SdError"
1147 "SdFinish"
1148 "SdFinishInit32"
1149 "SdFinishReboot"
1150 "SdGeneralInit"
1151 "SdGetItemName"
1152 "SdGetTextExtent"
1153 "SdGetUserCompanyInfo"
1154 "SdInit"
1155 "SdIsShellExplorer"
1156 "SdIsStdButton"
1157 "SdLicense"
1158 "SdMakeName"
1159 "SdOptionInit"
1160 "SdOptionSetState"
1161 "SdOptionsButtons"
1162 "SdOptionsButtonsInit"
1163 "SdPlugInProductName"
1164 "SdProductName"
1165 "SdRegEnableButton"
1166 "SdRegExEnableButton"
1167 "SdRegisterUser"
1168 "SdRegisterUserEx"
1169 "SdRemoveEndSpace"
1170 "SdSelectFolder"
1171 "SdSetSequentialItems"
1172 "SdSetStatic"
1173 "SdSetupTypeEx" ; IS5 only
1174 "SdSetupType"
1175 "SdShowAnyDialog"
1176 "SdShowDlgEdit1"
1177 "SdShowDlgEdit2"
1178 "SdShowDlgEdit3"
1179 "SdShowFileMods"
1180 "SdShowInfoList"
1181 "SdShowMsg"
1182 "SdStartCopy"
1183 "SdUnInit"
1184 "SdUpdateComponentSelection"
1185 "SdWelcome"
1186 "SendMessage"
1187 "SetColor"
1188 "SetFont"
1189 "SetDialogTitle"
1190 "SetDisplayEffect" ; IS5 only
1191 "SetFileInfo"
1192 "SetForegroundWindow"
1193 "SetStatusWindow"
1194 "SetTitle"
1195 "SetupType"
1196 "ShowProgramFolder"
1197 "Split" ; IS3 only
1198 "SprintfBox"
1199 "Sprintf"
1200 "StatusUpdate"
1201 "StrCompare"
1202 "StrFind"
1203 "StrGetTokens"
1204 "StrLength"
1205 "StrRemoveLastSlash"
1206 "StrToLower"
1207 "StrToNum"
1208 "StrToUpper"
1209 "StrSub"
1210 "VarRestore"
1211 "VarSave"
1212 "VerCompare"
1213 "VerGetFileVersion"
1214 "WaitOnDialog"
1215 "Welcome"
1216 "WriteLine"
1217 "WriteProfString"
1218 "XCopyFile")
ef1c5063
RS
1219 "System functions defined in InstallShield 3 and 5.")
1220
82e38f3e
LK
1221(defconst installshield-system-variables-list
1222 '("BATCH_INSTALL"
1223 "CMDLINE"
1224 "COMMONFILES"
1225 "CORECOMPONENTHANDLING"
1226 "DIALOGCACHE"
1227 "ERRORFILENAME"
1228 "FOLDER_DESKTOP"
1229 "FOLDER_PROGRAMS"
1230 "FOLDER_STARTMENU"
1231 "FOLDER_STARTUP"
1232 "INFOFILENAME"
1233 "ISRES"
1234 "ISUSER"
1235 "ISVERSION"
1236 "MEDIA"
1237 "MODE"
1238 "PROGRAMFILES"
1239 "SELECTED_LANGUAGE"
1240 "SRCDIR"
1241 "SRCDISK"
1242 "SUPPORTDIR"
1243 "TARGETDIR"
1244 "TARGETDISK"
1245 "UNINST"
1246 "WINDIR"
1247 "WINDISK"
1248 "WINMAJOR"
1249 "WINSYSDIR"
1250 "WINSYSDISK")
ef1c5063
RS
1251 "System variables used in InstallShield 3 and 5.")
1252
82e38f3e
LK
1253(defconst installshield-types-list
1254 '("BOOL"
1255 "BYREF"
1256 "CHAR"
1257 "HIWORD"
1258 "HWND"
1259 "INT"
1260 "LIST"
1261 "LONG"
1262 "LOWORD"
1263 "LPSTR"
1264 "NUMBER"
1265 "NUMBERLIST"
1266 "POINTER"
1267 "QUAD"
1268 "RGB"
1269 "SHORT"
1270 "STRINGLIST"
1271 "STRING")
ef1c5063
RS
1272 "Type keywords used in InstallShield 3 and 5.")
1273
1274;;; some might want to skip highlighting these to improve performance
82e38f3e
LK
1275(defconst installshield-funarg-constants-list
1276 '("AFTER"
1277 "APPEND"
1278 "ALLCONTENTS"
1279 "BACKBUTTON"
1280 "BACKGROUNDCAPTION"
1281 "BACKGROUND"
1282 "BACK"
1283 "BASEMEMORY"
1284 "BEFORE"
1285 "BIOS"
1286 "BITMAPICON"
1287 "BK_BLUE"
1288 "BK_GREEN"
1289 "BK_RED"
1290 "BLUE"
1291 "BOOTUPDRIVE"
1292 "CANCEL"
1293 "CDROM_DRIVE"
1294 "CDROM"
1295 "CHECKBOX95"
1296 "CHECKBOX"
1297 "CHECKLINE"
1298 "CHECKMARK"
1299 "COLORS"
1300 "COMMANDEX"
1301 "COMMAND"
1302 "COMP_NORMAL"
1303 "COMP_UPDATE_DATE"
1304 "COMP_UPDATE_SAME"
1305 "COMP_UPDATE_VERSION"
1306 "COMPACT"
1307 "CONTINUE"
1308 "CPU"
1309 "CUSTOM"
1310 "DATE"
1311 "DEFWINDOWMODE"
1312 "DIR_WRITEABLE"
1313 "DIRECTORY"
1314 "DISABLE"
1315 "DISK_TOTALSPACE"
1316 "DISK"
1317 "DLG_OPTIONS"
1318 "DLG_PATH"
1319 "DLG_TEXT"
1320 "DLG_ASK_YESNO"
1321 "DLG_ENTER_DISK"
1322 "DLG_ERR"
1323 "DLG_INFO_ALTIMAGE"
1324 "DLG_INFO_CHECKSELECTION"
1325 "DLG_INFO_KUNITS"
1326 "DLG_INFO_USEDECIMAL"
1327 "DLG_MSG_INFORMATION"
1328 "DLG_MSG_SEVERE"
1329 "DLG_MSG_WARNING"
1330 "DLG_STATUS"
1331 "DLG_WARNING"
1332 "DLG_USER_CAPTION"
1333 "DRIVE"
1334 "ENABLE"
1335 "END_OF_FILE"
1336 "END_OF_LIST"
1337 "ENVSPACE"
1338 "EQUALS"
1339 "EXCLUDE_SUBDIR"
1340 "EXCLUSIVE"
1341 "EXISTS"
1342 "EXIT"
1343 "EXTENDED_MEMORY"
1344 "EXTENSION_ONLY"
1345 "FAILIFEXISTS"
1346 "FALSE"
1347 "FEEDBACK_FULL"
1348 "FILE_ATTR_ARCHIVED"
1349 "FILE_ATTR_DIRECTORY"
1350 "FILE_ATTR_HIDDEN"
1351 "FILE_ATTR_NORMAL"
1352 "FILE_ATTR_READONLY"
1353 "FILE_ATTR_SYSTEM"
1354 "FILE_ATTRIBUTE"
1355 "FILE_DATE"
1356 "FILE_LINE_LENGTH"
1357 "FILE_MODE_APPEND"
1358 "FILE_MODE_BINARYREADONLY"
1359 "FILE_MODE_BINARY"
1360 "FILE_MODE_NORMAL"
1361 "FILE_NO_VERSION"
1362 "FILE_NOT_FOUND"
1363 "FILE_SIZE"
1364 "FILE_TIME"
1365 "FILENAME_ONLY"
1366 "FILENAME"
1367 "FIXED_DRIVE"
1368 "FOLDER_DESKTOP"
1369 "FOLDER_PROGRAMS"
1370 "FOLDER_STARTMENU"
1371 "FOLDER_STARTUP"
1372 "FREEENVSPACE"
1373 "FULLWINDOWMODE"
1374 "FULL"
1375 "FONT_TITLE"
1376 "GREATER_THAN"
1377 "GREEN"
1378 "HKEY_CLASSES_ROOT"
1379 "HKEY_CURRENT_USER"
1380 "HKEY_LOCAL_MACHINE"
1381 "HKEY_USERS"
1382 "HOURGLASS"
1383 "INCLUDE_SUBDIR"
1384 "INDVFILESTATUS"
1385 "INFORMATION"
1386 "IS_WINDOWSNT"
1387 "IS_WINDOWS95"
1388 "IS_WINDOWS"
1389 "IS_WIN32S"
1390 "ISTYPE"
1391 "LANGUAGE_DRV"
1392 "LANGUAGE"
1393 "LESS_THAN"
1394 "LIST_NULL"
1395 "LISTFIRST"
1396 "LISTNEXT"
1397 "LOCKEDFILE"
1398 "LOGGING"
1399 "LOWER_LEFT"
1400 "LOWER_RIGHT"
1401 "MAGENTA"
1402 "MOUSE_DRV"
1403 "MOUSE"
1404 "NETWORK_DRV"
1405 "NETWORK"
1406 "NEXT"
1407 "NONEXCLUSIVE"
1408 "NORMALMODE"
1409 "NOSET"
1410 "NOTEXISTS"
1411 "NOWAIT"
1412 "NO"
1413 "OFF"
1414 "ONLYDIR"
1415 "ON"
1416 "OSMAJOR"
1417 "OSMINOR"
1418 "OS"
1419 "OTHER_FAILURE"
1420 "PARALLEL"
1421 "PARTIAL"
1422 "PATH_EXISTS"
1423 "PATH"
1424 "RED"
1425 "REGDB_APPPATH_DEFAULT"
1426 "REGDB_APPPATH"
1427 "REGDB_BINARY"
1428 "REGDB_ERR_CONNECTIONEXISTS"
1429 "REGDB_ERR_CORRUPTEDREGSITRY"
1430 "REGDB_ERR_INITIALIZATION"
1431 "REGDB_ERR_INVALIDHANDLE"
1432 "REGDB_ERR_INVALIDNAME"
1433 "REGDB_NUMBER"
1434 "REGDB_STRING_EXPAND"
1435 "REGDB_STRING_MULTI"
1436 "REGDB_STRING"
1437 "REGDB_UNINSTALL_NAME"
1438 "REMOTE_DRIVE"
1439 "REMOVALE_DRIVE"
1440 "REPLACE_ITEM"
1441 "REPLACE"
1442 "RESET"
1443 "RESTART"
1444 "ROOT"
1445 "SELFREGISTER"
1446 "SERIAL"
1447 "SET"
1448 "SEVERE"
1449 "SHAREDFILE"
1450 "SHARE"
1451 "SILENTMODE"
1452 "SRCTARGETDIR"
1453 "STATUSBAR"
1454 "STATUSDLG"
1455 "STATUSOLD"
1456 "STATUS"
1457 "STYLE_NORMAL"
1458 "SW_MAXIMIZE"
1459 "SW_MINIMIZE"
1460 "SW_RESTORE"
1461 "SW_SHOW"
1462 "SYS_BOOTMACHINE"
1463 "TIME"
1464 "TRUE"
1465 "TYPICAL"
1466 "UPPER_LEFT"
1467 "UPPER_RIGHT"
1468 "VALID_PATH"
1469 "VERSION"
1470 "VIDEO"
1471 "VOLUMELABEL"
1472 "YELLOW"
1473 "YES"
1474 "WAIT"
1475 "WARNING"
1476 "WINMAJOR"
1477 "WINMINOR"
1478 "WIN32SINSTALLED"
1479 "WIN32SMAJOR"
1480 "WIN32SMINOR")
1481 "Function argument constants used in InstallShield 3 and 5."))
ca1e63a5 1482
d8677156 1483(defvar rul-generic-mode-syntax-table nil
1fffafda 1484 "Syntax table to use in `rul-generic-mode' buffers.")
d8677156
LK
1485
1486(setq rul-generic-mode-syntax-table
1487 (make-syntax-table c++-mode-syntax-table))
1488
82e38f3e
LK
1489(modify-syntax-entry ?\r "> b" rul-generic-mode-syntax-table)
1490(modify-syntax-entry ?\n "> b" rul-generic-mode-syntax-table)
d8677156
LK
1491
1492(modify-syntax-entry ?/ ". 124b" rul-generic-mode-syntax-table)
1493(modify-syntax-entry ?* ". 23" rul-generic-mode-syntax-table)
1494
1495;; here manually instead
1496(defun generic-rul-mode-setup-function ()
82e38f3e
LK
1497 (make-local-variable 'parse-sexp-ignore-comments)
1498 (make-local-variable 'comment-start)
1499 (make-local-variable 'comment-start-skip)
1500 (make-local-variable 'comment-end)
d8677156
LK
1501 (setq imenu-generic-expression
1502 '((nil "^function\\s-+\\([A-Za-z0-9_]+\\)" 1))
1503 parse-sexp-ignore-comments t
1504 comment-end "*/"
1505 comment-start "/*"
1506;;; comment-end ""
1507;;; comment-start "//"
1508;;; comment-start-skip ""
1509 )
82e38f3e 1510 ;; (set-syntax-table rul-generic-mode-syntax-table)
d8677156
LK
1511 (setq font-lock-syntax-table rul-generic-mode-syntax-table))
1512
1513;; moved mode-definition behind defun-definition to be warning-free - 15.11.02/RSan
1514(define-generic-mode rul-generic-mode
1515 ;; Using "/*" and "*/" doesn't seem to be working right
82e38f3e
LK
1516 '("//" ("/*" . "*/" ))
1517 (eval-when-compile installshield-statement-keyword-list)
1518 (eval-when-compile
1519 (list
1520 ;; preprocessor constructs
1521 '("#[ \t]*include[ \t]+\\(<[^>\"\n]+>\\)"
1522 1 font-lock-string-face)
1523 '("#[ \t]*\\(\\sw+\\)\\>[ \t]*\\(\\sw+\\)?"
1524 (1 font-lock-reference-face)
1525 (2 font-lock-variable-name-face nil t))
1526 ;; indirect string constants
1527 '("\\(@[A-Za-z][A-Za-z0-9_]+\\)" 1 font-lock-builtin-face)
1528 ;; gotos
1529 '("[ \t]*\\(\\sw+:\\)" 1 font-lock-reference-face)
1530 '("\\<\\(goto\\)\\>[ \t]*\\(\\sw+\\)?"
1531 (1 font-lock-keyword-face)
1532 (2 font-lock-reference-face nil t))
1533 ;; system variables
1534 (generic-make-keywords-list
1535 installshield-system-variables-list
16a013c2 1536 font-lock-variable-name-face "[^_]" "[^_]")
82e38f3e
LK
1537 ;; system functions
1538 (generic-make-keywords-list
1539 installshield-system-functions-list
16a013c2 1540 font-lock-function-name-face "[^_]" "[^_]")
82e38f3e
LK
1541 ;; type keywords
1542 (generic-make-keywords-list
1543 installshield-types-list
16a013c2 1544 font-lock-type-face "[^_]" "[^_]")
82e38f3e
LK
1545 ;; function argument constants
1546 (generic-make-keywords-list
1547 installshield-funarg-constants-list
16a013c2 1548 font-lock-variable-name-face "[^_]" "[^_]"))) ; is this face the best choice?
60c19d5e 1549 '("\\.[rR][uU][lL]\\'")
82e38f3e 1550 '(generic-rul-mode-setup-function)
d4fb185d 1551 "Generic mode for InstallShield RUL files.")
d8677156 1552
ca1e63a5 1553(define-skeleton rul-if
d8677156
LK
1554 "Insert an if statement."
1555 "condition: "
1556 "if(" str ") then" \n
1557 > _ \n
1558 ( "other condition, %s: "
1559 > "elseif(" str ") then" \n
1560 > \n)
1561 > "else" \n
1562 > \n
1563 resume:
1564 > "endif;")
ca1e63a5
RS
1565
1566(define-skeleton rul-function
1567 "Insert a function statement."
1568 "function: "
1569 "function " str " ()" \n
1570 ( "local variables, %s: "
d8677156 1571 > " " str ";" \n)
ca1e63a5
RS
1572 > "begin" \n
1573 > _ \n
1574 resume:
d8677156 1575 > "end;"))
ca1e63a5
RS
1576
1577;; Additions by ACorreir@pervasive-sw.com (Alfred Correira)
1fffafda
LK
1578(when (memq 'mailrc-generic-mode generic-extras-enable-list)
1579
d8677156 1580(define-generic-mode mailrc-generic-mode
82e38f3e
LK
1581 '(?#)
1582 '("alias"
1583 "else"
1584 "endif"
1585 "group"
1586 "if"
1587 "ignore"
1588 "set"
1589 "source"
1590 "unset")
ca1e63a5 1591 '(("^\\s-*\\(alias\\|group\\)\\s-+\\([-A-Za-z0-9_]+\\)\\s-+\\([^\n\r#]*\\)\\(#.*\\)?$"
16a013c2
LK
1592 (2 font-lock-constant-face)
1593 (3 font-lock-variable-name-face))
ca1e63a5 1594 ("^\\s-*\\(unset\\|set\\|ignore\\)\\s-+\\([-A-Za-z0-9_]+\\)=?\\([^\n\r#]*\\)\\(#.*\\)?$"
16a013c2
LK
1595 (2 font-lock-constant-face)
1596 (3 font-lock-variable-name-face))
5d1c5247
FP
1597 ("^\\s-*\\(source\\)\\s-+\\([^\n\r#]*\\)\\(#.*\\)?$"
1598 (2 font-lock-variable-name-face)))
82e38f3e 1599 '("\\.mailrc\\'")
ca1e63a5 1600 nil
d4fb185d 1601 "Mode for mailrc files."))
ca1e63a5 1602
bb53e1ee 1603;; Inetd.conf
d8677156 1604(when (memq 'inetd-conf-generic-mode generic-extras-enable-list)
bb53e1ee 1605
d8677156 1606(define-generic-mode inetd-conf-generic-mode
82e38f3e
LK
1607 '(?#)
1608 '("stream"
1609 "dgram"
1610 "tcp"
1611 "udp"
1612 "wait"
1613 "nowait"
1614 "internal")
1615 '(("^\\([-A-Za-z0-9_]+\\)" 1 font-lock-type-face))
bb53e1ee 1616 '("/etc/inetd.conf\\'")
ffe0c7ef 1617 (list
bb53e1ee
RS
1618 (function
1619 (lambda ()
ffe0c7ef 1620 (setq imenu-generic-expression
d4fb185d 1621 '((nil "^\\([-A-Za-z0-9_]+\\)" 1))))))))
bb53e1ee
RS
1622
1623;; Services
d8677156 1624(when (memq 'etc-services-generic-mode generic-extras-enable-list)
bb53e1ee 1625
d8677156 1626(define-generic-mode etc-services-generic-mode
82e38f3e
LK
1627 '(?#)
1628 '("tcp"
1629 "udp"
1630 "ddp")
d8677156 1631 '(("^\\([-A-Za-z0-9_]+\\)\\s-+\\([0-9]+\\)/"
82e38f3e
LK
1632 (1 font-lock-type-face)
1633 (2 font-lock-variable-name-face)))
bb53e1ee 1634 '("/etc/services\\'")
ffe0c7ef 1635 (list
bb53e1ee
RS
1636 (function
1637 (lambda ()
ffe0c7ef 1638 (setq imenu-generic-expression
d4fb185d 1639 '((nil "^\\([-A-Za-z0-9_]+\\)" 1))))))))
bb53e1ee
RS
1640
1641;; Password and Group files
d8677156 1642(when (memq 'etc-passwd-generic-mode generic-extras-enable-list)
bb53e1ee 1643
d8677156 1644(define-generic-mode etc-passwd-generic-mode
bb53e1ee 1645 nil ;; No comment characters
82e38f3e
LK
1646 '("root") ;; Only one keyword
1647 (eval-when-compile
1648 (list
1649 (list
1650 (concat
1651 "^"
1652 ;; User name -- Never blank!
1653 "\\([^:]+\\)"
1654 ":"
1655 ;; Password, UID and GID
1656 (mapconcat
1657 'identity
1658 (make-list 3 "\\([^:]+\\)")
1659 ":")
1660 ":"
1661 ;; GECOS/Name -- might be blank
1662 "\\([^:]*\\)"
1663 ":"
1664 ;; Home directory and shell
1665 "\\([^:]+\\)"
1666 ":?"
1667 "\\([^:]*\\)"
1668 "$")
1669 '(1 font-lock-type-face)
1670 '(5 font-lock-variable-name-face)
1671 '(6 font-lock-constant-face)
1672 '(7 font-lock-warning-face))
1673 '("^\\([^:]+\\):\\([^:]*\\):\\([0-9]+\\):\\(.*\\)$"
1674 (1 font-lock-type-face)
1675 (4 font-lock-variable-name-face))))
bb53e1ee 1676 '("/etc/passwd\\'" "/etc/group\\'")
ffe0c7ef 1677 (list
bb53e1ee
RS
1678 (function
1679 (lambda ()
ffe0c7ef 1680 (setq imenu-generic-expression
d4fb185d 1681 '((nil "^\\([-A-Za-z0-9_]+\\):" 1))))))))
bb53e1ee 1682
7aeb9d6f 1683;; Fstab
d8677156 1684(when (memq 'etc-fstab-generic-mode generic-extras-enable-list)
7aeb9d6f 1685
d8677156 1686(define-generic-mode etc-fstab-generic-mode
82e38f3e
LK
1687 '(?#)
1688 '("adfs"
1689 "affs"
1690 "autofs"
1691 "coda"
1692 "coherent"
1693 "cramfs"
1694 "devpts"
1695 "efs"
1696 "ext2"
1697 "ext3"
1698 "hfs"
1699 "hpfs"
1700 "iso9660"
1701 "jfs"
1702 "minix"
1703 "msdos"
1704 "ncpfs"
1705 "nfs"
1706 "ntfs"
1707 "proc"
1708 "qnx4"
1709 "reiserfs"
1710 "romfs"
1711 "smbfs"
3e54ab6c
LH
1712 "cifs"
1713 "usbdevfs"
82e38f3e
LK
1714 "sysv"
1715 "tmpfs"
1716 "udf"
1717 "ufs"
1718 "umsdos"
1719 "vfat"
1720 "xenix"
1721 "xfs"
1722 "swap"
1723 "auto"
1724 "ignore")
3e54ab6c 1725 '(("^\\([^# \t]+\\)\\s-+\\([^# \t]+\\)"
60c19d5e
LK
1726 (1 font-lock-type-face t)
1727 (2 font-lock-variable-name-face t)))
7aeb9d6f
PB
1728 '("/etc/[v]*fstab\\'")
1729 (list
1730 (function
1731 (lambda ()
1732 (setq imenu-generic-expression
3e54ab6c 1733 '((nil "^\\([^# \t]+\\)\\s-+" 1))))))))
bb53e1ee 1734
5f33ef98
RS
1735;; /etc/sudoers
1736(when (memq 'etc-sudoers-generic-mode generic-extras-enable-list)
1737
1738(define-generic-mode etc-sudoers-generic-mode
1739 '(?#)
1740 '("User_Alias" "Runas_Alias" "Host_Alias" "Cmnd_Alias"
1741 "NOPASSWD" "PASSWD" "NOEXEC" "EXEC"
1742 "ALL")
1743 '(("\\<\\(root\\|su\\)\\>" 1 font-lock-warning-face)
1744 ("\\(\\*\\)" 1 font-lock-warning-face)
1745 ("\\<\\(%[A-Za-z0-9_]+\\)\\>" 1 font-lock-variable-name-face))
1746 '("/etc/sudoers\\'")
1747 nil
1748 "Generic mode for sudoers configuration files."))
1749
bb53e1ee 1750;; From Jacques Duthen <jacques.duthen@sncf.fr>
1fffafda
LK
1751(when (memq 'show-tabs-generic-mode generic-extras-enable-list)
1752
16a013c2
LK
1753(eval-when-compile
1754
1755(defconst show-tabs-generic-mode-font-lock-defaults-1
82e38f3e 1756 '(;; trailing spaces must come before...
f0b3dcbf 1757 ("[ \t]+$" . 'show-tabs-space)
d8677156 1758 ;; ...embedded tabs
f0b3dcbf 1759 ("[^\n\t]\\(\t+\\)" (1 'show-tabs-tab))))
bb53e1ee 1760
16a013c2 1761(defconst show-tabs-generic-mode-font-lock-defaults-2
82e38f3e 1762 '(;; trailing spaces must come before...
f0b3dcbf 1763 ("[ \t]+$" . 'show-tabs-space)
d8677156 1764 ;; ...tabs
f0b3dcbf 1765 ("\t+" . 'show-tabs-tab))))
bb53e1ee 1766
f0b3dcbf 1767(defface show-tabs-tab
16a013c2
LK
1768 '((((class grayscale) (background light)) (:background "DimGray" :weight bold))
1769 (((class grayscale) (background dark)) (:background "LightGray" :weight bold))
ea81d57e
DN
1770 (((class color) (min-colors 88)) (:background "red1"))
1771 (((class color)) (:background "red"))
1fd714a4 1772 (t (:weight bold)))
bb53e1ee 1773 "Font Lock mode face used to highlight TABs."
d4fb185d 1774 :group 'generic-x)
c4f6e489 1775(define-obsolete-face-alias 'show-tabs-tab-face 'show-tabs-tab "22.1")
bb53e1ee 1776
f0b3dcbf 1777(defface show-tabs-space
16a013c2
LK
1778 '((((class grayscale) (background light)) (:background "DimGray" :weight bold))
1779 (((class grayscale) (background dark)) (:background "LightGray" :weight bold))
ea81d57e
DN
1780 (((class color) (min-colors 88)) (:background "yellow1"))
1781 (((class color)) (:background "yellow"))
1fd714a4 1782 (t (:weight bold)))
bb53e1ee 1783 "Font Lock mode face used to highlight spaces."
d4fb185d 1784 :group 'generic-x)
c4f6e489 1785(define-obsolete-face-alias 'show-tabs-space-face 'show-tabs-space "22.1")
bb53e1ee 1786
d8677156 1787(define-generic-mode show-tabs-generic-mode
82e38f3e
LK
1788 nil ;; no comment char
1789 nil ;; no keywords
16a013c2 1790 (eval-when-compile show-tabs-generic-mode-font-lock-defaults-1)
82e38f3e
LK
1791 nil ;; no auto-mode-alist
1792 ;; '(show-tabs-generic-mode-hook-fun)
bb53e1ee 1793 nil
76ee7bd5 1794 "Generic mode to show tabs and trailing spaces."))
bb53e1ee 1795
ffe0c7ef
PB
1796;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1797;; DNS modes
1798;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1799
1fffafda
LK
1800(when (memq 'named-boot-generic-mode generic-extras-enable-list)
1801
d8677156
LK
1802(define-generic-mode named-boot-generic-mode
1803 ;; List of comment characters
82e38f3e 1804 '(?\;)
d8677156 1805 ;; List of keywords
82e38f3e
LK
1806 '("cache" "primary" "secondary" "forwarders" "limit" "options"
1807 "directory" "check-names")
d8677156 1808 ;; List of additional font-lock-expressions
d1501442 1809 '(("\\([0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+\\)" 1 font-lock-constant-face)
82e38f3e
LK
1810 ("^directory\\s-+\\(.*\\)" 1 font-lock-variable-name-face)
1811 ("^\\(primary\\|cache\\)\\s-+\\([.A-Za-z]+\\)\\s-+\\(.*\\)"
1812 (2 font-lock-variable-name-face)
1813 (3 font-lock-constant-face)))
d8677156 1814 ;; List of additional automode-alist expressions
82e38f3e 1815 '("/etc/named.boot\\'")
d8677156 1816 ;; List of set up functions to call
d4fb185d 1817 nil))
1fffafda
LK
1818
1819(when (memq 'named-database-generic-mode generic-extras-enable-list)
ffe0c7ef 1820
d8677156
LK
1821(define-generic-mode named-database-generic-mode
1822 ;; List of comment characters
82e38f3e 1823 '(?\;)
d8677156 1824 ;; List of keywords
82e38f3e 1825 '("IN" "NS" "CNAME" "SOA" "PTR" "MX" "A")
d8677156 1826 ;; List of additional font-lock-expressions
d1501442 1827 '(("\\([0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+\\)" 1 font-lock-constant-face)
82e38f3e 1828 ("^\\([.A-Za-z0-9]+\\)" 1 font-lock-variable-name-face))
60c19d5e 1829 ;; List of additional auto-mode-alist expressions
ffe0c7ef 1830 nil
d8677156 1831 ;; List of set up functions to call
d4fb185d 1832 nil)
ffe0c7ef
PB
1833
1834(defvar named-database-time-string "%Y%m%d%H"
1835 "Timestring for named serial numbers.")
1836
1837(defun named-database-print-serial ()
1838 "Print a serial number based on the current date."
1839 (interactive)
1fffafda
LK
1840 (insert (format-time-string named-database-time-string (current-time)))))
1841
1842(when (memq 'resolve-conf-generic-mode generic-extras-enable-list)
ffe0c7ef 1843
d8677156
LK
1844(define-generic-mode resolve-conf-generic-mode
1845 ;; List of comment characters
82e38f3e 1846 '(?#)
d8677156 1847 ;; List of keywords
82e38f3e 1848 '("nameserver" "domain" "search" "sortlist" "options")
d8677156 1849 ;; List of additional font-lock-expressions
ffe0c7ef 1850 nil
60c19d5e 1851 ;; List of additional auto-mode-alist expressions
82e38f3e 1852 '("/etc/resolv[e]?.conf\\'")
d8677156 1853 ;; List of set up functions to call
d4fb185d 1854 nil))
ffe0c7ef
PB
1855
1856;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1857;; Modes for spice and common electrical engineering circuit netlist formats
1858;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1859
1fffafda
LK
1860(when (memq 'spice-generic-mode generic-extras-enable-list)
1861
d8677156 1862(define-generic-mode spice-generic-mode
ffe0c7ef 1863 nil
82e38f3e
LK
1864 '("and"
1865 "cccs"
1866 "ccvs"
1867 "delay"
1868 "nand"
1869 "nor"
1870 "npwl"
1871 "or"
1872 "par"
1873 "ppwl"
1874 "pwl"
1875 "vccap"
1876 "vccs"
1877 "vcr"
1878 "vcvs")
1879 '(("^\\s-*\\([*].*\\)" 1 font-lock-comment-face)
1880 (" \\(\\$ .*\\)$" 1 font-lock-comment-face)
1881 ("^\\(\\$ .*\\)$" 1 font-lock-comment-face)
1882 ("\\([*].*\\)" 1 font-lock-comment-face)
1883 ("^\\([+]\\)" 1 font-lock-string-face)
1884 ("^\\s-*\\([.]\\w+\\>\\)" 1 font-lock-keyword-face)
1885 ("\\(\\([.]\\|_\\|\\w\\)+\\)\\s-*=" 1 font-lock-variable-name-face)
1886 ("\\('[^']+'\\)" 1 font-lock-string-face)
1887 ("\\(\"[^\"]+\"\\)" 1 font-lock-string-face))
1888 '("\\.[sS][pP]\\'"
1889 "\\.[sS][pP][iI]\\'"
1890 "\\.[sS][pP][iI][cC][eE]\\'"
1891 "\\.[iI][nN][cC]\\'")
ffe0c7ef
PB
1892 (list
1893 'generic-bracket-support
1894 ;; Make keywords case-insensitive
1895 (function
1896 (lambda()
16a013c2 1897 (setq font-lock-defaults '(generic-font-lock-keywords nil t)))))
d4fb185d 1898 "Generic mode for SPICE circuit netlist files."))
1fffafda
LK
1899
1900(when (memq 'ibis-generic-mode generic-extras-enable-list)
ffe0c7ef 1901
d8677156 1902(define-generic-mode ibis-generic-mode
82e38f3e 1903 '(?|)
ffe0c7ef 1904 nil
82e38f3e
LK
1905 '(("[[]\\([^]]*\\)[]]" 1 font-lock-keyword-face)
1906 ("\\(\\(_\\|\\w\\)+\\)\\s-*=" 1 font-lock-variable-name-face))
1907 '("\\.[iI][bB][sS]\\'")
1908 '(generic-bracket-support)
d4fb185d 1909 "Generic mode for IBIS circuit netlist files."))
1fffafda
LK
1910
1911(when (memq 'astap-generic-mode generic-extras-enable-list)
ffe0c7ef 1912
d8677156 1913(define-generic-mode astap-generic-mode
ffe0c7ef 1914 nil
82e38f3e
LK
1915 '("analyze"
1916 "description"
1917 "elements"
1918 "execution"
1919 "features"
1920 "functions"
1921 "ground"
1922 "model"
1923 "outputs"
1924 "print"
1925 "run"
1926 "controls"
1927 "table")
1928 '(("^\\s-*\\([*].*\\)" 1 font-lock-comment-face)
1929 (";\\s-*\\([*].*\\)" 1 font-lock-comment-face)
1930 ("^\\s-*\\([.]\\w+\\>\\)" 1 font-lock-keyword-face)
1931 ("\\('[^']+'\\)" 1 font-lock-string-face)
1932 ("\\(\"[^\"]+\"\\)" 1 font-lock-string-face)
1933 ("[(,]\\s-*\\(\\([.]\\|_\\|\\w\\)+\\)\\s-*=" 1 font-lock-variable-name-face))
1934 '("\\.[aA][pP]\\'"
1935 "\\.[aA][sS][xX]\\'"
1936 "\\.[aA][sS][tT][aA][pP]\\'"
1937 "\\.[pP][sS][pP]\\'"
1938 "\\.[dD][eE][cC][kK]\\'"
1939 "\\.[gG][oO][dD][aA][tT][aA]")
ffe0c7ef
PB
1940 (list
1941 'generic-bracket-support
1942 ;; Make keywords case-insensitive
1943 (function
1944 (lambda()
16a013c2 1945 (setq font-lock-defaults '(generic-font-lock-keywords nil t)))))
d4fb185d 1946 "Generic mode for ASTAP circuit netlist files."))
1fffafda
LK
1947
1948(when (memq 'etc-modules-conf-generic-mode generic-extras-enable-list)
ffe0c7ef 1949
d8677156
LK
1950(define-generic-mode etc-modules-conf-generic-mode
1951 ;; List of comment characters
82e38f3e 1952 '(?#)
d8677156 1953 ;; List of keywords
82e38f3e
LK
1954 '("above"
1955 "alias"
1956 "below"
1957 "define"
1958 "depfile"
1959 "else"
1960 "elseif"
1961 "endif"
1962 "if"
1963 "include"
1964 "insmod_opt"
1965 "install"
1966 "keep"
1967 "options"
1968 "path"
1969 "generic_stringfile"
1970 "pcimapfile"
1971 "isapnpmapfile"
1972 "usbmapfile"
1973 "parportmapfile"
1974 "ieee1394mapfile"
1975 "pnpbiosmapfile"
1976 "probe"
1977 "probeall"
1978 "prune"
1979 "post-install"
1980 "post-remove"
1981 "pre-install"
1982 "pre-remove"
1983 "remove"
1984 "persistdir")
d8677156 1985 ;; List of additional font-lock-expressions
9845e669 1986 nil
d8677156 1987 ;; List of additional automode-alist expressions
82e38f3e 1988 '("/etc/modules.conf" "/etc/conf.modules")
d8677156 1989 ;; List of set up functions to call
d4fb185d 1990 nil))
ffe0c7ef 1991
ca1e63a5
RS
1992(provide 'generic-x)
1993
1994;;; generic-x.el ends here