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