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