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-define-mswindows-modes
245 (memq system-type
'(windows-nt ms-dos
))
246 "Non-nil means the modes in `generic-mswindows-modes' will be defined.
247 This is a list of MS-Windows specific generic modes. This variable
248 only affects the default value of `generic-extras-enable-list'."
252 (make-obsolete-variable 'generic-define-mswindows-modes
'generic-extras-enable-list
"22.1")
254 (defcustom generic-define-unix-modes
255 (not (memq system-type
'(windows-nt ms-dos
)))
256 "Non-nil means the modes in `generic-unix-modes' will be defined.
257 This is a list of Unix specific generic modes. This variable only
258 affects the default value of `generic-extras-enable-list'."
262 (make-obsolete-variable 'generic-define-unix-modes
'generic-extras-enable-list
"22.1")
264 (defcustom generic-extras-enable-list
265 (append generic-default-modes
266 (if generic-define-mswindows-modes generic-mswindows-modes
)
267 (if generic-define-unix-modes generic-unix-modes
)
269 "List of generic modes to define.
270 Each entry in the list should be a symbol. If you set this variable
271 directly, without using customize, you must reload generic-x to put
272 your changes into effect."
276 (sort (append generic-default-modes
277 generic-mswindows-modes
282 (string< (symbol-name b
)
285 (push `(const ,mode
) list
)))
288 (unless load-in-progress
293 (when (memq 'apache-conf-generic-mode generic-extras-enable-list
)
295 (define-generic-mode apache-conf-generic-mode
298 '(("^\\s-*\\(<.*>\\)" 1 font-lock-constant-face
)
299 ("^\\s-*\\(\\sw+\\)\\s-" 1 font-lock-variable-name-face
))
300 '("srm\\.conf\\'" "httpd\\.conf\\'" "access\\.conf\\'")
304 (setq imenu-generic-expression
305 '((nil "^\\([-A-Za-z0-9_]+\\)" 1)
306 ("*Directories*" "^\\s-*<Directory\\s-*\\([^>]+\\)>" 1)
307 ("*Locations*" "^\\s-*<Location\\s-*\\([^>]+\\)>" 1))))))
308 "Generic mode for Apache or HTTPD configuration files."))
310 (when (memq 'apache-log-generic-mode generic-extras-enable-list
)
312 (define-generic-mode apache-log-generic-mode
315 ;; Hostname ? user date request return-code number-of-bytes
316 '(("^\\([-a-zA-z0-9.]+\\) - [-A-Za-z]+ \\(\\[.*\\]\\)"
317 (1 font-lock-constant-face
)
318 (2 font-lock-variable-name-face
)))
321 "Generic mode for Apache log files."))
324 (when (memq 'samba-generic-mode generic-extras-enable-list
)
326 (define-generic-mode samba-generic-mode
329 '(("^\\(\\[.*\\]\\)" 1 font-lock-constant-face
)
330 ("^\\s-*\\(.+\\)=\\([^\r\n]*\\)"
331 (1 font-lock-variable-name-face
)
332 (2 font-lock-type-face
)))
334 '(generic-bracket-support)
335 "Generic mode for Samba configuration files."))
338 ;; This is pretty basic. Also, modes for other window managers could
339 ;; be defined as well.
340 (when (memq 'fvwm-generic-mode generic-extras-enable-list
)
342 (define-generic-mode fvwm-generic-mode
358 '("\\.fvwmrc\\'" "\\.fvwm2rc\\'")
360 "Generic mode for FVWM configuration files."))
363 ;; I'm pretty sure I've seen an actual mode to do this, but I don't
364 ;; think it's standard with Emacs
365 (when (memq 'x-resource-generic-mode generic-extras-enable-list
)
367 (define-generic-mode x-resource-generic-mode
370 '(("^\\([^:\n]+:\\)" 1 font-lock-variable-name-face
))
371 '("\\.Xdefaults\\'" "\\.Xresources\\'" "\\.Xenvironment\\'" "\\.ad\\'")
373 "Generic mode for X Resource configuration files."))
375 (if (memq 'xmodmap-generic-mode generic-extras-enable-list
)
376 (define-generic-mode xmodmap-generic-mode
378 '("add" "clear" "keycode" "keysym" "remove" "pointer")
380 '("[xX]modmap\\(rc\\)?\\'")
382 "Simple mode for xmodmap files."))
385 (when (memq 'hosts-generic-mode generic-extras-enable-list
)
387 (define-generic-mode hosts-generic-mode
390 '(("\\([0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+\\)" 1 font-lock-constant-face
))
391 '("[hH][oO][sS][tT][sS]\\'")
393 "Generic mode for HOSTS files."))
395 ;;; Windows INF files
397 ;; If i-g-m-f-f-h is defined, then so is i-g-m.
398 (declare-function ini-generic-mode
"generic-x")
400 (when (memq 'inf-generic-mode generic-extras-enable-list
)
402 (define-generic-mode inf-generic-mode
405 '(("^\\(\\[.*\\]\\)" 1 font-lock-constant-face
))
406 '("\\.[iI][nN][fF]\\'")
407 '(generic-bracket-support)
408 "Generic mode for MS-Windows INF files."))
410 ;;; Windows INI files
411 ;; Should define escape character as well!
412 (when (memq 'ini-generic-mode generic-extras-enable-list
)
414 (define-generic-mode ini-generic-mode
417 '(("^\\(\\[.*\\]\\)" 1 font-lock-constant-face
)
418 ("^\\([^=\n\r]*\\)=\\([^\n\r]*\\)$"
419 (1 font-lock-function-name-face
)
420 (2 font-lock-variable-name-face
)))
421 '("\\.[iI][nN][iI]\\'")
425 (setq imenu-generic-expression
426 '((nil "^\\[\\(.*\\)\\]" 1)
427 ("*Variables*" "^\\s-*\\([^=]+\\)\\s-*=" 1))))))
428 "Generic mode for MS-Windows INI files.
429 You can use `ini-generic-mode-find-file-hook' to enter this mode
430 automatically for INI files whose names do not end in \".ini\".")
432 (defun ini-generic-mode-find-file-hook ()
433 "Hook function to enter Ini-Generic mode automatically for INI files.
434 Done if the first few lines of a file in Fundamental mode look
435 like an INI file. You can add this hook to `find-file-hook'."
436 (and (eq major-mode
'fundamental-mode
)
438 (goto-char (point-min))
439 (and (looking-at "^\\s-*\\[.*\\]")
440 (ini-generic-mode)))))
441 (defalias 'generic-mode-ini-file-find-file-hook
'ini-generic-mode-find-file-hook
))
443 ;;; Windows REG files
444 ;;; Unfortunately, Windows 95 and Windows NT have different REG file syntax!
445 (when (memq 'reg-generic-mode generic-extras-enable-list
)
447 (define-generic-mode reg-generic-mode
449 '("key" "classes_root" "REGEDIT" "REGEDIT4")
450 '(("\\(\\[.*\\]\\)" 1 font-lock-constant-face
)
451 ("^\\([^\n\r]*\\)\\s-*=" 1 font-lock-variable-name-face
))
452 '("\\.[rR][eE][gG]\\'")
456 (setq imenu-generic-expression
457 '((nil "^\\s-*\\(.*\\)\\s-*=" 1))))))
458 "Generic mode for MS-Windows Registry files."))
460 (declare-function w32-shell-name
"w32-fns" ())
462 ;;; DOS/Windows BAT files
463 (when (memq 'bat-generic-mode generic-extras-enable-list
)
464 (define-obsolete-function-alias 'bat-generic-mode
'bat-mode
"24.4"))
467 ;; Mailagent is a Unix mail filtering program. Anyone wanna do a
468 ;; generic mode for procmail?
469 (when (memq 'mailagent-rules-generic-mode generic-extras-enable-list
)
471 (define-generic-mode mailagent-rules-generic-mode
473 '("SAVE" "DELETE" "PIPE" "ANNOTATE" "REJECT")
474 '(("^\\(\\sw+\\)\\s-*=" 1 font-lock-variable-name-face
)
475 ("\\s-/\\([^/]+\\)/[i, \t\n]" 1 font-lock-constant-face
))
480 (setq imenu-generic-expression
481 '((nil "\\s-/\\([^/]+\\)/[i, \t\n]" 1))))))
482 "Generic mode for Mailagent rules files."))
484 ;; Solaris/Sys V prototype files
485 (when (memq 'prototype-generic-mode generic-extras-enable-list
)
487 (define-generic-mode prototype-generic-mode
490 '(("^\\([0-9]\\)?\\s-*\\([a-z]\\)\\s-+\\([A-Za-z_]+\\)\\s-+\\([^\n\r]*\\)$"
491 (2 font-lock-constant-face
)
492 (3 font-lock-keyword-face
))
493 ("^\\([a-z]\\) \\([A-Za-z_]+\\)=\\([^\n\r]*\\)$"
494 (1 font-lock-constant-face
)
495 (2 font-lock-keyword-face
)
496 (3 font-lock-variable-name-face
))
497 ("^\\(!\\s-*\\(search\\|include\\|default\\)\\)\\s-*\\([^\n\r]*\\)$"
498 (1 font-lock-keyword-face
)
499 (3 font-lock-variable-name-face
))
500 ("^\\(!\\s-*\\sw+\\)=\\([^\n\r]*\\)$"
501 (1 font-lock-keyword-face
)
502 (2 font-lock-variable-name-face
)))
505 "Generic mode for Sys V prototype files."))
507 ;; Solaris/Sys V pkginfo files
508 (when (memq 'pkginfo-generic-mode generic-extras-enable-list
)
510 (define-generic-mode pkginfo-generic-mode
513 '(("^\\([A-Za-z_]+\\)=\\([^\n\r]*\\)$"
514 (1 font-lock-keyword-face
)
515 (2 font-lock-variable-name-face
)))
518 "Generic mode for Sys V pkginfo files."))
521 ;; Obsolete; defer to js-mode from js.el.
522 (when (memq 'javascript-generic-mode generic-extras-enable-list
)
523 (define-obsolete-function-alias 'javascript-generic-mode
'js-mode
"24.3")
524 (define-obsolete-variable-alias 'javascript-generic-mode-hook
'js-mode-hook
"24.3"))
527 (when (memq 'vrml-generic-mode generic-extras-enable-list
)
529 (define-generic-mode vrml-generic-mode
559 '(("USE\\s-+\\([-A-Za-z0-9_]+\\)"
560 (1 font-lock-constant-face
))
561 ("DEF\\s-+\\([-A-Za-z0-9_]+\\)\\s-+\\([A-Za-z0-9]+\\)\\s-*{"
562 (1 font-lock-type-face
)
563 (2 font-lock-constant-face
))
564 ("^\\s-*\\([-A-Za-z0-9_]+\\)\\s-*{"
565 (1 font-lock-function-name-face
))
566 ("^\\s-*\\(geometry\\|appearance\\|material\\)\\s-+\\([-A-Za-z0-9_]+\\)"
567 (2 font-lock-variable-name-face
)))
572 (setq imenu-generic-expression
573 '((nil "^\\([A-Za-z0-9_]+\\)\\s-*{" 1)
575 "DEF\\s-+\\([-A-Za-z0-9_]+\\)\\s-+\\([A-Za-z0-9]+\\)\\s-*{"
577 "Generic Mode for VRML files."))
580 (when (memq 'java-manifest-generic-mode generic-extras-enable-list
)
582 (define-generic-mode java-manifest-generic-mode
592 '(("^Name:\\s-+\\([^\n\r]*\\)$"
593 (1 font-lock-variable-name-face
))
594 ("^\\(Manifest\\|Required\\|Signature\\)-Version:\\s-+\\([^\n\r]*\\)$"
595 (2 font-lock-constant-face
)))
596 '("[mM][aA][nN][iI][fF][eE][sS][tT]\\.[mM][fF]\\'")
598 "Generic mode for Java Manifest files."))
600 ;; Java properties files
601 (when (memq 'java-properties-generic-mode generic-extras-enable-list
)
603 (define-generic-mode java-properties-generic-mode
607 (let ((java-properties-key
608 "\\(\\([-A-Za-z0-9_\\./]\\|\\(\\\\[ =:]\\)\\)+\\)")
609 (java-properties-value
611 ;; Property and value can be separated in a number of different ways:
619 (concat "^" java-properties-key elt java-properties-value
"$")
620 '(1 font-lock-constant-face
)
621 '(4 font-lock-variable-name-face
))))
622 ;; These are the separators
623 '(":\\s-*" "\\s-+" "\\s-*=\\s-*"))))
628 (setq imenu-generic-expression
629 '((nil "^\\([^#! \t\n\r=:]+\\)" 1))))))
630 "Generic mode for Java properties files."))
632 ;; C shell alias definitions
633 (when (memq 'alias-generic-mode generic-extras-enable-list
)
635 (define-generic-mode alias-generic-mode
638 '(("^alias\\s-+\\([-A-Za-z0-9_]+\\)\\s-+"
639 (1 font-lock-variable-name-face
))
640 ("^unalias\\s-+\\([-A-Za-z0-9_]+\\)\\s-*$"
641 (1 font-lock-variable-name-face
)))
646 (setq imenu-generic-expression
647 '((nil "^\\(alias\\|unalias\\)\\s-+\\([-a-zA-Z0-9_]+\\)" 2))))))
648 "Generic mode for C Shell alias files."))
650 ;; Ansible inventory files
651 (when (memq 'ansible-inventory-generic-mode generic-extras-enable-list
)
653 (define-generic-mode ansible-inventory-generic-mode
656 '(("^\\s-*\\(\\[.*\\]\\)" 1 font-lock-constant-face
)
657 ("^\\s-*\\([^ \n\r]*\\)" 1 font-lock-function-name-face
)
658 ;; Variable assignments must be x=y, so highlight as warning if
659 ;; the value is missing.
660 ("\\s-\\([^ =\n\r]+\\)[\n\r ]" 1 font-lock-warning-face
)
661 ;; Variable assignments: x=y
662 ("\\([^ =\n\r]+\\)=\\([^ \n\r]*\\)"
663 (1 font-lock-variable-name-face
)
664 (2 font-lock-keyword-face
)))
669 (setq imenu-generic-expression
670 '((nil "^\\s-*\\[\\(.*\\)\\]" 1)
671 ("*Variables*" "\\s-+\\([^ =\n\r]+\\)=" 1))))))
672 "Generic mode for Ansible inventory files."))
675 ;; Contributed by ACorreir@pervasive-sw.com (Alfred Correira)
676 (when (memq 'rc-generic-mode generic-extras-enable-list
)
678 (define-generic-mode rc-generic-mode
733 ;; the choice of what tokens go where is somewhat arbitrary,
734 ;; as is the choice of which value tokens are included, as
735 ;; the choice of face for each token group
738 (list (regexp-opt '("FILEFLAGSMASK"
744 "PRODUCTVERSION") 'symbols
)
745 1 font-lock-type-face
)
746 (list (regexp-opt '("BEGIN" "BLOCK" "END" "VALUE") 'symbols
)
747 1 font-lock-function-name-face
)
748 '("^#[ \t]*include[ \t]+\\(<[^>\"\n]+>\\)" 1 font-lock-string-face
)
749 '("^#[ \t]*define[ \t]+\\(\\sw+\\)(" 1 font-lock-function-name-face
)
750 '("^#[ \t]*\\(elif\\|if\\)\\>"
751 ("\\<\\(defined\\)\\>[ \t]*(?\\(\\sw+\\)?" nil nil
752 (1 font-lock-constant-face
)
753 (2 font-lock-variable-name-face nil t
)))
754 '("^#[ \t]*\\(\\sw+\\)\\>[ \t]*\\(\\sw+\\)?"
755 (1 font-lock-constant-face
)
756 (2 font-lock-variable-name-face nil t
))))
759 "Generic mode for MS-Windows Resource files."))
761 ;; InstallShield RUL files
762 ;; Contributed by Alfred.Correira@Pervasive.Com
763 ;; Bugfixes by "Rolf Sandau" <Rolf.Sandau@marconi.com>
764 (when (memq 'rul-generic-mode generic-extras-enable-list
)
768 ;;; build the regexp strings using regexp-opt
769 (defconst installshield-statement-keyword-list
788 ;; "goto" -- handled elsewhere
802 "Statement keywords used in InstallShield 3 and 5.")
804 (defconst installshield-system-functions-list
824 "ComponentAddItem" ; differs between IS3 and IS5
825 "ComponentCompareSizeRequired" ; IS5 only
827 "ComponentError" ; IS5 only
828 "ComponentFileEnum" ; IS5 only
829 "ComponentFileInfo" ; IS5 only
830 "ComponentFilterLanguage" ; IS5 only
831 "ComponentFilterOS" ; IS5 only
832 "ComponentGetData" ; IS5 only
833 "ComponentGetItemInfo" ; IS3 only
834 "ComponentGetItemSize" ; differs between IS3 and IS5
835 "ComponentIsItemSelected" ; differs between IS3 and IS5
837 "ComponentMoveData" ; IS5 only
838 "ComponentSelectItem" ; differs between IS3 and IS5
839 "ComponentSetData" ; IS5 only
840 "ComponentSetItemInfo" ; IS3 only
841 "ComponentSetTarget" ; IS5 only
842 "ComponentSetupTypeEnum" ; IS5 only
843 "ComponentSetupTypeGetData" ; IS5 only
844 "ComponentSetupTypeSet" ; IS5 only
846 "ComponentValidate" ; IS5 only
847 "CompressAdd" ; IS3 only
848 "CompressDel" ; IS3 only
849 "CompressEnum" ; IS3 only
850 "CompressGet" ; IS3 only
851 "CompressInfo" ; IS3 only
855 "CreateProgramFolder"
856 "DeinstallSetReference" ; IS5 only
882 "FileSetBeginDefine" ; IS3 only
883 "FileSetEndDefine" ; IS3 only
884 "FileSetPerformEz" ; IS3 only
885 "FileSetPerform" ; IS3 only
886 "FileSetReset" ; IS3 only
887 "FileSetRoot" ; IS3 only
926 "LongPathToShortPath"
941 "PlayMMedia" ; IS5 only
950 "RegDBSetDefaultRoot"
959 "SdComponentAdvCheckSpace"
961 "SdComponentAdvUpdateSpace"
964 "SdComponentDialogAdv"
965 "SdComponentDialogEx"
966 "SdComponentDlgCheckSpace"
969 "SdConfirmRegistration"
981 "SdGetUserCompanyInfo"
990 "SdOptionsButtonsInit"
991 "SdPlugInProductName"
994 "SdRegExEnableButton"
999 "SdSetSequentialItems"
1001 "SdSetupTypeEx" ; IS5 only
1012 "SdUpdateComponentSelection"
1018 "SetDisplayEffect" ; IS5 only
1020 "SetForegroundWindow"
1033 "StrRemoveLastSlash"
1047 "System functions defined in InstallShield 3 and 5.")
1049 (defconst installshield-system-variables-list
1053 "CORECOMPONENTHANDLING"
1079 "System variables used in InstallShield 3 and 5.")
1081 (defconst installshield-types-list
1100 "Type keywords used in InstallShield 3 and 5.")
1102 ;;; some might want to skip highlighting these to improve performance
1103 (defconst installshield-funarg-constants-list
1133 "COMP_UPDATE_VERSION"
1152 "DLG_INFO_CHECKSELECTION"
1154 "DLG_INFO_USEDECIMAL"
1155 "DLG_MSG_INFORMATION"
1176 "FILE_ATTR_ARCHIVED"
1177 "FILE_ATTR_DIRECTORY"
1180 "FILE_ATTR_READONLY"
1186 "FILE_MODE_BINARYREADONLY"
1208 "HKEY_LOCAL_MACHINE"
1253 "REGDB_APPPATH_DEFAULT"
1256 "REGDB_ERR_CONNECTIONEXISTS"
1257 "REGDB_ERR_CORRUPTEDREGISTRY"
1258 "REGDB_ERR_INITIALIZATION"
1259 "REGDB_ERR_INVALIDHANDLE"
1260 "REGDB_ERR_INVALIDNAME"
1262 "REGDB_STRING_EXPAND"
1263 "REGDB_STRING_MULTI"
1265 "REGDB_UNINSTALL_NAME"
1309 "Function argument constants used in InstallShield 3 and 5."))
1311 ;; c++-mode-syntax-table used to be autoloaded, with an initial nil value.
1312 ;; This file did not load cc-mode, and therefore rul-generic-mode-syntax-table
1313 ;; would have different values according to whether or not cc-mode
1314 ;; happened to be loaded before this file was.
1316 (defvar c
++-mode-syntax-table
)
1318 (defvar rul-generic-mode-syntax-table
1319 (let ((table (make-syntax-table c
++-mode-syntax-table
)))
1320 (modify-syntax-entry ?
\r "> b" table
)
1321 (modify-syntax-entry ?
\n "> b" table
)
1322 (modify-syntax-entry ?
/ ". 124b" table
)
1323 (modify-syntax-entry ?
* ". 23" table
)
1325 "Syntax table to use in `rul-generic-mode' buffers.")
1327 ;; here manually instead
1328 (defun generic-rul-mode-setup-function ()
1329 (make-local-variable 'parse-sexp-ignore-comments
)
1330 (make-local-variable 'comment-start
)
1331 (make-local-variable 'comment-start-skip
)
1332 (make-local-variable 'comment-end
)
1333 (setq imenu-generic-expression
1334 '((nil "^function\\s-+\\([A-Za-z0-9_]+\\)" 1))
1335 parse-sexp-ignore-comments t
1339 ;;; comment-start "//"
1340 ;;; comment-start-skip ""
1342 ;; (set-syntax-table rul-generic-mode-syntax-table)
1343 (setq-local font-lock-syntax-table rul-generic-mode-syntax-table
))
1345 ;; moved mode-definition behind defun-definition to be warning-free - 15.11.02/RSan
1346 (define-generic-mode rul-generic-mode
1347 ;; Using "/*" and "*/" doesn't seem to be working right
1348 '("//" ("/*" .
"*/" ))
1349 (eval-when-compile installshield-statement-keyword-list
)
1352 ;; preprocessor constructs
1353 '("#[ \t]*include[ \t]+\\(<[^>\"\n]+>\\)"
1354 1 font-lock-string-face
)
1355 '("#[ \t]*\\(\\sw+\\)\\>[ \t]*\\(\\sw+\\)?"
1356 (1 font-lock-constant-face
)
1357 (2 font-lock-variable-name-face nil t
))
1358 ;; indirect string constants
1359 '("\\(@[A-Za-z][A-Za-z0-9_]+\\)" 1 font-lock-builtin-face
)
1361 '("[ \t]*\\(\\sw+:\\)" 1 font-lock-constant-face
)
1362 '("\\<\\(goto\\)\\>[ \t]*\\(\\sw+\\)?"
1363 (1 font-lock-keyword-face
)
1364 (2 font-lock-constant-face nil t
))
1366 (list (concat "[^_]"
1367 (regexp-opt installshield-system-variables-list
'symbols
)
1369 1 font-lock-variable-name-face
)
1371 (list (concat "[^_]"
1372 (regexp-opt installshield-system-functions-list
'symbols
)
1374 1 font-lock-function-name-face
)
1376 (list (concat "[^_]"
1377 (regexp-opt installshield-types-list
'symbols
)
1379 1 font-lock-type-face
)
1380 ;; function argument constants
1381 (list (concat "[^_]"
1382 (regexp-opt installshield-funarg-constants-list
'symbols
)
1384 1 font-lock-variable-name-face
))) ; is this face the best choice?
1385 '("\\.[rR][uU][lL]\\'")
1386 '(generic-rul-mode-setup-function)
1387 "Generic mode for InstallShield RUL files.")
1389 (define-skeleton rul-if
1390 "Insert an if statement."
1392 "if(" str
") then" \n
1394 ( "other condition, %s: "
1395 > "elseif(" str
") then" \n
1402 (define-skeleton rul-function
1403 "Insert a function statement."
1405 "function " str
" ()" \n
1406 ( "local variables, %s: "
1413 ;; Additions by ACorreir@pervasive-sw.com (Alfred Correira)
1414 (when (memq 'mailrc-generic-mode generic-extras-enable-list
)
1416 (define-generic-mode mailrc-generic-mode
1427 '(("^\\s-*\\(alias\\|group\\)\\s-+\\([-A-Za-z0-9_]+\\)\\s-+\\([^\n\r#]*\\)\\(#.*\\)?$"
1428 (2 font-lock-constant-face
)
1429 (3 font-lock-variable-name-face
))
1430 ("^\\s-*\\(unset\\|set\\|ignore\\)\\s-+\\([-A-Za-z0-9_]+\\)=?\\([^\n\r#]*\\)\\(#.*\\)?$"
1431 (2 font-lock-constant-face
)
1432 (3 font-lock-variable-name-face
))
1433 ("^\\s-*\\(source\\)\\s-+\\([^\n\r#]*\\)\\(#.*\\)?$"
1434 (2 font-lock-variable-name-face
)))
1437 "Mode for mailrc files."))
1440 (when (memq 'inetd-conf-generic-mode generic-extras-enable-list
)
1442 (define-generic-mode inetd-conf-generic-mode
1451 '(("^\\([-A-Za-z0-9_]+\\)" 1 font-lock-type-face
))
1452 '("/etc/inetd.conf\\'")
1456 (setq imenu-generic-expression
1457 '((nil "^\\([-A-Za-z0-9_]+\\)" 1))))))))
1460 (when (memq 'etc-services-generic-mode generic-extras-enable-list
)
1462 (define-generic-mode etc-services-generic-mode
1467 '(("^\\([-A-Za-z0-9_]+\\)\\s-+\\([0-9]+\\)/"
1468 (1 font-lock-type-face
)
1469 (2 font-lock-variable-name-face
)))
1470 '("/etc/services\\'")
1474 (setq imenu-generic-expression
1475 '((nil "^\\([-A-Za-z0-9_]+\\)" 1))))))))
1477 ;; Password and Group files
1478 (when (memq 'etc-passwd-generic-mode generic-extras-enable-list
)
1480 (define-generic-mode etc-passwd-generic-mode
1481 nil
;; No comment characters
1482 '("root") ;; Only one keyword
1488 ;; User name -- Never blank!
1491 ;; Password, UID and GID
1494 (make-list 3 "\\([^:]+\\)")
1497 ;; GECOS/Name -- might be blank
1500 ;; Home directory and shell
1505 '(1 font-lock-type-face
)
1506 '(5 font-lock-variable-name-face
)
1507 '(6 font-lock-constant-face
)
1508 '(7 font-lock-warning-face
))
1509 '("^\\([^:]+\\):\\([^:]*\\):\\([0-9]+\\):\\(.*\\)$"
1510 (1 font-lock-type-face
)
1511 (4 font-lock-variable-name-face
))))
1512 '("/etc/passwd\\'" "/etc/group\\'")
1516 (setq imenu-generic-expression
1517 '((nil "^\\([-A-Za-z0-9_]+\\):" 1))))))))
1520 (when (memq 'etc-fstab-generic-mode generic-extras-enable-list
)
1522 (define-generic-mode etc-fstab-generic-mode
1563 '(("^\\([^# \t]+\\)\\s-+\\([^# \t]+\\)"
1564 (1 font-lock-type-face t
)
1565 (2 font-lock-variable-name-face t
)))
1566 '("/etc/[v]*fstab\\'")
1570 (setq imenu-generic-expression
1571 '((nil "^\\([^# \t]+\\)\\s-+" 1))))))))
1574 (when (memq 'etc-sudoers-generic-mode generic-extras-enable-list
)
1576 (define-generic-mode etc-sudoers-generic-mode
1578 '("User_Alias" "Runas_Alias" "Host_Alias" "Cmnd_Alias"
1579 "NOPASSWD" "PASSWD" "NOEXEC" "EXEC"
1581 '(("\\<\\(root\\|su\\)\\>" 1 font-lock-warning-face
)
1582 ("\\(\\*\\)" 1 font-lock-warning-face
)
1583 ("\\<\\(%[A-Za-z0-9_]+\\)\\>" 1 font-lock-variable-name-face
))
1584 '("/etc/sudoers\\'")
1586 "Generic mode for sudoers configuration files."))
1588 ;; From Jacques Duthen <jacques.duthen@sncf.fr>
1589 (when (memq 'show-tabs-generic-mode generic-extras-enable-list
)
1593 (defconst show-tabs-generic-mode-font-lock-defaults-1
1594 '(;; trailing spaces must come before...
1595 ("[ \t]+$" .
'show-tabs-space
)
1597 ("[^\n\t]\\(\t+\\)" (1 'show-tabs-tab
))))
1599 (defconst show-tabs-generic-mode-font-lock-defaults-2
1600 '(;; trailing spaces must come before...
1601 ("[ \t]+$" .
'show-tabs-space
)
1603 ("\t+" .
'show-tabs-tab
))))
1605 (defface show-tabs-tab
1606 '((((class grayscale
) (background light
)) (:background
"DimGray" :weight bold
))
1607 (((class grayscale
) (background dark
)) (:background
"LightGray" :weight bold
))
1608 (((class color
) (min-colors 88)) (:background
"red1"))
1609 (((class color
)) (:background
"red"))
1611 "Font Lock mode face used to highlight TABs."
1613 (define-obsolete-face-alias 'show-tabs-tab-face
'show-tabs-tab
"22.1")
1615 (defface show-tabs-space
1616 '((((class grayscale
) (background light
)) (:background
"DimGray" :weight bold
))
1617 (((class grayscale
) (background dark
)) (:background
"LightGray" :weight bold
))
1618 (((class color
) (min-colors 88)) (:background
"yellow1"))
1619 (((class color
)) (:background
"yellow"))
1621 "Font Lock mode face used to highlight spaces."
1623 (define-obsolete-face-alias 'show-tabs-space-face
'show-tabs-space
"22.1")
1625 (define-generic-mode show-tabs-generic-mode
1626 nil
;; no comment char
1628 (eval-when-compile show-tabs-generic-mode-font-lock-defaults-1
)
1629 nil
;; no auto-mode-alist
1630 ;; '(show-tabs-generic-mode-hook-fun)
1632 "Generic mode to show tabs and trailing spaces."))
1634 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1636 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1638 (when (memq 'named-boot-generic-mode generic-extras-enable-list
)
1640 (define-generic-mode named-boot-generic-mode
1641 ;; List of comment characters
1644 '("cache" "primary" "secondary" "forwarders" "limit" "options"
1645 "directory" "check-names")
1646 ;; List of additional font-lock-expressions
1647 '(("\\([0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+\\)" 1 font-lock-constant-face
)
1648 ("^directory\\s-+\\(.*\\)" 1 font-lock-variable-name-face
)
1649 ("^\\(primary\\|cache\\)\\s-+\\([.A-Za-z]+\\)\\s-+\\(.*\\)"
1650 (2 font-lock-variable-name-face
)
1651 (3 font-lock-constant-face
)))
1652 ;; List of additional automode-alist expressions
1653 '("/etc/named.boot\\'")
1654 ;; List of set up functions to call
1657 (when (memq 'named-database-generic-mode generic-extras-enable-list
)
1659 (define-generic-mode named-database-generic-mode
1660 ;; List of comment characters
1663 '("IN" "NS" "CNAME" "SOA" "PTR" "MX" "A")
1664 ;; List of additional font-lock-expressions
1665 '(("\\([0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+\\)" 1 font-lock-constant-face
)
1666 ("^\\([.A-Za-z0-9]+\\)" 1 font-lock-variable-name-face
))
1667 ;; List of additional auto-mode-alist expressions
1669 ;; List of set up functions to call
1672 (defvar named-database-time-string
"%Y%m%d%H"
1673 "Timestring for named serial numbers.")
1675 (defun named-database-print-serial ()
1676 "Print a serial number based on the current date."
1678 (insert (format-time-string named-database-time-string
))))
1680 (when (memq 'resolve-conf-generic-mode generic-extras-enable-list
)
1682 (define-generic-mode resolve-conf-generic-mode
1683 ;; List of comment characters
1686 '("nameserver" "domain" "search" "sortlist" "options")
1687 ;; List of additional font-lock-expressions
1689 ;; List of additional auto-mode-alist expressions
1690 '("/etc/resolv[e]?.conf\\'")
1691 ;; List of set up functions to call
1694 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1695 ;; Modes for spice and common electrical engineering circuit netlist formats
1696 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1698 (when (memq 'spice-generic-mode generic-extras-enable-list
)
1700 (define-generic-mode spice-generic-mode
1717 '(("^\\s-*\\([*].*\\)" 1 font-lock-comment-face
)
1718 (" \\(\\$ .*\\)$" 1 font-lock-comment-face
)
1719 ("^\\(\\$ .*\\)$" 1 font-lock-comment-face
)
1720 ("\\([*].*\\)" 1 font-lock-comment-face
)
1721 ("^\\([+]\\)" 1 font-lock-string-face
)
1722 ("^\\s-*\\([.]\\w+\\>\\)" 1 font-lock-keyword-face
)
1723 ("\\(\\([.]\\|_\\|\\w\\)+\\)\\s-*=" 1 font-lock-variable-name-face
)
1724 ("\\('[^']+'\\)" 1 font-lock-string-face
)
1725 ("\\(\"[^\"]+\"\\)" 1 font-lock-string-face
))
1727 "\\.[sS][pP][iI]\\'"
1728 "\\.[sS][pP][iI][cC][eE]\\'"
1729 "\\.[iI][nN][cC]\\'")
1731 'generic-bracket-support
1732 ;; Make keywords case-insensitive
1735 (setq font-lock-defaults
'(generic-font-lock-keywords nil t
)))))
1736 "Generic mode for SPICE circuit netlist files."))
1738 (when (memq 'ibis-generic-mode generic-extras-enable-list
)
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."))
1749 (when (memq 'astap-generic-mode generic-extras-enable-list
)
1751 (define-generic-mode astap-generic-mode
1766 '(("^\\s-*\\([*].*\\)" 1 font-lock-comment-face
)
1767 (";\\s-*\\([*].*\\)" 1 font-lock-comment-face
)
1768 ("^\\s-*\\([.]\\w+\\>\\)" 1 font-lock-keyword-face
)
1769 ("\\('[^']+'\\)" 1 font-lock-string-face
)
1770 ("\\(\"[^\"]+\"\\)" 1 font-lock-string-face
)
1771 ("[(,]\\s-*\\(\\([.]\\|_\\|\\w\\)+\\)\\s-*=" 1 font-lock-variable-name-face
))
1773 "\\.[aA][sS][xX]\\'"
1774 "\\.[aA][sS][tT][aA][pP]\\'"
1775 "\\.[pP][sS][pP]\\'"
1776 "\\.[dD][eE][cC][kK]\\'"
1777 "\\.[gG][oO][dD][aA][tT][aA]")
1779 'generic-bracket-support
1780 ;; Make keywords case-insensitive
1783 (setq font-lock-defaults
'(generic-font-lock-keywords nil t
)))))
1784 "Generic mode for ASTAP circuit netlist files."))
1786 (when (memq 'etc-modules-conf-generic-mode generic-extras-enable-list
)
1788 (define-generic-mode etc-modules-conf-generic-mode
1789 ;; List of comment characters
1807 "generic_stringfile"
1823 ;; List of additional font-lock-expressions
1825 ;; List of additional automode-alist expressions
1826 '("/etc/modules.conf" "/etc/conf.modules")
1827 ;; List of set up functions to call
1830 (provide 'generic-x
)
1832 ;;; generic-x.el ends here