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