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