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