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