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