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