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