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)
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.
97 (defgroup generic-x nil
98 "Extra modes for generic mode."
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."
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."
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."
125 (and generic-define-mswindows-modes
126 (setq generic-extras-enable-list
127 (append (list 'bat-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
145 'x-resource-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 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
155 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
158 (when (memq 'apache-conf-generic-mode generic-extras-enable-list
)
160 (define-generic-mode apache-conf-generic-mode
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\\'")
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"))
189 (when (memq 'samba-generic-mode generic-extras-enable-list
)
191 (define-generic-mode samba-generic-mode
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."))
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
224 (list "\\.fvwmrc\\'" "\\.fvwm2rc\\'")
226 "Generic mode for FVWM configuration files."))
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
236 '(("^\\([^:\n]+:\\)" 1 'font-lock-variable-name-face
))
237 (list "\\.Xdefaults\\'" "\\.Xresources\\'" "\\.Xenvironment\\'" "\\.ad\\'")
239 "Generic mode for X Resource configuration files."))
242 (when (memq 'hosts-generic-mode generic-extras-enable-list
)
244 (define-generic-mode hosts-generic-mode
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
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
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]\\'")
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
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]\\'")
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
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
)
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.
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
326 (generic-make-keywords-list
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
334 (generic-make-keywords-list
341 'font-lock-keyword-face
)
342 ;; These are built-in commands. Only frequently-used ones are listed.
343 (generic-make-keywords-list
353 "PAUSE" "pause" "Pause"
354 "PROMPT" "prompt" "Prompt"
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
)))
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."
388 (let ((compilation-buffer-name-function
391 (concat "*" (buffer-file-name) "*")))))
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."
399 (let* ((file (buffer-file-name))
400 (buf-name (concat "*" file
"*")))
403 (get-buffer-create buf-name
))
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
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
)))
440 ;; Mailagent is a Unix mail filtering program. Anyone wanna do a generic mode
442 (when (memq 'mailagent-rules-generic-mode generic-extras-enable-list
)
444 (define-generic-mode mailagent-rules-generic-mode
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
))
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
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
487 '(("^\\([A-Za-z_]+\\)=\\([^\n\r]*\\)$"
488 (1 font-lock-keyword-face
)
489 (2 font-lock-variable-name-face
)))
492 "Mode for Sys V pkginfo files."))
495 ;; Includes extra keywords from Armando Singer [asinger@MAIL.COLGATE.EDU]
496 (define-generic-mode javascript-generic-mode
497 (list "//" '("/*" .
"*/"))
521 ;; words reserved for ECMA extensions below
532 ;; Java Keywords reserved by JavaScript
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
)))
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.")
574 (define-generic-mode vrml-generic-mode
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
))
614 "^\\s-*\\(geometry\\|appearance\\|material\\)\\s-+\\([-A-Za-z0-9_]+\\)"
615 '(2 font-lock-variable-name-face
)))
620 (setq imenu-generic-expression
621 '((nil "^\\([A-Za-z0-9_]+\\)\\s-*{" 1)
623 "DEF\\s-+\\([-A-Za-z0-9_]+\\)\\s-+\\([A-Za-z0-9]+\\)\\s-*{"
625 "Generic Mode for VRML files.")
628 (define-generic-mode java-manifest-generic-mode
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
651 (let ((java-properties-key
652 "\\(\\([-A-Za-z0-9_\\./]\\|\\(\\\\[ =:]\\)\\)+\\)")
653 (java-properties-value
655 ;; Property and value can be separated in a number of different ways:
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-*")))
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
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
)))
690 (setq imenu-generic-expression
691 '((nil "^\\(alias\\|unalias\\)\\s-+\\([-a-zA-Z0-9_]+\\)" 2))))))
692 "Mode for C Shell alias 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
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
758 (generic-make-keywords-list
767 'font-lock-type-face
))
769 (generic-make-keywords-list
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
813 ;; "goto" -- handled elsewhere
827 "Statement keywords used in InstallShield 3 and 5.")
829 (defvar installshield-system-functions-list
850 "ComponentAddItem" ; differs between IS3 and IS5
851 "ComponentCompareSizeRequired" ; IS5 only
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
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
872 "ComponentValidate" ; IS5 only
873 "CompressAdd" ; IS3 only
874 "CompressDel" ; IS3 only
875 "CompressEnum" ; IS3 only
876 "CompressGet" ; IS3 only
877 "CompressInfo" ; IS3 only
881 "CreateProgramFolder"
882 "DeinstallSetReference" ; IS5 only
908 "FileSetBeginDefine" ; IS3 only
909 "FileSetEndDefine" ; IS3 only
910 "FileSetPerformEz" ; IS3 only
911 "FileSetPerform" ; IS3 only
912 "FileSetReset" ; IS3 only
913 "FileSetRoot" ; IS3 only
952 "LongPathToShortPath"
967 "PlayMMedia" ; IS5 only
976 "RegDBSetDefaultRoot"
985 "SdComponentAdvCheckSpace"
987 "SdComponentAdvUpdateSpace"
990 "SdComponentDialogAdv"
991 "SdComponentDialogEx"
992 "SdComponentDlgCheckSpace"
995 "SdConfirmRegistration"
1007 "SdGetUserCompanyInfo"
1016 "SdOptionsButtonsInit"
1017 "SdPlugInProductName"
1020 "SdRegExEnableButton"
1025 "SdSetSequentialItems"
1027 "SdSetupTypeEx" ; IS5 only
1038 "SdUpdateComponentSelection"
1044 "SetDisplayEffect" ; IS5 only
1046 "SetForegroundWindow"
1059 "StrRemoveLastSlash"
1073 "System functions defined in InstallShield 3 and 5.")
1075 (defvar installshield-system-variables-list
1080 "CORECOMPONENTHANDLING"
1106 "System variables used in InstallShield 3 and 5.")
1108 (defvar installshield-types-list
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
1162 "COMP_UPDATE_VERSION"
1181 "DLG_INFO_CHECKSELECTION"
1183 "DLG_INFO_USEDECIMAL"
1184 "DLG_MSG_INFORMATION"
1205 "FILE_ATTR_ARCHIVED"
1206 "FILE_ATTR_DIRECTORY"
1209 "FILE_ATTR_READONLY"
1215 "FILE_MODE_BINARYREADONLY"
1237 "HKEY_LOCAL_MACHINE"
1282 "REGDB_APPPATH_DEFAULT"
1285 "REGDB_ERR_CONNECTIONEXISTS"
1286 "REGDB_ERR_CORRUPTEDREGSITRY"
1287 "REGDB_ERR_INITIALIZATION"
1288 "REGDB_ERR_INVALIDHANDLE"
1289 "REGDB_ERR_INVALIDNAME"
1291 "REGDB_STRING_EXPAND"
1292 "REGDB_STRING_MULTI"
1294 "REGDB_UNINSTALL_NAME"
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
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
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
)
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
))
1390 (generic-make-keywords-list
1391 installshield-system-variables-list
1392 'font-lock-variable-name-face
"[^_]" "[^_]")
1394 (generic-make-keywords-list
1395 installshield-system-functions-list
1396 'font-lock-function-name-face
"[^_]" "[^_]")
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."
1412 "if(" str
") then" \n
1414 ( "other condition, %s: "
1415 > "elseif(" str
") then" \n
1422 (define-skeleton rul-function
1423 "Insert a function statement."
1425 "function " str
" ()" \n
1426 ( "local variables, %s: "
1433 ;; Additions by ACorreir@pervasive-sw.com (Alfred Correira)
1434 (define-generic-mode mailrc-generic-mode
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.")
1457 (when (memq 'inetd-conf-generic-mode generic-extras-enable-list
)
1459 (define-generic-mode inetd-conf-generic-mode
1469 '(("^\\([-A-Za-z0-9_]+\\)"
1470 1 'font-lock-type-face
))
1471 '("/etc/inetd.conf\\'")
1475 (setq imenu-generic-expression
1476 '((nil "^\\([-A-Za-z0-9_]+\\)" 1))))))))
1479 (when (memq 'etc-services-generic-mode generic-extras-enable-list
)
1481 (define-generic-mode etc-services-generic-mode
1487 '(("^\\([-A-Za-z0-9_]+\\)\\s-+\\([0-9]+\\)/"
1488 (1 'font-lock-type-face
)
1489 (2 'font-lock-variable-name-face
)))
1490 '("/etc/services\\'")
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
1507 ;; User name -- Never blank!
1510 ;; Password, UID and GID
1513 (make-list 3 "\\([^:]+\\)")
1516 ;; GECOS/Name -- might be blank
1519 ;; Home directory and shell
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\\'")
1535 (setq imenu-generic-expression
1536 '((nil "^\\([-A-Za-z0-9_]+\\):" 1))))))))
1539 (when (memq 'etc-fstab-generic-mode generic-extras-enable-list
)
1541 (define-generic-mode etc-fstab-generic-mode
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\\'")
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
)
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
)
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"))
1608 "Font Lock mode face used to highlight 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"))
1617 "Font Lock mode face used to highlight spaces."
1620 (define-generic-mode show-tabs-generic-mode
1621 () ;; no comment char
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 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1631 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1633 (define-generic-mode named-boot-generic-mode
1634 ;; List of comment characters
1637 (list "cache" "primary" "secondary" "forwarders" "limit" "options"
1638 "directory" "check-names")
1639 ;; List of additional font-lock-expressions
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
1651 (define-generic-mode named-database-generic-mode
1652 ;; List of comment characters
1655 (list "IN" "NS" "CNAME" "SOA" "PTR" "MX" "A")
1656 ;; List of additional font-lock-expressions
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
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."
1671 (insert (format-time-string named-database-time-string
(current-time))))
1673 (define-generic-mode resolve-conf-generic-mode
1674 ;; List of comment characters
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
1685 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1686 ;; Modes for spice and common electrical engineering circuit netlist formats
1687 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1689 (define-generic-mode spice-generic-mode
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]\\'")
1722 'generic-bracket-support
1723 ;; Make keywords case-insensitive
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
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
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]")
1768 'generic-bracket-support
1769 ;; Make keywords case-insensitive
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
1795 "generic_stringfile"
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
1818 (provide 'generic-x
)
1820 ;;; arch-tag: cde692a5-9ff6-4506-9999-c67999c2bdb5
1821 ;;; generic-x.el ends here