1 ;;; generic-x.el --- Extra Modes for generic-mode -*- no-byte-compile: t -*-
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)
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.
28 ;; This file contains some pre-defined generic-modes.
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
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
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
85 ;; However, since the `.' regexp symbol match the linefeed character the
86 ;; entire folded section is searched, resulting in a regexp stack
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.
98 (defgroup generic-x nil
99 "Extra modes for generic mode."
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."
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."
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."
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
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
145 'hosts-generic-mode
'fvwm-generic-mode
146 'x-resource-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 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
157 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
161 (memq 'apache-conf-generic-mode generic-extras-enable-list
)
163 (define-generic-mode 'apache-conf-generic-mode
166 '(("^\\s-*\\(<.*>\\)" 1 'font-lock-constant-face
)
167 ("^\\s-*\\(\\sw+\\)\\s-" 1 'font-lock-variable-name-face
))
168 (list "srm\\.conf\\'" "httpd\\.conf\\'" "access\\.conf\\'")
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."))
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"))
197 (memq 'samba-generic-mode generic-extras-enable-list
)
199 (define-generic-mode 'samba-generic-mode
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."))
213 ;; This is pretty basic. Also, modes for other window managers could
214 ;; be defined as well.
216 (memq 'fvwm-generic-mode generic-extras-enable-list
)
218 (define-generic-mode 'fvwm-generic-mode
236 (list "\\.fvwmrc\\'" "\\.fvwm2rc\\'")
238 "Generic mode for FVWM configuration files."))
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
244 (memq 'x-resource-generic-mode generic-extras-enable-list
)
246 (define-generic-mode 'x-resource-generic-mode
249 '(("^\\([^:\n]+:\\)" 1 'font-lock-variable-name-face
))
250 (list "\\.Xdefaults\\'" "\\.Xresources\\'" "\\.Xenvironment\\'" "\\.ad\\'")
252 "Generic mode for X Resource configuration files."))
256 (memq 'hosts-generic-mode generic-extras-enable-list
)
258 (define-generic-mode 'hosts-generic-mode
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
268 (memq 'inf-generic-mode generic-extras-enable-list
)
270 (define-generic-mode 'inf-generic-mode
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!
281 (memq 'ini-generic-mode generic-extras-enable-list
)
283 (define-generic-mode 'ini-generic-mode
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]\\'")
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!
303 (memq 'reg-generic-mode generic-extras-enable-list
)
305 (define-generic-mode 'reg-generic-mode
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]\\'")
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
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
)
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.
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
344 (generic-make-keywords-list
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
353 (generic-make-keywords-list
360 ) 'font-lock-keyword-face
)
361 ;; These are built-in commands. Only frequently-used ones are listed.
362 (generic-make-keywords-list
372 "PAUSE" "pause" "Pause"
373 "PROMPT" "prompt" "Prompt"
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
))
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."
409 (let ((compilation-buffer-name-function
412 (concat "*" (buffer-file-name) "*")))
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."
422 (let* ((file (buffer-file-name))
423 (buf-name (concat "*" file
"*")))
426 (get-buffer-create buf-name
))
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
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
)
471 ;; Mailagent is a Unix mail filtering program. Anyone wanna do a generic mode
474 (memq 'mailagent-rules-generic-mode generic-extras-enable-list
)
476 (define-generic-mode 'mailagent-rules-generic-mode
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
))
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
493 (memq 'prototype-generic-mode generic-extras-enable-list
)
495 (define-generic-mode 'prototype-generic-mode
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
519 (memq 'pkginfo-generic-mode generic-extras-enable-list
)
521 (define-generic-mode 'pkginfo-generic-mode
525 ("^\\([A-Za-z_]+\\)=\\([^\n\r]*\\)$"
526 (1 font-lock-keyword-face
)
527 (2 font-lock-variable-name-face
))
531 "Mode for Sys V pkginfo files."))
534 ;; Includes extra keywords from Armando Singer [asinger@MAIL.COLGATE.EDU]
535 (define-generic-mode 'javascript-generic-mode
536 (list "//" '("/*" .
"*/"))
560 ;; words reserved for ECMA extensions below
571 ;; Java Keywords reserved by JavaScript
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
))
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.")
617 (define-generic-mode 'vrml-generic-mode
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
))
658 "^\\s-*\\(geometry\\|appearance\\|material\\)\\s-+\\([-A-Za-z0-9_]+\\)"
659 '(2 font-lock-variable-name-face
))
665 (setq imenu-generic-expression
666 '((nil "^\\([A-Za-z0-9_]+\\)\\s-*{" 1)
668 "DEF\\s-+\\([-A-Za-z0-9_]+\\)\\s-+\\([A-Za-z0-9]+\\)\\s-*{"
671 "Generic Mode for VRML files.")
674 (define-generic-mode 'java-manifest-generic-mode
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
699 (let ((java-properties-key
700 "\\(\\([-A-Za-z0-9_\\./]\\|\\(\\\\[ =:]\\)\\)+\\)")
701 (java-properties-value
704 ;; Property and value can be separated in a number of different ways:
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-*")
724 (setq imenu-generic-expression
725 '((nil "^\\([^#! \t\n\r=:]+\\)" 1)))
727 "Mode for Java properties files.")
729 ;; C shell alias definitions
731 (memq 'alias-generic-mode generic-extras-enable-list
)
733 (define-generic-mode 'alias-generic-mode
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
))
745 (setq imenu-generic-expression
746 '((nil "^\\(alias\\|unalias\\)\\s-+\\([-a-zA-Z0-9_]+\\)" 2)))
748 "Mode for C Shell alias files.")
752 ;; Contributed by ACorreir@pervasive-sw.com (Alfred Correira)
754 (memq 'rc-generic-mode generic-extras-enable-list
)
756 (define-generic-mode 'rc-generic-mode
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
817 (generic-make-keywords-list
826 ) 'font-lock-type-face
))
828 (generic-make-keywords-list
834 ) 'font-lock-function-name-face
))
835 '("^#[ \t]*include[ \t]+\\(<[^>\"\n]+>\\)" 1 font-lock-string-face
)
836 '("^#[ \t]*define[ \t]+\\(\\sw+\\)(" 1 font-lock-function-name-face
)
837 '("^#[ \t]*\\(elif\\|if\\)\\>"
838 ("\\<\\(defined\\)\\>[ \t]*(?\\(\\sw+\\)?" nil nil
839 (1 font-lock-constant-face
) (2 font-lock-variable-name-face nil t
)))
840 '("^#[ \t]*\\(\\sw+\\)\\>[ \t]*\\(\\sw+\\)?"
841 (1 font-lock-constant-face
) (2 font-lock-variable-name-face nil t
)))
842 (list "\\.[rR][cC]$")
844 "Generic mode for MS-Windows Resource files."))
846 ;; InstallShield RUL files
847 ;; Contributed by Alfred.Correira@Pervasive.Com
848 ;; Bugfixes by "Rolf Sandau" <Rolf.Sandau@marconi.com>
850 (memq 'rul-generic-mode generic-extras-enable-list
)
851 ;;; build the regexp strings using regexp-opt
852 (defvar installshield-statement-keyword-list
872 ;; "goto" -- handled elsewhere
887 "Statement keywords used in InstallShield 3 and 5.")
889 (defvar installshield-system-functions-list
910 "ComponentAddItem" ; differs between IS3 and IS5
911 "ComponentCompareSizeRequired" ; IS5 only
913 "ComponentError" ; IS5 only
914 "ComponentFileEnum" ; IS5 only
915 "ComponentFileInfo" ; IS5 only
916 "ComponentFilterLanguage" ; IS5 only
917 "ComponentFilterOS" ; IS5 only
918 "ComponentGetData" ; IS5 only
919 "ComponentGetItemInfo" ; IS3 only
920 "ComponentGetItemSize" ; differs between IS3 and IS5
921 "ComponentIsItemSelected" ; differs between IS3 and IS5
923 "ComponentMoveData" ; IS5 only
924 "ComponentSelectItem" ; differs between IS3 and IS5
925 "ComponentSetData" ; IS5 only
926 "ComponentSetItemInfo" ; IS3 only
927 "ComponentSetTarget" ; IS5 only
928 "ComponentSetupTypeEnum" ; IS5 only
929 "ComponentSetupTypeGetData" ; IS5 only
930 "ComponentSetupTypeSet" ; IS5 only
932 "ComponentValidate" ; IS5 only
933 "CompressAdd" ; IS3 only
934 "CompressDel" ; IS3 only
935 "CompressEnum" ; IS3 only
936 "CompressGet" ; IS3 only
937 "CompressInfo" ; IS3 only
941 "CreateProgramFolder"
942 "DeinstallSetReference" ; IS5 only
968 "FileSetBeginDefine" ; IS3 only
969 "FileSetEndDefine" ; IS3 only
970 "FileSetPerformEz" ; IS3 only
971 "FileSetPerform" ; IS3 only
972 "FileSetReset" ; IS3 only
973 "FileSetRoot" ; IS3 only
1002 "ListGetFirstString"
1006 "ListSetCurrentItem"
1012 "LongPathToShortPath"
1027 "PlayMMedia" ; IS5 only
1034 "RegDBGetKeyValueEx"
1035 "RegDBSetKeyValueEx"
1036 "RegDBSetDefaultRoot"
1045 "SdComponentAdvCheckSpace"
1046 "SdComponentAdvInit"
1047 "SdComponentAdvUpdateSpace"
1049 "SdComponentDialog2"
1050 "SdComponentDialogAdv"
1051 "SdComponentDialogEx"
1052 "SdComponentDlgCheckSpace"
1055 "SdConfirmRegistration"
1067 "SdGetUserCompanyInfo"
1076 "SdOptionsButtonsInit"
1077 "SdPlugInProductName"
1080 "SdRegExEnableButton"
1085 "SdSetSequentialItems"
1087 "SdSetupTypeEx" ; IS5 only
1098 "SdUpdateComponentSelection"
1104 "SetDisplayEffect" ; IS5 only
1106 "SetForegroundWindow"
1119 "StrRemoveLastSlash"
1134 "System functions defined in InstallShield 3 and 5.")
1136 (defvar installshield-system-variables-list
1141 "CORECOMPONENTHANDLING"
1168 "System variables used in InstallShield 3 and 5.")
1170 (defvar installshield-types-list
1191 "Type keywords used in InstallShield 3 and 5.")
1193 ;;; some might want to skip highlighting these to improve performance
1194 (defvar installshield-funarg-constants-list
1225 "COMP_UPDATE_VERSION"
1244 "DLG_INFO_CHECKSELECTION"
1246 "DLG_INFO_USEDECIMAL"
1247 "DLG_MSG_INFORMATION"
1268 "FILE_ATTR_ARCHIVED"
1269 "FILE_ATTR_DIRECTORY"
1272 "FILE_ATTR_READONLY"
1278 "FILE_MODE_BINARYREADONLY"
1300 "HKEY_LOCAL_MACHINE"
1345 "REGDB_APPPATH_DEFAULT"
1348 "REGDB_ERR_CONNECTIONEXISTS"
1349 "REGDB_ERR_CORRUPTEDREGSITRY"
1350 "REGDB_ERR_INITIALIZATION"
1351 "REGDB_ERR_INVALIDHANDLE"
1352 "REGDB_ERR_INVALIDNAME"
1354 "REGDB_STRING_EXPAND"
1355 "REGDB_STRING_MULTI"
1357 "REGDB_UNINSTALL_NAME"
1402 "Function argument constants used in InstallShield 3 and 5.")
1405 (defvar rul-generic-mode-syntax-table nil
1406 "Syntax table to use in rul-generic-mode buffers.")
1408 (setq rul-generic-mode-syntax-table
1409 (make-syntax-table c
++-mode-syntax-table
))
1411 (modify-syntax-entry ?
\r "> b" rul-generic-mode-syntax-table
)
1412 (modify-syntax-entry ?
\n "> b" rul-generic-mode-syntax-table
)
1415 ;; XEmacs 19 & 20 & 21
1416 ((memq '8-bit c-emacs-features
)
1417 (modify-syntax-entry ?
/ ". 1456" rul-generic-mode-syntax-table
)
1418 (modify-syntax-entry ?
* ". 23" rul-generic-mode-syntax-table
)
1421 ((memq '1-bit c-emacs-features
)
1422 (modify-syntax-entry ?
/ ". 124b" rul-generic-mode-syntax-table
)
1423 (modify-syntax-entry ?
* ". 23" rul-generic-mode-syntax-table
)
1426 (t (error "Run Mode is incompatible with this version of Emacs"))
1429 ;; here manually instead
1430 (defun generic-rul-mode-setup-function ()
1431 (make-local-variable 'parse-sexp-ignore-comments
)
1432 (make-local-variable 'comment-start
)
1433 (make-local-variable 'comment-start-skip
)
1434 (make-local-variable 'comment-end
)
1435 (setq imenu-generic-expression
1436 '((nil "^function\\s-+\\([A-Za-z0-9_]+\\)" 1))
1437 parse-sexp-ignore-comments t
1441 ;; comment-start "//"
1442 ;; comment-start-skip ""
1444 ;; (set-syntax-table rul-generic-mode-syntax-table)
1445 (setq font-lock-syntax-table rul-generic-mode-syntax-table
)
1448 ;; moved mode-definition behind defun-definition to be warning-free - 15.11.02/RSan
1449 (define-generic-mode 'rul-generic-mode
1450 ;; Using "/*" and "*/" doesn't seem to be working right
1451 (list "//" '("/*" .
"*/" ))
1452 installshield-statement-keyword-list
1454 ;; preprocessor constructs
1455 '("#[ \t]*include[ \t]+\\(<[^>\"\n]+>\\)"
1456 1 font-lock-string-face
)
1457 '("#[ \t]*\\(\\sw+\\)\\>[ \t]*\\(\\sw+\\)?"
1458 (1 font-lock-reference-face
)
1459 (2 font-lock-variable-name-face nil t
))
1460 ;; indirect string constants
1461 '("\\(@[A-Za-z][A-Za-z0-9_]+\\)" 1 font-lock-builtin-face
)
1463 '("[ \t]*\\(\\sw+:\\)" 1 font-lock-reference-face
)
1464 '("\\<\\(goto\\)\\>[ \t]*\\(\\sw+\\)?"
1465 (1 font-lock-keyword-face
)
1466 (2 font-lock-reference-face nil t
))
1468 (generic-make-keywords-list
1469 installshield-system-variables-list
1470 'font-lock-variable-name-face
"[^_]" "[^_]")
1472 (generic-make-keywords-list
1473 installshield-system-functions-list
1474 'font-lock-function-name-face
"[^_]" "[^_]")
1476 (generic-make-keywords-list
1477 installshield-types-list
1478 'font-lock-type-face
"[^_]" "[^_]")
1479 ;; function argument constants
1480 (generic-make-keywords-list
1481 installshield-funarg-constants-list
1482 'font-lock-variable-name-face
"[^_]" "[^_]") ; is this face the best choice?
1484 (list "\\.[rR][uU][lL]$")
1485 (list 'generic-rul-mode-setup-function
)
1486 "Generic mode for InstallShield RUL files.")
1488 (define-skeleton rul-if
1489 "Insert an if statement."
1491 "if(" str
") then" \n
1493 ( "other condition, %s: "
1494 > "elseif(" str
") then" \n
1502 (define-skeleton rul-function
1503 "Insert a function statement."
1505 "function " str
" ()" \n
1506 ( "local variables, %s: "
1515 ;; Additions by ACorreir@pervasive-sw.com (Alfred Correira)
1516 (define-generic-mode 'mailrc-generic-mode
1529 '(("^\\s-*\\(alias\\|group\\)\\s-+\\([-A-Za-z0-9_]+\\)\\s-+\\([^\n\r#]*\\)\\(#.*\\)?$"
1530 (2 font-lock-constant-face
) (3 font-lock-variable-name-face
))
1531 ("^\\s-*\\(unset\\|set\\|ignore\\)\\s-+\\([-A-Za-z0-9_]+\\)=?\\([^\n\r#]*\\)\\(#.*\\)?$"
1532 (2 font-lock-constant-face
) (3 font-lock-variable-name-face
))
1533 ("^\\s-*\\(source\\)\\s-+\\([^\n\r#]*\\)\\(#.*\\)?$"
1534 (2 font-lock-variable-name-face
)))
1535 (list "\\.mailrc\\'")
1537 "Mode for mailrc files.")
1541 (memq 'inetd-conf-generic-mode generic-extras-enable-list
)
1543 (define-generic-mode 'inetd-conf-generic-mode
1555 ("^\\([-A-Za-z0-9_]+\\)"
1556 1 'font-lock-type-face
)
1558 '("/etc/inetd.conf\\'")
1562 (setq imenu-generic-expression
1563 '((nil "^\\([-A-Za-z0-9_]+\\)" 1)))
1570 (memq 'etc-services-generic-mode generic-extras-enable-list
)
1572 (define-generic-mode 'etc-services-generic-mode
1580 ("^\\([-A-Za-z0-9_]+\\)\\s-+\\([0-9]+\\)/"
1581 (1 'font-lock-type-face
)
1582 (2 'font-lock-variable-name-face
)
1585 '("/etc/services\\'")
1589 (setq imenu-generic-expression
1590 '((nil "^\\([-A-Za-z0-9_]+\\)" 1)))
1595 ;; Password and Group files
1597 (memq 'etc-passwd-generic-mode generic-extras-enable-list
)
1599 (define-generic-mode 'etc-passwd-generic-mode
1600 nil
;; No comment characters
1601 (list "root") ;; Only one keyword
1606 ;; User name -- Never blank!
1609 ;; Password, UID and GID
1612 (make-list 3 "\\([^:]+\\)")
1616 ;; GECOS/Name -- might be blank
1619 ;; Home directory and shell
1625 '(1 'font-lock-type-face
)
1626 '(5 'font-lock-variable-name-face
)
1627 '(6 'font-lock-constant-face
)
1628 '(7 'font-lock-warning-face
)
1630 '("^\\([^:]+\\):\\([^:]*\\):\\([0-9]+\\):\\(.*\\)$"
1631 (1 'font-lock-type-face
)
1632 (4 'font-lock-variable-name-face
)
1635 '("/etc/passwd\\'" "/etc/group\\'")
1639 (setq imenu-generic-expression
1640 '((nil "^\\([-A-Za-z0-9_]+\\):" 1)))
1647 (memq 'etc-fstab-generic-mode generic-extras-enable-list
)
1649 (define-generic-mode 'etc-fstab-generic-mode
1661 ("^\\([/-A-Za-z0-9_]+\\)\\s-+\\([/-A-Za-z0-9_]+\\)"
1662 (1 'font-lock-type-face
)
1663 (2 'font-lock-variable-name-face
)
1666 '("/etc/[v]*fstab\\'")
1670 (setq imenu-generic-expression
1671 '((nil "^\\([/-A-Za-z0-9_]+\\)\\s-+" 1)))
1676 ;; From Jacques Duthen <jacques.duthen@sncf.fr>
1677 (defvar show-tabs-generic-mode-font-lock-defaults-1
1678 '( ;; trailing spaces must come before...
1679 ("[ \t]+$" .
'show-tabs-space-face
)
1681 ("[^\n\t]\\(\t+\\)" (1 'show-tabs-tab-face
))))
1683 (defvar show-tabs-generic-mode-font-lock-defaults-2
1684 '( ;; trailing spaces must come before...
1685 ("[ \t]+$" .
'show-tabs-space-face
)
1687 ("\t+" .
'show-tabs-tab-face
)))
1689 (defface show-tabs-tab-face
1690 '((((class grayscale
) (background light
)) (:foreground
"LightGray" :weight bold
))
1691 (((class grayscale
) (background dark
)) (:foreground
"DimGray" :weight bold
))
1692 (((class color
) (background light
)) (:foreground
"red"))
1693 (((class color
) (background dark
)) (:foreground
"red"))
1695 "Font Lock mode face used to highlight TABs."
1698 (defface show-tabs-space-face
1699 '((((class grayscale
) (background light
)) (:foreground
"LightGray" :weight bold
))
1700 (((class grayscale
) (background dark
)) (:foreground
"DimGray" :weight bold
))
1701 (((class color
) (background light
)) (:foreground
"yellow"))
1702 (((class color
) (background dark
)) (:foreground
"yellow"))
1704 "Font Lock mode face used to highlight spaces."
1707 (define-generic-mode 'show-tabs-generic-mode
1708 () ;; no comment char
1710 show-tabs-generic-mode-font-lock-defaults-1
1711 () ;; no auto-mode-alist
1712 ;; (list 'show-tabs-generic-mode-hook-fun)
1714 "Generic mode to show tabs and trailing spaces")
1716 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1718 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1720 (define-generic-mode 'named-boot-generic-mode
1721 ;;List of comment characters
1724 (list "cache" "primary" "secondary" "forwarders" "limit" "options"
1725 "directory" "check-names")
1726 ;;List of additional font-lock-expressions
1728 (list "\\([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+\\)" 1 'font-lock-constant-face
)
1729 (list "^directory\\s-+\\(.*\\)" 1 'font-lock-variable-name-face
)
1730 (list "^\\(primary\\|cache\\)\\s-+\\([.A-Za-z]+\\)\\s-+\\(.*\\)"
1731 (list 2 'font-lock-variable-name-face
)
1732 (list 3 'font-lock-constant-face
))
1734 ;;List of additional automode-alist expressions
1735 (list "/etc/named.boot\\'")
1736 ;;List of set up functions to call
1740 (define-generic-mode 'named-database-generic-mode
1741 ;;List of comment characters
1744 (list "IN" "NS" "CNAME" "SOA" "PTR" "MX" "A")
1745 ;;List of additional font-lock-expressions
1747 (list "\\([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+\\)" 1 'font-lock-constant-face
)
1748 (list "^\\([.A-Za-z0-9]+\\)" 1 'font-lock-variable-name-face
)
1750 ;;List of additional automode-alist expressions
1752 ;;List of set up functions to call
1756 (defvar named-database-time-string
"%Y%m%d%H"
1757 "Timestring for named serial numbers.")
1759 (defun named-database-print-serial ()
1760 "Print a serial number based on the current date."
1762 (insert (format-time-string named-database-time-string
(current-time)))
1765 (define-generic-mode 'resolve-conf-generic-mode
1766 ;;List of comment characters
1769 (list "nameserver" "domain" "search" "sortlist" "options")
1770 ;;List of additional font-lock-expressions
1772 ;;List of additional automode-alist expressions
1773 (list "/etc/resolv[e]?.conf\\'")
1774 ;;List of set up functions to call
1778 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1779 ;; Modes for spice and common electrical engineering circuit netlist formats
1780 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1782 (define-generic-mode 'spice-generic-mode
1802 ("^\\s-*\\([*].*\\)" 1 'font-lock-comment-face
)
1803 (" \\(\\$ .*\\)$" 1 'font-lock-comment-face
)
1804 ("^\\(\\$ .*\\)$" 1 'font-lock-comment-face
)
1805 ("\\([*].*\\)" 1 'font-lock-comment-face
)
1806 ("^\\([+]\\)" 1 'font-lock-string-face
)
1807 ("^\\s-*\\([.]\\w+\\>\\)" 1 'font-lock-keyword-face
)
1808 ("\\(\\([.]\\|_\\|\\w\\)+\\)\\s-*=" 1 'font-lock-variable-name-face
)
1809 ("\\('[^']+'\\)" 1 'font-lock-string-face
)
1810 ("\\(\"[^\"]+\"\\)" 1 'font-lock-string-face
)
1812 (list "\\.[sS][pP]\\'"
1813 "\\.[sS][pP][iI]\\'"
1814 "\\.[sS][pP][iI][cC][eE]\\'"
1815 "\\.[iI][nN][cC]\\'")
1817 'generic-bracket-support
1818 ;; Make keywords case-insensitive
1821 (setq font-lock-defaults
(list 'generic-font-lock-defaults nil t
))))
1823 "Generic mode for SPICE circuit netlist files."
1826 (define-generic-mode 'ibis-generic-mode
1830 ("[[]\\([^]]*\\)[]]" 1 'font-lock-keyword-face
)
1831 ("\\(\\(_\\|\\w\\)+\\)\\s-*=" 1 'font-lock-variable-name-face
)
1833 (list "\\.[iI][bB][sS]\\'")
1834 (list 'generic-bracket-support
)
1835 "Generic mode for IBIS circuit netlist files."
1838 (define-generic-mode 'astap-generic-mode
1856 ("^\\s-*\\([*].*\\)" 1 'font-lock-comment-face
)
1857 (";\\s-*\\([*].*\\)" 1 'font-lock-comment-face
)
1858 ("^\\s-*\\([.]\\w+\\>\\)" 1 'font-lock-keyword-face
)
1859 ("\\('[^']+'\\)" 1 'font-lock-string-face
)
1860 ("\\(\"[^\"]+\"\\)" 1 'font-lock-string-face
)
1861 ("[(,]\\s-*\\(\\([.]\\|_\\|\\w\\)+\\)\\s-*=" 1 'font-lock-variable-name-face
)
1863 (list "\\.[aA][pP]\\'"
1864 "\\.[aA][sS][xX]\\'"
1865 "\\.[aA][sS][tT][aA][pP]\\'"
1866 "\\.[pP][sS][pP]\\'"
1867 "\\.[dD][eE][cC][kK]\\'"
1868 "\\.[gG][oO][dD][aA][tT][aA]")
1870 'generic-bracket-support
1871 ;; Make keywords case-insensitive
1874 (setq font-lock-defaults
(list 'generic-font-lock-defaults nil t
))))
1876 "Generic mode for ASTAP circuit netlist files."
1879 (define-generic-mode 'etc-modules-conf-generic-mode
1880 ;;List of comment characters
1883 (list "alias" "pre-install" "post-install" "options" "probeall")
1884 ;;List of additional font-lock-expressions
1886 ;;List of additional automode-alist expressions
1887 (list "/etc/modules.conf" "/etc/conf.modules")
1888 ;;List of set up functions to call
1892 (provide 'generic-x
)
1894 ;;; generic-x.el ends here