1 ;;; generic-x.el --- A collection of generic modes
3 ;; Copyright (C) 1997-1998, 2001-2018 Free Software Foundation, Inc.
5 ;; Author: Peter Breton <pbreton@cs.umb.edu>
6 ;; Created: Tue Oct 08 1996
7 ;; Keywords: generic, comment, font-lock
10 ;; This file is part of GNU Emacs.
12 ;; GNU Emacs is free software: you can redistribute it and/or modify
13 ;; it under the terms of the GNU General Public License as published by
14 ;; the Free Software Foundation, either version 3 of the License, or
15 ;; (at your option) any later version.
17 ;; GNU Emacs is distributed in the hope that it will be useful,
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 ;; GNU General Public License for more details.
22 ;; You should have received a copy of the GNU General Public License
23 ;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
27 ;; This file contains a collection of generic modes.
31 ;; Add this line to your init file:
33 ;; (require 'generic-x)
35 ;; You can decide which modes to load by setting the variable
36 ;; `generic-extras-enable-list'. Its default value is platform-
37 ;; specific. The recommended way to set this variable is through
40 ;; M-x customize-option RET generic-extras-enable-list RET
42 ;; This lets you select generic modes from the list of available
43 ;; modes. If you manually set `generic-extras-enable-list' in your
44 ;; .emacs, do it BEFORE loading generic-x with (require 'generic-x).
46 ;; You can also send in new modes; if the file types are reasonably
47 ;; common, we would like to install them.
49 ;; DEFAULT GENERIC MODE:
51 ;; This file provides a hook which automatically puts a file into
52 ;; `default-generic-mode' if the first few lines of a file in
53 ;; fundamental mode start with a hash comment character. To disable
54 ;; this functionality, set the variable `generic-use-find-file-hook'
55 ;; to nil BEFORE loading generic-x. See the variables
56 ;; `generic-lines-to-scan' and `generic-find-file-regexp' for
57 ;; customization options.
59 ;; PROBLEMS WHEN USED WITH FOLDING MODE:
61 ;; [The following relates to the obsolete selective-display technique.
62 ;; Folding mode should use invisible text properties instead. -- Dave
65 ;; From Anders Lindgren
67 ;; Problem summary: Wayne Adams has found a problem when using folding
68 ;; mode in conjunction with font-lock for a mode defined in
71 ;; The problem, as Wayne described it, was that error messages of the
72 ;; following form appeared when both font-lock and folding are used:
74 ;; > - various msgs including "Fontifying region...(error Stack
75 ;; > overflow in regexp matcher)" appear
77 ;; I have just tracked down the cause of the problem. The regexp's in
78 ;; `generic-x.el' do not take into account the way that folding hides
79 ;; sections of the buffer. The technique is known as
80 ;; `selective-display' and has been available for a very long time (I
81 ;; started using it back in the good old Emacs 18 days). Basically, a
82 ;; section is hidden by creating one very long line were the newline
83 ;; character (C-j) is replaced by a linefeed (C-m) character.
85 ;; Many other hiding packages, besides folding, use the same technique,
86 ;; the problem should occur when using them as well.
88 ;; The erroneous lines in `generic-x.el' look like the following (this
89 ;; example is from the `ini' section):
91 ;; '(("^\\(\\[.*\\]\\)" 1 'font-lock-constant-face)
92 ;; ("^\\(.*\\)=" 1 'font-lock-variable-name-face)
94 ;; The intention of these lines is to highlight lines of the following
100 ;; However, since the `.' regexp symbol matches the linefeed character
101 ;; the entire folded section is searched, resulting in a regexp stack
104 ;; Solution suggestion: Instead of using ".", use the sequence
105 ;; "[^\n\r]". This will make the rules behave just as before, but
106 ;; they will work together with selective-display.
110 (eval-when-compile (require 'font-lock
))
112 (defgroup generic-x nil
113 "A collection of generic modes."
118 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
119 ;; Default-Generic mode
120 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
122 (defcustom generic-use-find-file-hook t
123 "If non-nil, add a hook to enter `default-generic-mode' automatically.
124 This is done if the first few lines of a file in fundamental mode
125 start with a hash comment character."
129 (defcustom generic-lines-to-scan
3
130 "Number of lines that `generic-mode-find-file-hook' looks at.
131 Relevant when deciding whether to enter Default-Generic mode automatically.
132 This variable should be set to a small positive number."
136 (defcustom generic-find-file-regexp
"^#"
137 "Regular expression used by `generic-mode-find-file-hook'.
138 Files in fundamental mode whose first few lines contain a match
139 for this regexp, should be put into Default-Generic mode instead.
140 The number of lines tested for the matches is specified by the
141 value of the variable `generic-lines-to-scan', which see."
145 (defcustom generic-ignore-files-regexp
"[Tt][Aa][Gg][Ss]\\'"
146 "Regular expression used by `generic-mode-find-file-hook'.
147 Files whose names match this regular expression should not be put
148 into Default-Generic mode, even if they have lines which match
149 the regexp in `generic-find-file-regexp'. If the value is nil,
150 `generic-mode-find-file-hook' does not check the file names."
152 :type
'(choice (const :tag
"Don't check file names" nil
) regexp
))
154 ;; This generic mode is always defined
155 (define-generic-mode default-generic-mode
(list ?
#) nil nil nil nil
)
157 ;; A more general solution would allow us to enter generic-mode for
158 ;; *any* comment character, but would require us to synthesize a new
159 ;; generic-mode on the fly. I think this gives us most of what we
161 (defun generic-mode-find-file-hook ()
162 "Hook function to enter Default-Generic mode automatically.
164 Done if the first few lines of a file in Fundamental mode start
165 with a match for the regexp in `generic-find-file-regexp', unless
166 the file's name matches the regexp which is the value of the
167 variable `generic-ignore-files-regexp'.
169 This hook will be installed if the variable
170 `generic-use-find-file-hook' is non-nil. The variable
171 `generic-lines-to-scan' determines the number of lines to look at."
172 (when (and (eq major-mode
'fundamental-mode
)
173 (or (null generic-ignore-files-regexp
)
175 generic-ignore-files-regexp
176 (file-name-sans-versions buffer-file-name
)))))
178 (goto-char (point-min))
179 (when (re-search-forward generic-find-file-regexp
181 (forward-line generic-lines-to-scan
)
183 (goto-char (point-min))
184 (default-generic-mode)))))
186 (and generic-use-find-file-hook
187 (add-hook 'find-file-hook
'generic-mode-find-file-hook
))
189 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
190 ;; Other Generic modes
191 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
193 ;; If you add a generic mode to this file, put it in one of these four
196 (defconst generic-default-modes
197 '(apache-conf-generic-mode
198 apache-log-generic-mode
200 java-manifest-generic-mode
201 java-properties-generic-mode
202 javascript-generic-mode
203 show-tabs-generic-mode
205 "List of generic modes that are defined by default.")
207 (defconst generic-mswindows-modes
214 "List of generic modes that are defined by default on MS-Windows.")
216 (defconst generic-unix-modes
218 ansible-inventory-generic-mode
219 etc-fstab-generic-mode
220 etc-modules-conf-generic-mode
221 etc-passwd-generic-mode
222 etc-services-generic-mode
223 etc-sudoers-generic-mode
225 inetd-conf-generic-mode
226 mailagent-rules-generic-mode
228 named-boot-generic-mode
229 named-database-generic-mode
230 prototype-generic-mode
231 resolve-conf-generic-mode
233 x-resource-generic-mode
234 xmodmap-generic-mode
)
235 "List of generic modes that are defined by default on Unix.")
237 (defconst generic-other-modes
242 "List of generic modes that are not defined by default.")
244 (defcustom generic-extras-enable-list
245 (append generic-default-modes
246 (if (memq system-type
'(windows-nt ms-dos
))
247 generic-mswindows-modes
250 "List of generic modes to define.
251 Each entry in the list should be a symbol. If you set this variable
252 directly, without using customize, you must reload generic-x to put
253 your changes into effect."
257 (sort (append generic-default-modes
258 generic-mswindows-modes
263 (string< (symbol-name b
)
266 (push `(const ,mode
) list
)))
269 (unless load-in-progress
274 (when (memq 'apache-conf-generic-mode generic-extras-enable-list
)
276 (define-generic-mode apache-conf-generic-mode
279 '(("^\\s-*\\(<.*>\\)" 1 font-lock-constant-face
)
280 ("^\\s-*\\(\\sw+\\)\\s-" 1 font-lock-variable-name-face
))
281 '("srm\\.conf\\'" "httpd\\.conf\\'" "access\\.conf\\'")
285 (setq imenu-generic-expression
286 '((nil "^\\([-A-Za-z0-9_]+\\)" 1)
287 ("*Directories*" "^\\s-*<Directory\\s-*\\([^>]+\\)>" 1)
288 ("*Locations*" "^\\s-*<Location\\s-*\\([^>]+\\)>" 1))))))
289 "Generic mode for Apache or HTTPD configuration files."))
291 (when (memq 'apache-log-generic-mode generic-extras-enable-list
)
293 (define-generic-mode apache-log-generic-mode
296 ;; Hostname ? user date request return-code number-of-bytes
297 '(("^\\([-a-zA-z0-9.]+\\) - [-A-Za-z]+ \\(\\[.*\\]\\)"
298 (1 font-lock-constant-face
)
299 (2 font-lock-variable-name-face
)))
302 "Generic mode for Apache log files."))
305 (when (memq 'samba-generic-mode generic-extras-enable-list
)
307 (define-generic-mode samba-generic-mode
310 '(("^\\(\\[.*\\]\\)" 1 font-lock-constant-face
)
311 ("^\\s-*\\(.+\\)=\\([^\r\n]*\\)"
312 (1 font-lock-variable-name-face
)
313 (2 font-lock-type-face
)))
315 '(generic-bracket-support)
316 "Generic mode for Samba configuration files."))
319 ;; This is pretty basic. Also, modes for other window managers could
320 ;; be defined as well.
321 (when (memq 'fvwm-generic-mode generic-extras-enable-list
)
323 (define-generic-mode fvwm-generic-mode
339 '("\\.fvwmrc\\'" "\\.fvwm2rc\\'")
341 "Generic mode for FVWM configuration files."))
344 ;; I'm pretty sure I've seen an actual mode to do this, but I don't
345 ;; think it's standard with Emacs
346 (when (memq 'x-resource-generic-mode generic-extras-enable-list
)
348 (define-generic-mode x-resource-generic-mode
351 '(("^\\([^:\n]+:\\)" 1 font-lock-variable-name-face
))
352 '("\\.Xdefaults\\'" "\\.Xresources\\'" "\\.Xenvironment\\'" "\\.ad\\'")
354 "Generic mode for X Resource configuration files."))
356 (if (memq 'xmodmap-generic-mode generic-extras-enable-list
)
357 (define-generic-mode xmodmap-generic-mode
359 '("add" "clear" "keycode" "keysym" "remove" "pointer")
361 '("[xX]modmap\\(rc\\)?\\'")
363 "Simple mode for xmodmap files."))
366 (when (memq 'hosts-generic-mode generic-extras-enable-list
)
368 (define-generic-mode hosts-generic-mode
371 '(("\\([0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+\\)" 1 font-lock-constant-face
))
372 '("[hH][oO][sS][tT][sS]\\'")
374 "Generic mode for HOSTS files."))
376 ;;; Windows INF files
378 ;; If i-g-m-f-f-h is defined, then so is i-g-m.
379 (declare-function ini-generic-mode
"generic-x")
381 (when (memq 'inf-generic-mode generic-extras-enable-list
)
383 (define-generic-mode inf-generic-mode
386 '(("^\\(\\[.*\\]\\)" 1 font-lock-constant-face
))
387 '("\\.[iI][nN][fF]\\'")
388 '(generic-bracket-support)
389 "Generic mode for MS-Windows INF files."))
391 ;;; Windows INI files
392 ;; Should define escape character as well!
393 (when (memq 'ini-generic-mode generic-extras-enable-list
)
395 (define-generic-mode ini-generic-mode
398 '(("^\\(\\[.*\\]\\)" 1 font-lock-constant-face
)
399 ("^\\([^=\n\r]*\\)=\\([^\n\r]*\\)$"
400 (1 font-lock-function-name-face
)
401 (2 font-lock-variable-name-face
)))
402 '("\\.[iI][nN][iI]\\'")
406 (setq imenu-generic-expression
407 '((nil "^\\[\\(.*\\)\\]" 1)
408 ("*Variables*" "^\\s-*\\([^=]+\\)\\s-*=" 1))))))
409 "Generic mode for MS-Windows INI files.
410 You can use `ini-generic-mode-find-file-hook' to enter this mode
411 automatically for INI files whose names do not end in \".ini\".")
413 (defun ini-generic-mode-find-file-hook ()
414 "Hook function to enter Ini-Generic mode automatically for INI files.
415 Done if the first few lines of a file in Fundamental mode look
416 like an INI file. You can add this hook to `find-file-hook'."
417 (and (eq major-mode
'fundamental-mode
)
419 (goto-char (point-min))
420 (and (looking-at "^\\s-*\\[.*\\]")
421 (ini-generic-mode)))))
422 (defalias 'generic-mode-ini-file-find-file-hook
'ini-generic-mode-find-file-hook
))
424 ;;; Windows REG files
425 ;;; Unfortunately, Windows 95 and Windows NT have different REG file syntax!
426 (when (memq 'reg-generic-mode generic-extras-enable-list
)
428 (define-generic-mode reg-generic-mode
430 '("key" "classes_root" "REGEDIT" "REGEDIT4")
431 '(("\\(\\[.*\\]\\)" 1 font-lock-constant-face
)
432 ("^\\([^\n\r]*\\)\\s-*=" 1 font-lock-variable-name-face
))
433 '("\\.[rR][eE][gG]\\'")
437 (setq imenu-generic-expression
438 '((nil "^\\s-*\\(.*\\)\\s-*=" 1))))))
439 "Generic mode for MS-Windows Registry files."))
441 (declare-function w32-shell-name
"w32-fns" ())
443 ;;; DOS/Windows BAT files
444 (when (memq 'bat-generic-mode generic-extras-enable-list
)
445 (define-obsolete-function-alias 'bat-generic-mode
'bat-mode
"24.4"))
448 ;; Mailagent is a Unix mail filtering program. Anyone wanna do a
449 ;; generic mode for procmail?
450 (when (memq 'mailagent-rules-generic-mode generic-extras-enable-list
)
452 (define-generic-mode mailagent-rules-generic-mode
454 '("SAVE" "DELETE" "PIPE" "ANNOTATE" "REJECT")
455 '(("^\\(\\sw+\\)\\s-*=" 1 font-lock-variable-name-face
)
456 ("\\s-/\\([^/]+\\)/[i, \t\n]" 1 font-lock-constant-face
))
461 (setq imenu-generic-expression
462 '((nil "\\s-/\\([^/]+\\)/[i, \t\n]" 1))))))
463 "Generic mode for Mailagent rules files."))
465 ;; Solaris/Sys V prototype files
466 (when (memq 'prototype-generic-mode generic-extras-enable-list
)
468 (define-generic-mode prototype-generic-mode
471 '(("^\\([0-9]\\)?\\s-*\\([a-z]\\)\\s-+\\([A-Za-z_]+\\)\\s-+\\([^\n\r]*\\)$"
472 (2 font-lock-constant-face
)
473 (3 font-lock-keyword-face
))
474 ("^\\([a-z]\\) \\([A-Za-z_]+\\)=\\([^\n\r]*\\)$"
475 (1 font-lock-constant-face
)
476 (2 font-lock-keyword-face
)
477 (3 font-lock-variable-name-face
))
478 ("^\\(!\\s-*\\(search\\|include\\|default\\)\\)\\s-*\\([^\n\r]*\\)$"
479 (1 font-lock-keyword-face
)
480 (3 font-lock-variable-name-face
))
481 ("^\\(!\\s-*\\sw+\\)=\\([^\n\r]*\\)$"
482 (1 font-lock-keyword-face
)
483 (2 font-lock-variable-name-face
)))
486 "Generic mode for Sys V prototype files."))
488 ;; Solaris/Sys V pkginfo files
489 (when (memq 'pkginfo-generic-mode generic-extras-enable-list
)
491 (define-generic-mode pkginfo-generic-mode
494 '(("^\\([A-Za-z_]+\\)=\\([^\n\r]*\\)$"
495 (1 font-lock-keyword-face
)
496 (2 font-lock-variable-name-face
)))
499 "Generic mode for Sys V pkginfo files."))
502 ;; Obsolete; defer to js-mode from js.el.
503 (when (memq 'javascript-generic-mode generic-extras-enable-list
)
504 (define-obsolete-function-alias 'javascript-generic-mode
'js-mode
"24.3")
505 (define-obsolete-variable-alias 'javascript-generic-mode-hook
'js-mode-hook
"24.3"))
508 (when (memq 'vrml-generic-mode generic-extras-enable-list
)
510 (define-generic-mode vrml-generic-mode
540 '(("USE\\s-+\\([-A-Za-z0-9_]+\\)"
541 (1 font-lock-constant-face
))
542 ("DEF\\s-+\\([-A-Za-z0-9_]+\\)\\s-+\\([A-Za-z0-9]+\\)\\s-*{"
543 (1 font-lock-type-face
)
544 (2 font-lock-constant-face
))
545 ("^\\s-*\\([-A-Za-z0-9_]+\\)\\s-*{"
546 (1 font-lock-function-name-face
))
547 ("^\\s-*\\(geometry\\|appearance\\|material\\)\\s-+\\([-A-Za-z0-9_]+\\)"
548 (2 font-lock-variable-name-face
)))
553 (setq imenu-generic-expression
554 '((nil "^\\([A-Za-z0-9_]+\\)\\s-*{" 1)
556 "DEF\\s-+\\([-A-Za-z0-9_]+\\)\\s-+\\([A-Za-z0-9]+\\)\\s-*{"
558 "Generic Mode for VRML files."))
561 (when (memq 'java-manifest-generic-mode generic-extras-enable-list
)
563 (define-generic-mode java-manifest-generic-mode
573 '(("^Name:\\s-+\\([^\n\r]*\\)$"
574 (1 font-lock-variable-name-face
))
575 ("^\\(Manifest\\|Required\\|Signature\\)-Version:\\s-+\\([^\n\r]*\\)$"
576 (2 font-lock-constant-face
)))
577 '("[mM][aA][nN][iI][fF][eE][sS][tT]\\.[mM][fF]\\'")
579 "Generic mode for Java Manifest files."))
581 ;; Java properties files
582 (when (memq 'java-properties-generic-mode generic-extras-enable-list
)
584 (define-generic-mode java-properties-generic-mode
588 (let ((java-properties-key
589 "\\(\\([-A-Za-z0-9_\\./]\\|\\(\\\\[ =:]\\)\\)+\\)")
590 (java-properties-value
592 ;; Property and value can be separated in a number of different ways:
600 (concat "^" java-properties-key elt java-properties-value
"$")
601 '(1 font-lock-constant-face
)
602 '(4 font-lock-variable-name-face
))))
603 ;; These are the separators
604 '(":\\s-*" "\\s-+" "\\s-*=\\s-*"))))
609 (setq imenu-generic-expression
610 '((nil "^\\([^#! \t\n\r=:]+\\)" 1))))))
611 "Generic mode for Java properties files."))
613 ;; C shell alias definitions
614 (when (memq 'alias-generic-mode generic-extras-enable-list
)
616 (define-generic-mode alias-generic-mode
619 '(("^alias\\s-+\\([-A-Za-z0-9_]+\\)\\s-+"
620 (1 font-lock-variable-name-face
))
621 ("^unalias\\s-+\\([-A-Za-z0-9_]+\\)\\s-*$"
622 (1 font-lock-variable-name-face
)))
627 (setq imenu-generic-expression
628 '((nil "^\\(alias\\|unalias\\)\\s-+\\([-a-zA-Z0-9_]+\\)" 2))))))
629 "Generic mode for C Shell alias files."))
631 ;; Ansible inventory files
632 (when (memq 'ansible-inventory-generic-mode generic-extras-enable-list
)
634 (define-generic-mode ansible-inventory-generic-mode
637 '(("^\\s-*\\(\\[.*\\]\\)" 1 font-lock-constant-face
)
638 ("^\\s-*\\([^ \n\r]*\\)" 1 font-lock-function-name-face
)
639 ;; Variable assignments must be x=y, so highlight as warning if
640 ;; the value is missing.
641 ("\\s-\\([^ =\n\r]+\\)[\n\r ]" 1 font-lock-warning-face
)
642 ;; Variable assignments: x=y
643 ("\\([^ =\n\r]+\\)=\\([^ \n\r]*\\)"
644 (1 font-lock-variable-name-face
)
645 (2 font-lock-keyword-face
)))
650 (setq imenu-generic-expression
651 '((nil "^\\s-*\\[\\(.*\\)\\]" 1)
652 ("*Variables*" "\\s-+\\([^ =\n\r]+\\)=" 1))))))
653 "Generic mode for Ansible inventory files."))
656 ;; Contributed by ACorreir@pervasive-sw.com (Alfred Correira)
657 (when (memq 'rc-generic-mode generic-extras-enable-list
)
659 (define-generic-mode rc-generic-mode
714 ;; the choice of what tokens go where is somewhat arbitrary,
715 ;; as is the choice of which value tokens are included, as
716 ;; the choice of face for each token group
719 (list (regexp-opt '("FILEFLAGSMASK"
725 "PRODUCTVERSION") 'symbols
)
726 1 font-lock-type-face
)
727 (list (regexp-opt '("BEGIN" "BLOCK" "END" "VALUE") 'symbols
)
728 1 font-lock-function-name-face
)
729 '("^#[ \t]*include[ \t]+\\(<[^>\"\n]+>\\)" 1 font-lock-string-face
)
730 '("^#[ \t]*define[ \t]+\\(\\sw+\\)(" 1 font-lock-function-name-face
)
731 '("^#[ \t]*\\(elif\\|if\\)\\>"
732 ("\\<\\(defined\\)\\>[ \t]*(?\\(\\sw+\\)?" nil nil
733 (1 font-lock-constant-face
)
734 (2 font-lock-variable-name-face nil t
)))
735 '("^#[ \t]*\\(\\sw+\\)\\>[ \t]*\\(\\sw+\\)?"
736 (1 font-lock-constant-face
)
737 (2 font-lock-variable-name-face nil t
))))
740 "Generic mode for MS-Windows Resource files."))
742 ;; InstallShield RUL files
743 ;; Contributed by Alfred.Correira@Pervasive.Com
744 ;; Bugfixes by "Rolf Sandau" <Rolf.Sandau@marconi.com>
745 (when (memq 'rul-generic-mode generic-extras-enable-list
)
749 ;;; build the regexp strings using regexp-opt
750 (defconst installshield-statement-keyword-list
769 ;; "goto" -- handled elsewhere
783 "Statement keywords used in InstallShield 3 and 5.")
785 (defconst installshield-system-functions-list
805 "ComponentAddItem" ; differs between IS3 and IS5
806 "ComponentCompareSizeRequired" ; IS5 only
808 "ComponentError" ; IS5 only
809 "ComponentFileEnum" ; IS5 only
810 "ComponentFileInfo" ; IS5 only
811 "ComponentFilterLanguage" ; IS5 only
812 "ComponentFilterOS" ; IS5 only
813 "ComponentGetData" ; IS5 only
814 "ComponentGetItemInfo" ; IS3 only
815 "ComponentGetItemSize" ; differs between IS3 and IS5
816 "ComponentIsItemSelected" ; differs between IS3 and IS5
818 "ComponentMoveData" ; IS5 only
819 "ComponentSelectItem" ; differs between IS3 and IS5
820 "ComponentSetData" ; IS5 only
821 "ComponentSetItemInfo" ; IS3 only
822 "ComponentSetTarget" ; IS5 only
823 "ComponentSetupTypeEnum" ; IS5 only
824 "ComponentSetupTypeGetData" ; IS5 only
825 "ComponentSetupTypeSet" ; IS5 only
827 "ComponentValidate" ; IS5 only
828 "CompressAdd" ; IS3 only
829 "CompressDel" ; IS3 only
830 "CompressEnum" ; IS3 only
831 "CompressGet" ; IS3 only
832 "CompressInfo" ; IS3 only
836 "CreateProgramFolder"
837 "DeinstallSetReference" ; IS5 only
863 "FileSetBeginDefine" ; IS3 only
864 "FileSetEndDefine" ; IS3 only
865 "FileSetPerformEz" ; IS3 only
866 "FileSetPerform" ; IS3 only
867 "FileSetReset" ; IS3 only
868 "FileSetRoot" ; IS3 only
907 "LongPathToShortPath"
922 "PlayMMedia" ; IS5 only
931 "RegDBSetDefaultRoot"
940 "SdComponentAdvCheckSpace"
942 "SdComponentAdvUpdateSpace"
945 "SdComponentDialogAdv"
946 "SdComponentDialogEx"
947 "SdComponentDlgCheckSpace"
950 "SdConfirmRegistration"
962 "SdGetUserCompanyInfo"
971 "SdOptionsButtonsInit"
972 "SdPlugInProductName"
975 "SdRegExEnableButton"
980 "SdSetSequentialItems"
982 "SdSetupTypeEx" ; IS5 only
993 "SdUpdateComponentSelection"
999 "SetDisplayEffect" ; IS5 only
1001 "SetForegroundWindow"
1014 "StrRemoveLastSlash"
1028 "System functions defined in InstallShield 3 and 5.")
1030 (defconst installshield-system-variables-list
1034 "CORECOMPONENTHANDLING"
1060 "System variables used in InstallShield 3 and 5.")
1062 (defconst installshield-types-list
1081 "Type keywords used in InstallShield 3 and 5.")
1083 ;;; some might want to skip highlighting these to improve performance
1084 (defconst installshield-funarg-constants-list
1114 "COMP_UPDATE_VERSION"
1133 "DLG_INFO_CHECKSELECTION"
1135 "DLG_INFO_USEDECIMAL"
1136 "DLG_MSG_INFORMATION"
1157 "FILE_ATTR_ARCHIVED"
1158 "FILE_ATTR_DIRECTORY"
1161 "FILE_ATTR_READONLY"
1167 "FILE_MODE_BINARYREADONLY"
1189 "HKEY_LOCAL_MACHINE"
1234 "REGDB_APPPATH_DEFAULT"
1237 "REGDB_ERR_CONNECTIONEXISTS"
1238 "REGDB_ERR_CORRUPTEDREGISTRY"
1239 "REGDB_ERR_INITIALIZATION"
1240 "REGDB_ERR_INVALIDHANDLE"
1241 "REGDB_ERR_INVALIDNAME"
1243 "REGDB_STRING_EXPAND"
1244 "REGDB_STRING_MULTI"
1246 "REGDB_UNINSTALL_NAME"
1290 "Function argument constants used in InstallShield 3 and 5."))
1292 ;; c++-mode-syntax-table used to be autoloaded, with an initial nil value.
1293 ;; This file did not load cc-mode, and therefore rul-generic-mode-syntax-table
1294 ;; would have different values according to whether or not cc-mode
1295 ;; happened to be loaded before this file was.
1297 (defvar c
++-mode-syntax-table
)
1299 (defvar rul-generic-mode-syntax-table
1300 (let ((table (make-syntax-table c
++-mode-syntax-table
)))
1301 (modify-syntax-entry ?
\r "> b" table
)
1302 (modify-syntax-entry ?
\n "> b" table
)
1303 (modify-syntax-entry ?
/ ". 124b" table
)
1304 (modify-syntax-entry ?
* ". 23" table
)
1306 "Syntax table to use in `rul-generic-mode' buffers.")
1308 ;; here manually instead
1309 (defun generic-rul-mode-setup-function ()
1310 (make-local-variable 'parse-sexp-ignore-comments
)
1311 (make-local-variable 'comment-start
)
1312 (make-local-variable 'comment-start-skip
)
1313 (make-local-variable 'comment-end
)
1314 (setq imenu-generic-expression
1315 '((nil "^function\\s-+\\([A-Za-z0-9_]+\\)" 1))
1316 parse-sexp-ignore-comments t
1320 ;;; comment-start "//"
1321 ;;; comment-start-skip ""
1323 ;; (set-syntax-table rul-generic-mode-syntax-table)
1324 (setq-local font-lock-syntax-table rul-generic-mode-syntax-table
))
1326 ;; moved mode-definition behind defun-definition to be warning-free - 15.11.02/RSan
1327 (define-generic-mode rul-generic-mode
1328 ;; Using "/*" and "*/" doesn't seem to be working right
1329 '("//" ("/*" .
"*/" ))
1330 (eval-when-compile installshield-statement-keyword-list
)
1333 ;; preprocessor constructs
1334 '("#[ \t]*include[ \t]+\\(<[^>\"\n]+>\\)"
1335 1 font-lock-string-face
)
1336 '("#[ \t]*\\(\\sw+\\)\\>[ \t]*\\(\\sw+\\)?"
1337 (1 font-lock-constant-face
)
1338 (2 font-lock-variable-name-face nil t
))
1339 ;; indirect string constants
1340 '("\\(@[A-Za-z][A-Za-z0-9_]+\\)" 1 font-lock-builtin-face
)
1342 '("[ \t]*\\(\\sw+:\\)" 1 font-lock-constant-face
)
1343 '("\\<\\(goto\\)\\>[ \t]*\\(\\sw+\\)?"
1344 (1 font-lock-keyword-face
)
1345 (2 font-lock-constant-face nil t
))
1347 (list (concat "[^_]"
1348 (regexp-opt installshield-system-variables-list
'symbols
)
1350 1 font-lock-variable-name-face
)
1352 (list (concat "[^_]"
1353 (regexp-opt installshield-system-functions-list
'symbols
)
1355 1 font-lock-function-name-face
)
1357 (list (concat "[^_]"
1358 (regexp-opt installshield-types-list
'symbols
)
1360 1 font-lock-type-face
)
1361 ;; function argument constants
1362 (list (concat "[^_]"
1363 (regexp-opt installshield-funarg-constants-list
'symbols
)
1365 1 font-lock-variable-name-face
))) ; is this face the best choice?
1366 '("\\.[rR][uU][lL]\\'")
1367 '(generic-rul-mode-setup-function)
1368 "Generic mode for InstallShield RUL files.")
1370 (define-skeleton rul-if
1371 "Insert an if statement."
1373 "if(" str
") then" \n
1375 ( "other condition, %s: "
1376 > "elseif(" str
") then" \n
1383 (define-skeleton rul-function
1384 "Insert a function statement."
1386 "function " str
" ()" \n
1387 ( "local variables, %s: "
1394 ;; Additions by ACorreir@pervasive-sw.com (Alfred Correira)
1395 (when (memq 'mailrc-generic-mode generic-extras-enable-list
)
1397 (define-generic-mode mailrc-generic-mode
1408 '(("^\\s-*\\(alias\\|group\\)\\s-+\\([-A-Za-z0-9_]+\\)\\s-+\\([^\n\r#]*\\)\\(#.*\\)?$"
1409 (2 font-lock-constant-face
)
1410 (3 font-lock-variable-name-face
))
1411 ("^\\s-*\\(unset\\|set\\|ignore\\)\\s-+\\([-A-Za-z0-9_]+\\)=?\\([^\n\r#]*\\)\\(#.*\\)?$"
1412 (2 font-lock-constant-face
)
1413 (3 font-lock-variable-name-face
))
1414 ("^\\s-*\\(source\\)\\s-+\\([^\n\r#]*\\)\\(#.*\\)?$"
1415 (2 font-lock-variable-name-face
)))
1418 "Mode for mailrc files."))
1421 (when (memq 'inetd-conf-generic-mode generic-extras-enable-list
)
1423 (define-generic-mode inetd-conf-generic-mode
1432 '(("^\\([-A-Za-z0-9_]+\\)" 1 font-lock-type-face
))
1433 '("/etc/inetd.conf\\'")
1437 (setq imenu-generic-expression
1438 '((nil "^\\([-A-Za-z0-9_]+\\)" 1))))))))
1441 (when (memq 'etc-services-generic-mode generic-extras-enable-list
)
1443 (define-generic-mode etc-services-generic-mode
1448 '(("^\\([-A-Za-z0-9_]+\\)\\s-+\\([0-9]+\\)/"
1449 (1 font-lock-type-face
)
1450 (2 font-lock-variable-name-face
)))
1451 '("/etc/services\\'")
1455 (setq imenu-generic-expression
1456 '((nil "^\\([-A-Za-z0-9_]+\\)" 1))))))))
1458 ;; Password and Group files
1459 (when (memq 'etc-passwd-generic-mode generic-extras-enable-list
)
1461 (define-generic-mode etc-passwd-generic-mode
1462 nil
;; No comment characters
1463 '("root") ;; Only one keyword
1469 ;; User name -- Never blank!
1472 ;; Password, UID and GID
1475 (make-list 3 "\\([^:]+\\)")
1478 ;; GECOS/Name -- might be blank
1481 ;; Home directory and shell
1486 '(1 font-lock-type-face
)
1487 '(5 font-lock-variable-name-face
)
1488 '(6 font-lock-constant-face
)
1489 '(7 font-lock-warning-face
))
1490 '("^\\([^:]+\\):\\([^:]*\\):\\([0-9]+\\):\\(.*\\)$"
1491 (1 font-lock-type-face
)
1492 (4 font-lock-variable-name-face
))))
1493 '("/etc/passwd\\'" "/etc/group\\'")
1497 (setq imenu-generic-expression
1498 '((nil "^\\([-A-Za-z0-9_]+\\):" 1))))))))
1501 (when (memq 'etc-fstab-generic-mode generic-extras-enable-list
)
1503 (define-generic-mode etc-fstab-generic-mode
1544 '(("^\\([^# \t]+\\)\\s-+\\([^# \t]+\\)"
1545 (1 font-lock-type-face t
)
1546 (2 font-lock-variable-name-face t
)))
1547 '("/etc/[v]*fstab\\'")
1551 (setq imenu-generic-expression
1552 '((nil "^\\([^# \t]+\\)\\s-+" 1))))))))
1555 (when (memq 'etc-sudoers-generic-mode generic-extras-enable-list
)
1557 (define-generic-mode etc-sudoers-generic-mode
1559 '("User_Alias" "Runas_Alias" "Host_Alias" "Cmnd_Alias"
1560 "NOPASSWD" "PASSWD" "NOEXEC" "EXEC"
1562 '(("\\<\\(root\\|su\\)\\>" 1 font-lock-warning-face
)
1563 ("\\(\\*\\)" 1 font-lock-warning-face
)
1564 ("\\<\\(%[A-Za-z0-9_]+\\)\\>" 1 font-lock-variable-name-face
))
1565 '("/etc/sudoers\\'")
1567 "Generic mode for sudoers configuration files."))
1569 ;; From Jacques Duthen <jacques.duthen@sncf.fr>
1570 (when (memq 'show-tabs-generic-mode generic-extras-enable-list
)
1574 (defconst show-tabs-generic-mode-font-lock-defaults-1
1575 '(;; trailing spaces must come before...
1576 ("[ \t]+$" .
'show-tabs-space
)
1578 ("[^\n\t]\\(\t+\\)" (1 'show-tabs-tab
))))
1580 (defconst show-tabs-generic-mode-font-lock-defaults-2
1581 '(;; trailing spaces must come before...
1582 ("[ \t]+$" .
'show-tabs-space
)
1584 ("\t+" .
'show-tabs-tab
))))
1586 (defface show-tabs-tab
1587 '((((class grayscale
) (background light
)) (:background
"DimGray" :weight bold
))
1588 (((class grayscale
) (background dark
)) (:background
"LightGray" :weight bold
))
1589 (((class color
) (min-colors 88)) (:background
"red1"))
1590 (((class color
)) (:background
"red"))
1592 "Font Lock mode face used to highlight TABs."
1595 (defface show-tabs-space
1596 '((((class grayscale
) (background light
)) (:background
"DimGray" :weight bold
))
1597 (((class grayscale
) (background dark
)) (:background
"LightGray" :weight bold
))
1598 (((class color
) (min-colors 88)) (:background
"yellow1"))
1599 (((class color
)) (:background
"yellow"))
1601 "Font Lock mode face used to highlight spaces."
1604 (define-generic-mode show-tabs-generic-mode
1605 nil
;; no comment char
1607 (eval-when-compile show-tabs-generic-mode-font-lock-defaults-1
)
1608 nil
;; no auto-mode-alist
1609 ;; '(show-tabs-generic-mode-hook-fun)
1611 "Generic mode to show tabs and trailing spaces."))
1613 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1615 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1617 (when (memq 'named-boot-generic-mode generic-extras-enable-list
)
1619 (define-generic-mode named-boot-generic-mode
1620 ;; List of comment characters
1623 '("cache" "primary" "secondary" "forwarders" "limit" "options"
1624 "directory" "check-names")
1625 ;; List of additional font-lock-expressions
1626 '(("\\([0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+\\)" 1 font-lock-constant-face
)
1627 ("^directory\\s-+\\(.*\\)" 1 font-lock-variable-name-face
)
1628 ("^\\(primary\\|cache\\)\\s-+\\([.A-Za-z]+\\)\\s-+\\(.*\\)"
1629 (2 font-lock-variable-name-face
)
1630 (3 font-lock-constant-face
)))
1631 ;; List of additional automode-alist expressions
1632 '("/etc/named.boot\\'")
1633 ;; List of set up functions to call
1636 (when (memq 'named-database-generic-mode generic-extras-enable-list
)
1638 (define-generic-mode named-database-generic-mode
1639 ;; List of comment characters
1642 '("IN" "NS" "CNAME" "SOA" "PTR" "MX" "A")
1643 ;; List of additional font-lock-expressions
1644 '(("\\([0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+\\)" 1 font-lock-constant-face
)
1645 ("^\\([.A-Za-z0-9]+\\)" 1 font-lock-variable-name-face
))
1646 ;; List of additional auto-mode-alist expressions
1648 ;; List of set up functions to call
1651 (defvar named-database-time-string
"%Y%m%d%H"
1652 "Timestring for named serial numbers.")
1654 (defun named-database-print-serial ()
1655 "Print a serial number based on the current date."
1657 (insert (format-time-string named-database-time-string
))))
1659 (when (memq 'resolve-conf-generic-mode generic-extras-enable-list
)
1661 (define-generic-mode resolve-conf-generic-mode
1662 ;; List of comment characters
1665 '("nameserver" "domain" "search" "sortlist" "options")
1666 ;; List of additional font-lock-expressions
1668 ;; List of additional auto-mode-alist expressions
1669 '("/etc/resolv[e]?.conf\\'")
1670 ;; List of set up functions to call
1673 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1674 ;; Modes for spice and common electrical engineering circuit netlist formats
1675 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1677 (when (memq 'spice-generic-mode generic-extras-enable-list
)
1679 (define-generic-mode spice-generic-mode
1696 '(("^\\s-*\\([*].*\\)" 1 font-lock-comment-face
)
1697 (" \\(\\$ .*\\)$" 1 font-lock-comment-face
)
1698 ("^\\(\\$ .*\\)$" 1 font-lock-comment-face
)
1699 ("\\([*].*\\)" 1 font-lock-comment-face
)
1700 ("^\\([+]\\)" 1 font-lock-string-face
)
1701 ("^\\s-*\\([.]\\w+\\>\\)" 1 font-lock-keyword-face
)
1702 ("\\(\\([.]\\|_\\|\\w\\)+\\)\\s-*=" 1 font-lock-variable-name-face
)
1703 ("\\('[^']+'\\)" 1 font-lock-string-face
)
1704 ("\\(\"[^\"]+\"\\)" 1 font-lock-string-face
))
1706 "\\.[sS][pP][iI]\\'"
1707 "\\.[sS][pP][iI][cC][eE]\\'"
1708 "\\.[iI][nN][cC]\\'")
1710 'generic-bracket-support
1711 ;; Make keywords case-insensitive
1714 (setq font-lock-defaults
'(generic-font-lock-keywords nil t
)))))
1715 "Generic mode for SPICE circuit netlist files."))
1717 (when (memq 'ibis-generic-mode generic-extras-enable-list
)
1719 (define-generic-mode ibis-generic-mode
1722 '(("[[]\\([^]]*\\)[]]" 1 font-lock-keyword-face
)
1723 ("\\(\\(_\\|\\w\\)+\\)\\s-*=" 1 font-lock-variable-name-face
))
1724 '("\\.[iI][bB][sS]\\'")
1725 '(generic-bracket-support)
1726 "Generic mode for IBIS circuit netlist files."))
1728 (when (memq 'astap-generic-mode generic-extras-enable-list
)
1730 (define-generic-mode astap-generic-mode
1745 '(("^\\s-*\\([*].*\\)" 1 font-lock-comment-face
)
1746 (";\\s-*\\([*].*\\)" 1 font-lock-comment-face
)
1747 ("^\\s-*\\([.]\\w+\\>\\)" 1 font-lock-keyword-face
)
1748 ("\\('[^']+'\\)" 1 font-lock-string-face
)
1749 ("\\(\"[^\"]+\"\\)" 1 font-lock-string-face
)
1750 ("[(,]\\s-*\\(\\([.]\\|_\\|\\w\\)+\\)\\s-*=" 1 font-lock-variable-name-face
))
1752 "\\.[aA][sS][xX]\\'"
1753 "\\.[aA][sS][tT][aA][pP]\\'"
1754 "\\.[pP][sS][pP]\\'"
1755 "\\.[dD][eE][cC][kK]\\'"
1756 "\\.[gG][oO][dD][aA][tT][aA]")
1758 'generic-bracket-support
1759 ;; Make keywords case-insensitive
1762 (setq font-lock-defaults
'(generic-font-lock-keywords nil t
)))))
1763 "Generic mode for ASTAP circuit netlist files."))
1765 (when (memq 'etc-modules-conf-generic-mode generic-extras-enable-list
)
1767 (define-generic-mode etc-modules-conf-generic-mode
1768 ;; List of comment characters
1786 "generic_stringfile"
1802 ;; List of additional font-lock-expressions
1804 ;; List of additional automode-alist expressions
1805 '("/etc/modules.conf" "/etc/conf.modules")
1806 ;; List of set up functions to call
1809 (provide 'generic-x
)
1811 ;;; generic-x.el ends here