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