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