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