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 '(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 '(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 '("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."
176 (when (memq 'apache-log-generic-mode generic-extras-enable-list
)
178 (define-generic-mode apache-log-generic-mode
181 ;; Hostname ? user date request return-code number-of-bytes
182 '(("^\\([-a-zA-z0-9.]+\\) - [-A-Za-z]+ \\(\\[.*\\]\\)"
183 (1 font-lock-constant-face
)
184 (2 font-lock-variable-name-face
)))
187 "Mode for Apache log files"
191 (when (memq 'samba-generic-mode generic-extras-enable-list
)
193 (define-generic-mode samba-generic-mode
196 '(("^\\(\\[.*\\]\\)" 1 font-lock-constant-face
)
197 ("^\\s-*\\(.+\\)=\\([^\r\n]*\\)"
198 (1 font-lock-variable-name-face
)
199 (2 font-lock-type-face
)))
201 '(generic-bracket-support)
202 "Generic mode for Samba configuration files."
206 ;; This is pretty basic. Also, modes for other window managers could
207 ;; be defined as well.
208 (when (memq 'fvwm-generic-mode generic-extras-enable-list
)
210 (define-generic-mode fvwm-generic-mode
226 '("\\.fvwmrc\\'" "\\.fvwm2rc\\'")
228 "Generic mode for FVWM configuration files."
232 ;; I'm pretty sure I've seen an actual mode to do this, but I don't
233 ;; think it's standard with Emacs
234 (when (memq 'x-resource-generic-mode generic-extras-enable-list
)
236 (define-generic-mode x-resource-generic-mode
239 '(("^\\([^:\n]+:\\)" 1 font-lock-variable-name-face
))
240 '("\\.Xdefaults\\'" "\\.Xresources\\'" "\\.Xenvironment\\'" "\\.ad\\'")
242 "Generic mode for X Resource configuration files."
246 (when (memq 'hosts-generic-mode generic-extras-enable-list
)
248 (define-generic-mode hosts-generic-mode
251 '(("\\([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+\\)" 1 font-lock-constant-face
))
252 '("[hH][oO][sS][tT][sS]\\'")
254 "Generic mode for HOSTS files."
257 ;;; Windows INF files
258 (when (memq 'inf-generic-mode generic-extras-enable-list
)
260 (define-generic-mode inf-generic-mode
263 '(("^\\(\\[.*\\]\\)" 1 font-lock-constant-face
))
264 '("\\.[iI][nN][fF]\\'")
265 '(generic-bracket-support)
266 "Generic mode for MS-Windows INF files."
269 ;;; Windows INI files
270 ;; Should define escape character as well!
271 (when (memq 'ini-generic-mode generic-extras-enable-list
)
273 (define-generic-mode ini-generic-mode
276 '(("^\\(\\[.*\\]\\)" 1 font-lock-constant-face
)
277 ("^\\([^=\n\r]*\\)=\\([^\n\r]*\\)$"
278 (1 font-lock-function-name-face
)
279 (2 font-lock-variable-name-face
)))
280 '("\\.[iI][nN][iI]\\'")
284 (setq imenu-generic-expression
285 '((nil "^\\[\\(.*\\)\\]" 1)
286 ("*Variables*" "^\\s-*\\([^=]+\\)\\s-*=" 1))))))
287 "Generic mode for MS-Windows INI files."
290 ;;; Windows REG files
291 ;;; Unfortunately, Windows 95 and Windows NT have different REG file syntax!
292 (when (memq 'reg-generic-mode generic-extras-enable-list
)
294 (define-generic-mode reg-generic-mode
296 '("key" "classes_root" "REGEDIT" "REGEDIT4")
297 '(("\\(\\[.*]\\)" 1 font-lock-constant-face
)
298 ("^\\([^\n\r]*\\)\\s-*=" 1 font-lock-variable-name-face
))
299 '("\\.[rR][eE][gG]\\'")
303 (setq imenu-generic-expression
304 '((nil "^\\s-*\\(.*\\)\\s-*=" 1))))))
305 "Generic mode for MS-Windows Registry files."
308 ;;; DOS/Windows BAT files
309 (when (memq 'bat-generic-mode generic-extras-enable-list
)
311 (define-generic-mode bat-generic-mode
316 ;; Make this one first in the list, otherwise comments will
317 ;; be over-written by other variables
318 '("^[@ \t]*\\([rR][eE][mM][^\n\r]*\\)" 1 font-lock-comment-face t
)
319 '("^[ \t]*\\(::.*\\)" 1 font-lock-comment-face t
)
320 '("^[@ \t]*\\([bB][rR][eE][aA][kK]\\|[vV][eE][rR][iI][fF][yY]\\)[ \t]+\\([oO]\\([nN]\\|[fF][fF]\\)\\)"
321 (1 font-lock-builtin-face
)
322 (2 font-lock-constant-face t t
))
323 ;; Any text (except ON/OFF) following ECHO is a string.
324 '("^[@ \t]*\\([eE][cC][hH][oO]\\)[ \t]+\\(\\([oO]\\([nN]\\|[fF][fF]\\)\\)\\|\\([^>|\r\n]+\\)\\)"
325 (1 font-lock-builtin-face
)
326 (3 font-lock-constant-face t t
)
327 (5 font-lock-string-face t t
))
328 ;; These keywords appear as the first word on a line. (Actually, they
329 ;; can also appear after "if ..." or "for ..." clause, but since they
330 ;; are frequently used in simple text, we punt.)
331 ;; In `generic-bat-mode-setup-function' we make the keywords
333 (generic-make-keywords-list
336 font-lock-keyword-face
"^[@ \t]*")
337 ;; These keywords can be anywhere on a line
338 ;; In `generic-bat-mode-setup-function' we make the keywords
340 (generic-make-keywords-list
346 font-lock-keyword-face
)
347 ;; These are built-in commands. Only frequently-used ones are listed.
348 (generic-make-keywords-list
349 '("CALL" "call" "Call"
357 "PAUSE" "pause" "Pause"
358 "PROMPT" "prompt" "Prompt"
362 "START" "start" "Start"
363 "SHIFT" "shift" "Shift")
364 font-lock-builtin-face
"[ \t|\n]")
365 '("^[ \t]*\\(:\\sw+\\)" 1 font-lock-function-name-face t
)
366 '("\\(%\\sw+%\\)" 1 font-lock-variable-name-face t
)
367 '("\\(%[0-9]\\)" 1 font-lock-variable-name-face t
)
368 '("\\(/[^/ \"\t\n]+\\)" 1 font-lock-type-face
)
369 '("[\t ]+\\([+-][^\t\n\" ]+\\)" 1 font-lock-type-face
)
370 '("[ \t\n|]\\<\\([gG][oO][tT][oO]\\)\\>[ \t]*\\(\\sw+\\)?"
371 (1 font-lock-keyword-face
)
372 (2 font-lock-function-name-face nil t
))
373 '("[ \t\n|]\\<\\([sS][eE][tT]\\)\\>[ \t]*\\(\\sw+\\)?[ \t]*=?"
374 (1 font-lock-builtin-face
)
375 (2 font-lock-variable-name-face t t
))))
376 '("\\.[bB][aA][tT]\\'"
377 "\\`[cC][oO][nN][fF][iI][gG]\\."
378 "\\`[aA][uU][tT][oO][eE][xX][eE][cC]\\.")
379 '(generic-bat-mode-setup-function)
380 "Generic mode for MS-Windows BAT files."
383 (defvar bat-generic-mode-syntax-table nil
384 "Syntax table in use in bat-generic-mode buffers.")
386 (defvar bat-generic-mode-keymap
(make-sparse-keymap)
387 "Keymap for bet-generic-mode.")
389 (defun bat-generic-mode-compile ()
390 "Run the current BAT file in a compilation buffer."
392 (let ((compilation-buffer-name-function
395 (concat "*" (buffer-file-name) "*")))))
397 (concat (w32-shell-name) " -c " (buffer-file-name)))))
399 (defun bat-generic-mode-run-as-comint ()
400 "Run the current BAT file in a comint buffer."
403 (let* ((file (buffer-file-name))
404 (buf-name (concat "*" file
"*")))
407 (get-buffer-create buf-name
))
416 (display-buffer buf-name
))))
418 (define-key bat-generic-mode-keymap
"\C-c\C-c" 'bat-generic-mode-compile
)
420 ;; Make underscores count as words
421 (unless bat-generic-mode-syntax-table
422 (setq bat-generic-mode-syntax-table
(make-syntax-table))
423 (modify-syntax-entry ?_
"w" bat-generic-mode-syntax-table
))
425 ;; bat-generic-mode doesn't use the comment functionality of
426 ;; define-generic-mode because it has a three-letter comment-string,
427 ;; so we do it here manually instead
428 (defun generic-bat-mode-setup-function ()
429 (make-local-variable 'parse-sexp-ignore-comments
)
430 (make-local-variable 'comment-start
)
431 (make-local-variable 'comment-start-skip
)
432 (make-local-variable 'comment-end
)
433 (setq imenu-generic-expression
'((nil "^:\\(\\sw+\\)" 1))
434 parse-sexp-ignore-comments t
437 comment-start-skip
"[Rr][Ee][Mm] *")
438 (set-syntax-table bat-generic-mode-syntax-table
)
439 ;; Make keywords case-insensitive
440 (setq font-lock-defaults
'(generic-font-lock-keywords nil t
))
441 (use-local-map bat-generic-mode-keymap
)))
444 ;; Mailagent is a Unix mail filtering program. Anyone wanna do a
445 ;; generic mode for procmail?
446 (when (memq 'mailagent-rules-generic-mode generic-extras-enable-list
)
448 (define-generic-mode mailagent-rules-generic-mode
450 '("SAVE" "DELETE" "PIPE" "ANNOTATE" "REJECT")
451 '(("^\\(\\sw+\\)\\s-*=" 1 font-lock-variable-name-face
)
452 ("\\s-/\\([^/]+\\)/[i, \t\n]" 1 font-lock-constant-face
))
457 (setq imenu-generic-expression
458 '((nil "\\s-/\\([^/]+\\)/[i, \t\n]" 1))))))
459 "Mode for Mailagent rules files."
462 ;; Solaris/Sys V prototype files
463 (when (memq 'prototype-generic-mode generic-extras-enable-list
)
465 (define-generic-mode prototype-generic-mode
468 '(("^\\([0-9]\\)?\\s-*\\([a-z]\\)\\s-+\\([A-Za-z_]+\\)\\s-+\\([^\n\r]*\\)$"
469 (2 font-lock-constant-face
)
470 (3 font-lock-keyword-face
))
471 ("^\\([a-z]\\) \\([A-Za-z_]+\\)=\\([^\n\r]*\\)$"
472 (1 font-lock-constant-face
)
473 (2 font-lock-keyword-face
)
474 (3 font-lock-variable-name-face
))
475 ("^\\(!\\s-*\\(search\\|include\\|default\\)\\)\\s-*\\([^\n\r]*\\)$"
476 (1 font-lock-keyword-face
)
477 (3 font-lock-variable-name-face
))
478 ("^\\(!\\s-*\\sw+\\)=\\([^\n\r]*\\)$"
479 (1 font-lock-keyword-face
)
480 (2 font-lock-variable-name-face
)))
483 "Mode for Sys V prototype files."
486 ;; Solaris/Sys V pkginfo files
487 (when (memq 'pkginfo-generic-mode generic-extras-enable-list
)
489 (define-generic-mode pkginfo-generic-mode
492 '(("^\\([A-Za-z_]+\\)=\\([^\n\r]*\\)$"
493 (1 font-lock-keyword-face
)
494 (2 font-lock-variable-name-face
)))
497 "Mode for Sys V pkginfo files."
501 ;; Includes extra keywords from Armando Singer [asinger@MAIL.COLGATE.EDU]
502 (define-generic-mode javascript-generic-mode
503 '("//" ("/*" .
"*/"))
526 ;; words reserved for ECMA extensions below
537 ;; Java Keywords reserved by JavaScript
564 '(("^\\s-*function\\s-+\\([A-Za-z0-9_]+\\)"
565 (1 font-lock-function-name-face
))
566 ("^\\s-*var\\s-+\\([A-Za-z0-9_]+\\)"
567 (1 font-lock-variable-name-face
)))
572 (setq imenu-generic-expression
573 '((nil "^function\\s-+\\([A-Za-z0-9_]+\\)" 1)
574 ("*Variables*" "^var\\s-+\\([A-Za-z0-9_]+\\)" 1))))))
575 "Mode for JavaScript files."
579 (define-generic-mode vrml-generic-mode
609 '(("USE\\s-+\\([-A-Za-z0-9_]+\\)"
610 (1 font-lock-constant-face
))
611 ("DEF\\s-+\\([-A-Za-z0-9_]+\\)\\s-+\\([A-Za-z0-9]+\\)\\s-*{"
612 (1 font-lock-type-face
)
613 (2 font-lock-constant-face
))
614 ("^\\s-*\\([-A-Za-z0-9_]+\\)\\s-*{"
615 (1 font-lock-function-name-face
))
616 ("^\\s-*\\(geometry\\|appearance\\|material\\)\\s-+\\([-A-Za-z0-9_]+\\)"
617 (2 font-lock-variable-name-face
)))
622 (setq imenu-generic-expression
623 '((nil "^\\([A-Za-z0-9_]+\\)\\s-*{" 1)
625 "DEF\\s-+\\([-A-Za-z0-9_]+\\)\\s-+\\([A-Za-z0-9]+\\)\\s-*{"
627 "Generic Mode for VRML files."
631 (define-generic-mode java-manifest-generic-mode
641 '(("^Name:\\s-+\\([^\n\r]*\\)$"
642 (1 font-lock-variable-name-face
))
643 ("^\\(Manifest\\|Required\\|Signature\\)-Version:\\s-+\\([^\n\r]*\\)$"
644 (2 font-lock-constant-face
)))
645 '("[mM][aA][nN][iI][fF][eE][sS][tT]\\.[mM][fF]\\'")
647 "Mode for Java Manifest files"
650 ;; Java properties files
651 (define-generic-mode java-properties-generic-mode
655 (let ((java-properties-key
656 "\\(\\([-A-Za-z0-9_\\./]\\|\\(\\\\[ =:]\\)\\)+\\)")
657 (java-properties-value
659 ;; Property and value can be separated in a number of different ways:
667 (concat "^" java-properties-key elt java-properties-value
"$")
668 '(1 font-lock-constant-face
)
669 '(4 font-lock-variable-name-face
))))
670 ;; These are the separators
671 '(":\\s-*" "\\s-+" "\\s-*=\\s-*"))))
676 (setq imenu-generic-expression
677 '((nil "^\\([^#! \t\n\r=:]+\\)" 1))))))
678 "Mode for Java properties files."
681 ;; C shell alias definitions
682 (when (memq 'alias-generic-mode generic-extras-enable-list
)
684 (define-generic-mode alias-generic-mode
687 '(("^alias\\s-+\\([-A-Za-z0-9_]+\\)\\s-+"
688 (1 font-lock-variable-name-face
))
689 ("^unalias\\s-+\\([-A-Za-z0-9_]+\\)\\s-*$"
690 (1 font-lock-variable-name-face
)))
695 (setq imenu-generic-expression
696 '((nil "^\\(alias\\|unalias\\)\\s-+\\([-a-zA-Z0-9_]+\\)" 2))))))
697 "Mode for C Shell alias files."
701 ;; Contributed by ACorreir@pervasive-sw.com (Alfred Correira)
702 (when (memq 'rc-generic-mode generic-extras-enable-list
)
704 (define-generic-mode rc-generic-mode
759 ;; the choice of what tokens go where is somewhat arbitrary,
760 ;; as is the choice of which value tokens are included, as
761 ;; the choice of face for each token group
764 (generic-make-keywords-list
773 (generic-make-keywords-list
778 font-lock-function-name-face
)
779 '("^#[ \t]*include[ \t]+\\(<[^>\"\n]+>\\)" 1 font-lock-string-face
)
780 '("^#[ \t]*define[ \t]+\\(\\sw+\\)(" 1 font-lock-function-name-face
)
781 '("^#[ \t]*\\(elif\\|if\\)\\>"
782 ("\\<\\(defined\\)\\>[ \t]*(?\\(\\sw+\\)?" nil nil
783 (1 font-lock-constant-face
)
784 (2 font-lock-variable-name-face nil t
)))
785 '("^#[ \t]*\\(\\sw+\\)\\>[ \t]*\\(\\sw+\\)?"
786 (1 font-lock-constant-face
)
787 (2 font-lock-variable-name-face nil t
))))
790 "Generic mode for MS-Windows Resource files."
793 ;; InstallShield RUL files
794 ;; Contributed by Alfred.Correira@Pervasive.Com
795 ;; Bugfixes by "Rolf Sandau" <Rolf.Sandau@marconi.com>
796 (when (memq 'rul-generic-mode generic-extras-enable-list
)
800 ;;; build the regexp strings using regexp-opt
801 (defconst installshield-statement-keyword-list
820 ;; "goto" -- handled elsewhere
834 "Statement keywords used in InstallShield 3 and 5.")
836 (defconst installshield-system-functions-list
856 "ComponentAddItem" ; differs between IS3 and IS5
857 "ComponentCompareSizeRequired" ; IS5 only
859 "ComponentError" ; IS5 only
860 "ComponentFileEnum" ; IS5 only
861 "ComponentFileInfo" ; IS5 only
862 "ComponentFilterLanguage" ; IS5 only
863 "ComponentFilterOS" ; IS5 only
864 "ComponentGetData" ; IS5 only
865 "ComponentGetItemInfo" ; IS3 only
866 "ComponentGetItemSize" ; differs between IS3 and IS5
867 "ComponentIsItemSelected" ; differs between IS3 and IS5
869 "ComponentMoveData" ; IS5 only
870 "ComponentSelectItem" ; differs between IS3 and IS5
871 "ComponentSetData" ; IS5 only
872 "ComponentSetItemInfo" ; IS3 only
873 "ComponentSetTarget" ; IS5 only
874 "ComponentSetupTypeEnum" ; IS5 only
875 "ComponentSetupTypeGetData" ; IS5 only
876 "ComponentSetupTypeSet" ; IS5 only
878 "ComponentValidate" ; IS5 only
879 "CompressAdd" ; IS3 only
880 "CompressDel" ; IS3 only
881 "CompressEnum" ; IS3 only
882 "CompressGet" ; IS3 only
883 "CompressInfo" ; IS3 only
887 "CreateProgramFolder"
888 "DeinstallSetReference" ; IS5 only
914 "FileSetBeginDefine" ; IS3 only
915 "FileSetEndDefine" ; IS3 only
916 "FileSetPerformEz" ; IS3 only
917 "FileSetPerform" ; IS3 only
918 "FileSetReset" ; IS3 only
919 "FileSetRoot" ; IS3 only
958 "LongPathToShortPath"
973 "PlayMMedia" ; IS5 only
982 "RegDBSetDefaultRoot"
991 "SdComponentAdvCheckSpace"
993 "SdComponentAdvUpdateSpace"
996 "SdComponentDialogAdv"
997 "SdComponentDialogEx"
998 "SdComponentDlgCheckSpace"
1001 "SdConfirmRegistration"
1013 "SdGetUserCompanyInfo"
1022 "SdOptionsButtonsInit"
1023 "SdPlugInProductName"
1026 "SdRegExEnableButton"
1031 "SdSetSequentialItems"
1033 "SdSetupTypeEx" ; IS5 only
1044 "SdUpdateComponentSelection"
1050 "SetDisplayEffect" ; IS5 only
1052 "SetForegroundWindow"
1065 "StrRemoveLastSlash"
1079 "System functions defined in InstallShield 3 and 5.")
1081 (defconst installshield-system-variables-list
1085 "CORECOMPONENTHANDLING"
1111 "System variables used in InstallShield 3 and 5.")
1113 (defconst installshield-types-list
1132 "Type keywords used in InstallShield 3 and 5.")
1134 ;;; some might want to skip highlighting these to improve performance
1135 (defconst installshield-funarg-constants-list
1165 "COMP_UPDATE_VERSION"
1184 "DLG_INFO_CHECKSELECTION"
1186 "DLG_INFO_USEDECIMAL"
1187 "DLG_MSG_INFORMATION"
1208 "FILE_ATTR_ARCHIVED"
1209 "FILE_ATTR_DIRECTORY"
1212 "FILE_ATTR_READONLY"
1218 "FILE_MODE_BINARYREADONLY"
1240 "HKEY_LOCAL_MACHINE"
1285 "REGDB_APPPATH_DEFAULT"
1288 "REGDB_ERR_CONNECTIONEXISTS"
1289 "REGDB_ERR_CORRUPTEDREGSITRY"
1290 "REGDB_ERR_INITIALIZATION"
1291 "REGDB_ERR_INVALIDHANDLE"
1292 "REGDB_ERR_INVALIDNAME"
1294 "REGDB_STRING_EXPAND"
1295 "REGDB_STRING_MULTI"
1297 "REGDB_UNINSTALL_NAME"
1341 "Function argument constants used in InstallShield 3 and 5."))
1343 (defvar rul-generic-mode-syntax-table nil
1344 "Syntax table to use in rul-generic-mode buffers.")
1346 (setq rul-generic-mode-syntax-table
1347 (make-syntax-table c
++-mode-syntax-table
))
1349 (modify-syntax-entry ?
\r "> b" rul-generic-mode-syntax-table
)
1350 (modify-syntax-entry ?
\n "> b" rul-generic-mode-syntax-table
)
1352 (modify-syntax-entry ?
/ ". 124b" rul-generic-mode-syntax-table
)
1353 (modify-syntax-entry ?
* ". 23" rul-generic-mode-syntax-table
)
1355 ;; here manually instead
1356 (defun generic-rul-mode-setup-function ()
1357 (make-local-variable 'parse-sexp-ignore-comments
)
1358 (make-local-variable 'comment-start
)
1359 (make-local-variable 'comment-start-skip
)
1360 (make-local-variable 'comment-end
)
1361 (setq imenu-generic-expression
1362 '((nil "^function\\s-+\\([A-Za-z0-9_]+\\)" 1))
1363 parse-sexp-ignore-comments t
1367 ;;; comment-start "//"
1368 ;;; comment-start-skip ""
1370 ;; (set-syntax-table rul-generic-mode-syntax-table)
1371 (setq font-lock-syntax-table rul-generic-mode-syntax-table
))
1373 ;; moved mode-definition behind defun-definition to be warning-free - 15.11.02/RSan
1374 (define-generic-mode rul-generic-mode
1375 ;; Using "/*" and "*/" doesn't seem to be working right
1376 '("//" ("/*" .
"*/" ))
1377 (eval-when-compile installshield-statement-keyword-list
)
1380 ;; preprocessor constructs
1381 '("#[ \t]*include[ \t]+\\(<[^>\"\n]+>\\)"
1382 1 font-lock-string-face
)
1383 '("#[ \t]*\\(\\sw+\\)\\>[ \t]*\\(\\sw+\\)?"
1384 (1 font-lock-reference-face
)
1385 (2 font-lock-variable-name-face nil t
))
1386 ;; indirect string constants
1387 '("\\(@[A-Za-z][A-Za-z0-9_]+\\)" 1 font-lock-builtin-face
)
1389 '("[ \t]*\\(\\sw+:\\)" 1 font-lock-reference-face
)
1390 '("\\<\\(goto\\)\\>[ \t]*\\(\\sw+\\)?"
1391 (1 font-lock-keyword-face
)
1392 (2 font-lock-reference-face nil t
))
1394 (generic-make-keywords-list
1395 installshield-system-variables-list
1396 font-lock-variable-name-face
"[^_]" "[^_]")
1398 (generic-make-keywords-list
1399 installshield-system-functions-list
1400 font-lock-function-name-face
"[^_]" "[^_]")
1402 (generic-make-keywords-list
1403 installshield-types-list
1404 font-lock-type-face
"[^_]" "[^_]")
1405 ;; function argument constants
1406 (generic-make-keywords-list
1407 installshield-funarg-constants-list
1408 font-lock-variable-name-face
"[^_]" "[^_]"))) ; is this face the best choice?
1409 '("\\.[rR][uU][lL]$")
1410 '(generic-rul-mode-setup-function)
1411 "Generic mode for InstallShield RUL files."
1414 (define-skeleton rul-if
1415 "Insert an if statement."
1417 "if(" str
") then" \n
1419 ( "other condition, %s: "
1420 > "elseif(" str
") then" \n
1427 (define-skeleton rul-function
1428 "Insert a function statement."
1430 "function " str
" ()" \n
1431 ( "local variables, %s: "
1438 ;; Additions by ACorreir@pervasive-sw.com (Alfred Correira)
1439 (define-generic-mode mailrc-generic-mode
1450 '(("^\\s-*\\(alias\\|group\\)\\s-+\\([-A-Za-z0-9_]+\\)\\s-+\\([^\n\r#]*\\)\\(#.*\\)?$"
1451 (2 font-lock-constant-face
)
1452 (3 font-lock-variable-name-face
))
1453 ("^\\s-*\\(unset\\|set\\|ignore\\)\\s-+\\([-A-Za-z0-9_]+\\)=?\\([^\n\r#]*\\)\\(#.*\\)?$"
1454 (2 font-lock-constant-face
)
1455 (3 font-lock-variable-name-face
))
1456 ("^\\s-*\\(source\\)\\s-+\\([^\n\r#]*\\)\\(#.*\\)?$"
1457 (2 font-lock-variable-name-face
)))
1460 "Mode for mailrc files."
1464 (when (memq 'inetd-conf-generic-mode generic-extras-enable-list
)
1466 (define-generic-mode inetd-conf-generic-mode
1475 '(("^\\([-A-Za-z0-9_]+\\)" 1 font-lock-type-face
))
1476 '("/etc/inetd.conf\\'")
1480 (setq imenu-generic-expression
1481 '((nil "^\\([-A-Za-z0-9_]+\\)" 1))))))
1485 (when (memq 'etc-services-generic-mode generic-extras-enable-list
)
1487 (define-generic-mode etc-services-generic-mode
1492 '(("^\\([-A-Za-z0-9_]+\\)\\s-+\\([0-9]+\\)/"
1493 (1 font-lock-type-face
)
1494 (2 font-lock-variable-name-face
)))
1495 '("/etc/services\\'")
1499 (setq imenu-generic-expression
1500 '((nil "^\\([-A-Za-z0-9_]+\\)" 1))))))
1503 ;; Password and Group files
1504 (when (memq 'etc-passwd-generic-mode generic-extras-enable-list
)
1506 (define-generic-mode etc-passwd-generic-mode
1507 nil
;; No comment characters
1508 '("root") ;; Only one keyword
1514 ;; User name -- Never blank!
1517 ;; Password, UID and GID
1520 (make-list 3 "\\([^:]+\\)")
1523 ;; GECOS/Name -- might be blank
1526 ;; Home directory and shell
1531 '(1 font-lock-type-face
)
1532 '(5 font-lock-variable-name-face
)
1533 '(6 font-lock-constant-face
)
1534 '(7 font-lock-warning-face
))
1535 '("^\\([^:]+\\):\\([^:]*\\):\\([0-9]+\\):\\(.*\\)$"
1536 (1 font-lock-type-face
)
1537 (4 font-lock-variable-name-face
))))
1538 '("/etc/passwd\\'" "/etc/group\\'")
1542 (setq imenu-generic-expression
1543 '((nil "^\\([-A-Za-z0-9_]+\\):" 1))))))
1547 (when (memq 'etc-fstab-generic-mode generic-extras-enable-list
)
1549 (define-generic-mode etc-fstab-generic-mode
1586 '(("^\\([/-A-Za-z0-9_]+\\)\\s-+\\([/-A-Za-z0-9_]+\\)"
1587 (1 font-lock-type-face
)
1588 (2 font-lock-variable-name-face
)))
1589 '("/etc/[v]*fstab\\'")
1593 (setq imenu-generic-expression
1594 '((nil "^\\([/-A-Za-z0-9_]+\\)\\s-+" 1))))))
1597 ;; From Jacques Duthen <jacques.duthen@sncf.fr>
1600 (defconst show-tabs-generic-mode-font-lock-defaults-1
1601 '(;; trailing spaces must come before...
1602 ("[ \t]+$" .
'show-tabs-space-face
)
1604 ("[^\n\t]\\(\t+\\)" (1 'show-tabs-tab-face
))))
1606 (defconst show-tabs-generic-mode-font-lock-defaults-2
1607 '(;; trailing spaces must come before...
1608 ("[ \t]+$" .
'show-tabs-space-face
)
1610 ("\t+" .
'show-tabs-tab-face
))))
1612 (defface show-tabs-tab-face
1613 '((((class grayscale
) (background light
)) (:background
"DimGray" :weight bold
))
1614 (((class grayscale
) (background dark
)) (:background
"LightGray" :weight bold
))
1615 (((class color
) (min-colors 88)) (:background
"red1"))
1616 (((class color
)) (:background
"red"))
1618 "Font Lock mode face used to highlight TABs."
1621 (defface show-tabs-space-face
1622 '((((class grayscale
) (background light
)) (:background
"DimGray" :weight bold
))
1623 (((class grayscale
) (background dark
)) (:background
"LightGray" :weight bold
))
1624 (((class color
) (min-colors 88)) (:background
"yellow1"))
1625 (((class color
)) (:background
"yellow"))
1627 "Font Lock mode face used to highlight spaces."
1630 (define-generic-mode show-tabs-generic-mode
1631 nil
;; no comment char
1633 (eval-when-compile show-tabs-generic-mode-font-lock-defaults-1
)
1634 nil
;; no auto-mode-alist
1635 ;; '(show-tabs-generic-mode-hook-fun)
1637 "Generic mode to show tabs and trailing spaces"
1640 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1642 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1644 (define-generic-mode named-boot-generic-mode
1645 ;; List of comment characters
1648 '("cache" "primary" "secondary" "forwarders" "limit" "options"
1649 "directory" "check-names")
1650 ;; List of additional font-lock-expressions
1651 '(("\\([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+\\)" 1 font-lock-constant-face
)
1652 ("^directory\\s-+\\(.*\\)" 1 font-lock-variable-name-face
)
1653 ("^\\(primary\\|cache\\)\\s-+\\([.A-Za-z]+\\)\\s-+\\(.*\\)"
1654 (2 font-lock-variable-name-face
)
1655 (3 font-lock-constant-face
)))
1656 ;; List of additional automode-alist expressions
1657 '("/etc/named.boot\\'")
1658 ;; List of set up functions to call
1662 (define-generic-mode named-database-generic-mode
1663 ;; List of comment characters
1666 '("IN" "NS" "CNAME" "SOA" "PTR" "MX" "A")
1667 ;; List of additional font-lock-expressions
1668 '(("\\([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+\\)" 1 font-lock-constant-face
)
1669 ("^\\([.A-Za-z0-9]+\\)" 1 font-lock-variable-name-face
))
1670 ;; List of additional automode-alist expressions
1672 ;; List of set up functions to call
1676 (defvar named-database-time-string
"%Y%m%d%H"
1677 "Timestring for named serial numbers.")
1679 (defun named-database-print-serial ()
1680 "Print a serial number based on the current date."
1682 (insert (format-time-string named-database-time-string
(current-time))))
1684 (define-generic-mode resolve-conf-generic-mode
1685 ;; List of comment characters
1688 '("nameserver" "domain" "search" "sortlist" "options")
1689 ;; List of additional font-lock-expressions
1691 ;; List of additional automode-alist expressions
1692 '("/etc/resolv[e]?.conf\\'")
1693 ;; List of set up functions to call
1697 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1698 ;; Modes for spice and common electrical engineering circuit netlist formats
1699 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1701 (define-generic-mode spice-generic-mode
1718 '(("^\\s-*\\([*].*\\)" 1 font-lock-comment-face
)
1719 (" \\(\\$ .*\\)$" 1 font-lock-comment-face
)
1720 ("^\\(\\$ .*\\)$" 1 font-lock-comment-face
)
1721 ("\\([*].*\\)" 1 font-lock-comment-face
)
1722 ("^\\([+]\\)" 1 font-lock-string-face
)
1723 ("^\\s-*\\([.]\\w+\\>\\)" 1 font-lock-keyword-face
)
1724 ("\\(\\([.]\\|_\\|\\w\\)+\\)\\s-*=" 1 font-lock-variable-name-face
)
1725 ("\\('[^']+'\\)" 1 font-lock-string-face
)
1726 ("\\(\"[^\"]+\"\\)" 1 font-lock-string-face
))
1728 "\\.[sS][pP][iI]\\'"
1729 "\\.[sS][pP][iI][cC][eE]\\'"
1730 "\\.[iI][nN][cC]\\'")
1732 'generic-bracket-support
1733 ;; Make keywords case-insensitive
1736 (setq font-lock-defaults
'(generic-font-lock-keywords nil t
)))))
1737 "Generic mode for SPICE circuit netlist files."
1740 (define-generic-mode ibis-generic-mode
1743 '(("[[]\\([^]]*\\)[]]" 1 font-lock-keyword-face
)
1744 ("\\(\\(_\\|\\w\\)+\\)\\s-*=" 1 font-lock-variable-name-face
))
1745 '("\\.[iI][bB][sS]\\'")
1746 '(generic-bracket-support)
1747 "Generic mode for IBIS circuit netlist files."
1750 (define-generic-mode astap-generic-mode
1765 '(("^\\s-*\\([*].*\\)" 1 font-lock-comment-face
)
1766 (";\\s-*\\([*].*\\)" 1 font-lock-comment-face
)
1767 ("^\\s-*\\([.]\\w+\\>\\)" 1 font-lock-keyword-face
)
1768 ("\\('[^']+'\\)" 1 font-lock-string-face
)
1769 ("\\(\"[^\"]+\"\\)" 1 font-lock-string-face
)
1770 ("[(,]\\s-*\\(\\([.]\\|_\\|\\w\\)+\\)\\s-*=" 1 font-lock-variable-name-face
))
1772 "\\.[aA][sS][xX]\\'"
1773 "\\.[aA][sS][tT][aA][pP]\\'"
1774 "\\.[pP][sS][pP]\\'"
1775 "\\.[dD][eE][cC][kK]\\'"
1776 "\\.[gG][oO][dD][aA][tT][aA]")
1778 'generic-bracket-support
1779 ;; Make keywords case-insensitive
1782 (setq font-lock-defaults
'(generic-font-lock-keywords nil t
)))))
1783 "Generic mode for ASTAP circuit netlist files."
1786 (define-generic-mode etc-modules-conf-generic-mode
1787 ;; List of comment characters
1805 "generic_stringfile"
1821 ;; List of additional font-lock-expressions
1823 ;; List of additional automode-alist expressions
1824 '("/etc/modules.conf" "/etc/conf.modules")
1825 ;; List of set up functions to call
1829 (provide 'generic-x
)
1831 ;;; arch-tag: cde692a5-9ff6-4506-9999-c67999c2bdb5
1832 ;;; generic-x.el ends here