* lisp/whitespace.el (whitespace-enable-predicate): New variable.
[emacs.git] / lisp / generic-x.el
blobd0250cb5210eb8eceafa92152f67b2f89a200ebc
1 ;;; generic-x.el --- A collection of generic modes
3 ;; Copyright (C) 1997-1998, 2001-2013 Free Software Foundation, Inc.
5 ;; Author: Peter Breton <pbreton@cs.umb.edu>
6 ;; Created: Tue Oct 08 1996
7 ;; Keywords: generic, comment, font-lock
8 ;; Package: emacs
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 <http://www.gnu.org/licenses/>.
25 ;;; Commentary:
27 ;; This file contains a collection of generic modes.
29 ;; INSTALLATION:
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
38 ;; customize:
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
63 ;; Love]
65 ;; From Anders Lindgren <andersl@csd.uu.se>
67 ;; Problem summary: Wayne Adams has found a problem when using folding
68 ;; mode in conjunction with font-lock for a mode defined in
69 ;; `generic-x.el'.
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
95 ;; form:
97 ;; [foo]
98 ;; bar = xxx
100 ;; However, since the `.' regexp symbol matches the linefeed character
101 ;; the entire folded section is searched, resulting in a regexp stack
102 ;; overflow.
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.
108 ;;; Code:
110 (eval-when-compile (require 'font-lock))
112 (defgroup generic-x nil
113 "A collection of generic modes."
114 :prefix "generic-"
115 :group 'data
116 :version "20.3")
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."
126 :group 'generic-x
127 :type 'boolean)
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."
133 :group 'generic-x
134 :type 'integer)
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."
142 :group 'generic-x
143 :type 'regexp)
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."
151 :group 'generic-x
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
160 ;; want.
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)
174 (not (string-match-p
175 generic-ignore-files-regexp
176 (file-name-sans-versions buffer-file-name)))))
177 (save-excursion
178 (goto-char (point-min))
179 (when (re-search-forward generic-find-file-regexp
180 (save-excursion
181 (forward-line generic-lines-to-scan)
182 (point)) t)
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
194 ;; lists as well.
196 (defconst generic-default-modes
197 '(apache-conf-generic-mode
198 apache-log-generic-mode
199 hosts-generic-mode
200 java-manifest-generic-mode
201 java-properties-generic-mode
202 javascript-generic-mode
203 show-tabs-generic-mode
204 vrml-generic-mode)
205 "List of generic modes that are defined by default.")
207 (defconst generic-mswindows-modes
208 '(bat-generic-mode
209 inf-generic-mode
210 ini-generic-mode
211 rc-generic-mode
212 reg-generic-mode
213 rul-generic-mode)
214 "List of generic modes that are defined by default on MS-Windows.")
216 (defconst generic-unix-modes
217 '(alias-generic-mode
218 etc-fstab-generic-mode
219 etc-modules-conf-generic-mode
220 etc-passwd-generic-mode
221 etc-services-generic-mode
222 etc-sudoers-generic-mode
223 fvwm-generic-mode
224 inetd-conf-generic-mode
225 mailagent-rules-generic-mode
226 mailrc-generic-mode
227 named-boot-generic-mode
228 named-database-generic-mode
229 prototype-generic-mode
230 resolve-conf-generic-mode
231 samba-generic-mode
232 x-resource-generic-mode
233 xmodmap-generic-mode)
234 "List of generic modes that are defined by default on Unix.")
236 (defconst generic-other-modes
237 '(astap-generic-mode
238 ibis-generic-mode
239 pkginfo-generic-mode
240 spice-generic-mode)
241 "List of generic modes that are not defined by default.")
243 (defcustom generic-define-mswindows-modes
244 (memq system-type '(windows-nt ms-dos))
245 "Non-nil means the modes in `generic-mswindows-modes' will be defined.
246 This is a list of MS-Windows specific generic modes. This variable
247 only affects the default value of `generic-extras-enable-list'."
248 :group 'generic-x
249 :type 'boolean
250 :version "22.1")
251 (make-obsolete-variable 'generic-define-mswindows-modes 'generic-extras-enable-list "22.1")
253 (defcustom generic-define-unix-modes
254 (not (memq system-type '(windows-nt ms-dos)))
255 "Non-nil means the modes in `generic-unix-modes' will be defined.
256 This is a list of Unix specific generic modes. This variable only
257 affects the default value of `generic-extras-enable-list'."
258 :group 'generic-x
259 :type 'boolean
260 :version "22.1")
261 (make-obsolete-variable 'generic-define-unix-modes 'generic-extras-enable-list "22.1")
263 (defcustom generic-extras-enable-list
264 (append generic-default-modes
265 (if generic-define-mswindows-modes generic-mswindows-modes)
266 (if generic-define-unix-modes generic-unix-modes)
267 nil)
268 "List of generic modes to define.
269 Each entry in the list should be a symbol. If you set this variable
270 directly, without using customize, you must reload generic-x to put
271 your changes into effect."
272 :group 'generic-x
273 :type (let (list)
274 (dolist (mode
275 (sort (append generic-default-modes
276 generic-mswindows-modes
277 generic-unix-modes
278 generic-other-modes
279 nil)
280 (lambda (a b)
281 (string< (symbol-name b)
282 (symbol-name a))))
283 (cons 'set list))
284 (push `(const ,mode) list)))
285 :set (lambda (s v)
286 (set-default s v)
287 (unless load-in-progress
288 (load "generic-x")))
289 :version "22.1")
291 ;;; Apache
292 (when (memq 'apache-conf-generic-mode generic-extras-enable-list)
294 (define-generic-mode apache-conf-generic-mode
295 '(?#)
297 '(("^\\s-*\\(<.*>\\)" 1 font-lock-constant-face)
298 ("^\\s-*\\(\\sw+\\)\\s-" 1 font-lock-variable-name-face))
299 '("srm\\.conf\\'" "httpd\\.conf\\'" "access\\.conf\\'")
300 (list
301 (function
302 (lambda ()
303 (setq imenu-generic-expression
304 '((nil "^\\([-A-Za-z0-9_]+\\)" 1)
305 ("*Directories*" "^\\s-*<Directory\\s-*\\([^>]+\\)>" 1)
306 ("*Locations*" "^\\s-*<Location\\s-*\\([^>]+\\)>" 1))))))
307 "Generic mode for Apache or HTTPD configuration files."))
309 (when (memq 'apache-log-generic-mode generic-extras-enable-list)
311 (define-generic-mode apache-log-generic-mode
314 ;; Hostname ? user date request return-code number-of-bytes
315 '(("^\\([-a-zA-z0-9.]+\\) - [-A-Za-z]+ \\(\\[.*\\]\\)"
316 (1 font-lock-constant-face)
317 (2 font-lock-variable-name-face)))
318 '("access_log\\'")
320 "Generic mode for Apache log files."))
322 ;;; Samba
323 (when (memq 'samba-generic-mode generic-extras-enable-list)
325 (define-generic-mode samba-generic-mode
326 '(?\; ?#)
328 '(("^\\(\\[.*\\]\\)" 1 font-lock-constant-face)
329 ("^\\s-*\\(.+\\)=\\([^\r\n]*\\)"
330 (1 font-lock-variable-name-face)
331 (2 font-lock-type-face)))
332 '("smb\\.conf\\'")
333 '(generic-bracket-support)
334 "Generic mode for Samba configuration files."))
336 ;;; Fvwm
337 ;; This is pretty basic. Also, modes for other window managers could
338 ;; be defined as well.
339 (when (memq 'fvwm-generic-mode generic-extras-enable-list)
341 (define-generic-mode fvwm-generic-mode
342 '(?#)
343 '("AddToMenu"
344 "AddToFunc"
345 "ButtonStyle"
346 "EndFunction"
347 "EndPopup"
348 "Function"
349 "IconPath"
350 "Key"
351 "ModulePath"
352 "Mouse"
353 "PixmapPath"
354 "Popup"
355 "Style")
357 '("\\.fvwmrc\\'" "\\.fvwm2rc\\'")
359 "Generic mode for FVWM configuration files."))
361 ;;; X Resource
362 ;; I'm pretty sure I've seen an actual mode to do this, but I don't
363 ;; think it's standard with Emacs
364 (when (memq 'x-resource-generic-mode generic-extras-enable-list)
366 (define-generic-mode x-resource-generic-mode
367 '(?!)
369 '(("^\\([^:\n]+:\\)" 1 font-lock-variable-name-face))
370 '("\\.Xdefaults\\'" "\\.Xresources\\'" "\\.Xenvironment\\'" "\\.ad\\'")
372 "Generic mode for X Resource configuration files."))
374 (if (memq 'xmodmap-generic-mode generic-extras-enable-list)
375 (define-generic-mode xmodmap-generic-mode
376 '(?!)
377 '("add" "clear" "keycode" "keysym" "remove" "pointer")
379 '("[xX]modmap\\(rc\\)?\\'")
381 "Simple mode for xmodmap files."))
383 ;;; Hosts
384 (when (memq 'hosts-generic-mode generic-extras-enable-list)
386 (define-generic-mode hosts-generic-mode
387 '(?#)
388 '("localhost")
389 '(("\\([0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+\\)" 1 font-lock-constant-face))
390 '("[hH][oO][sS][tT][sS]\\'")
392 "Generic mode for HOSTS files."))
394 ;;; Windows INF files
396 ;; If i-g-m-f-f-h is defined, then so is i-g-m.
397 (declare-function ini-generic-mode "generic-x")
399 (when (memq 'inf-generic-mode generic-extras-enable-list)
401 (define-generic-mode inf-generic-mode
402 '(?\;)
404 '(("^\\(\\[.*\\]\\)" 1 font-lock-constant-face))
405 '("\\.[iI][nN][fF]\\'")
406 '(generic-bracket-support)
407 "Generic mode for MS-Windows INF files."))
409 ;;; Windows INI files
410 ;; Should define escape character as well!
411 (when (memq 'ini-generic-mode generic-extras-enable-list)
413 (define-generic-mode ini-generic-mode
414 '(?\;)
416 '(("^\\(\\[.*\\]\\)" 1 font-lock-constant-face)
417 ("^\\([^=\n\r]*\\)=\\([^\n\r]*\\)$"
418 (1 font-lock-function-name-face)
419 (2 font-lock-variable-name-face)))
420 '("\\.[iI][nN][iI]\\'")
421 (list
422 (function
423 (lambda ()
424 (setq imenu-generic-expression
425 '((nil "^\\[\\(.*\\)\\]" 1)
426 ("*Variables*" "^\\s-*\\([^=]+\\)\\s-*=" 1))))))
427 "Generic mode for MS-Windows INI files.
428 You can use `ini-generic-mode-find-file-hook' to enter this mode
429 automatically for INI files whose names do not end in \".ini\".")
431 (defun ini-generic-mode-find-file-hook ()
432 "Hook function to enter Ini-Generic mode automatically for INI files.
433 Done if the first few lines of a file in Fundamental mode look
434 like an INI file. You can add this hook to `find-file-hook'."
435 (and (eq major-mode 'fundamental-mode)
436 (save-excursion
437 (goto-char (point-min))
438 (and (looking-at "^\\s-*\\[.*\\]")
439 (ini-generic-mode)))))
440 (defalias 'generic-mode-ini-file-find-file-hook 'ini-generic-mode-find-file-hook))
442 ;;; Windows REG files
443 ;;; Unfortunately, Windows 95 and Windows NT have different REG file syntax!
444 (when (memq 'reg-generic-mode generic-extras-enable-list)
446 (define-generic-mode reg-generic-mode
447 '(?\;)
448 '("key" "classes_root" "REGEDIT" "REGEDIT4")
449 '(("\\(\\[.*\\]\\)" 1 font-lock-constant-face)
450 ("^\\([^\n\r]*\\)\\s-*=" 1 font-lock-variable-name-face))
451 '("\\.[rR][eE][gG]\\'")
452 (list
453 (function
454 (lambda ()
455 (setq imenu-generic-expression
456 '((nil "^\\s-*\\(.*\\)\\s-*=" 1))))))
457 "Generic mode for MS-Windows Registry files."))
459 (declare-function w32-shell-name "w32-fns" ())
461 ;;; DOS/Windows BAT files
462 (when (memq 'bat-generic-mode generic-extras-enable-list)
464 (define-generic-mode bat-generic-mode
467 (eval-when-compile
468 (list
469 ;; Make this one first in the list, otherwise comments will
470 ;; be over-written by other variables
471 '("^[@ \t]*\\([rR][eE][mM][^\n\r]*\\)" 1 font-lock-comment-face t)
472 '("^[ \t]*\\(::.*\\)" 1 font-lock-comment-face t)
473 '("^[@ \t]*\\([bB][rR][eE][aA][kK]\\|[vV][eE][rR][iI][fF][yY]\\)[ \t]+\\([oO]\\([nN]\\|[fF][fF]\\)\\)"
474 (1 font-lock-builtin-face)
475 (2 font-lock-constant-face t t))
476 ;; Any text (except ON/OFF) following ECHO is a string.
477 '("^[@ \t]*\\([eE][cC][hH][oO]\\)[ \t]+\\(\\([oO]\\([nN]\\|[fF][fF]\\)\\)\\|\\([^>|\r\n]+\\)\\)"
478 (1 font-lock-builtin-face)
479 (3 font-lock-constant-face t t)
480 (5 font-lock-string-face t t))
481 ;; These keywords appear as the first word on a line. (Actually, they
482 ;; can also appear after "if ..." or "for ..." clause, but since they
483 ;; are frequently used in simple text, we punt.)
484 ;; In `generic-bat-mode-setup-function' we make the keywords
485 ;; case-insensitive
486 (generic-make-keywords-list
487 '("for"
488 "if")
489 font-lock-keyword-face "^[@ \t]*")
490 ;; These keywords can be anywhere on a line
491 ;; In `generic-bat-mode-setup-function' we make the keywords
492 ;; case-insensitive
493 (generic-make-keywords-list
494 '("do"
495 "exist"
496 "errorlevel"
497 "goto"
498 "not")
499 font-lock-keyword-face)
500 ;; These are built-in commands. Only frequently-used ones are listed.
501 (generic-make-keywords-list
502 '("CALL" "call" "Call"
503 "CD" "cd" "Cd"
504 "CLS" "cls" "Cls"
505 "COPY" "copy" "Copy"
506 "DEL" "del" "Del"
507 "ECHO" "echo" "Echo"
508 "MD" "md" "Md"
509 "PATH" "path" "Path"
510 "PAUSE" "pause" "Pause"
511 "PROMPT" "prompt" "Prompt"
512 "RD" "rd" "Rd"
513 "REN" "ren" "Ren"
514 "SET" "set" "Set"
515 "START" "start" "Start"
516 "SHIFT" "shift" "Shift")
517 font-lock-builtin-face "[ \t|\n]")
518 '("^[ \t]*\\(:\\sw+\\)" 1 font-lock-function-name-face t)
519 '("\\(%\\sw+%\\)" 1 font-lock-variable-name-face t)
520 '("\\(%[0-9]\\)" 1 font-lock-variable-name-face t)
521 '("[\t ]+\\([+-/][^\t\n\" ]+\\)" 1 font-lock-type-face)
522 '("[ \t\n|]\\<\\([gG][oO][tT][oO]\\)\\>[ \t]*\\(\\sw+\\)?"
523 (1 font-lock-keyword-face)
524 (2 font-lock-function-name-face nil t))
525 '("[ \t\n|]\\<\\([sS][eE][tT]\\)\\>[ \t]*\\(\\sw+\\)?[ \t]*=?"
526 (1 font-lock-builtin-face)
527 (2 font-lock-variable-name-face t t))))
528 '("\\.[bB][aA][tT]\\'"
529 "\\.[cC][mM][dD]\\'"
530 "\\`[cC][oO][nN][fF][iI][gG]\\."
531 "\\`[aA][uU][tT][oO][eE][xX][eE][cC]\\.")
532 '(generic-bat-mode-setup-function)
533 "Generic mode for MS-Windows batch files.")
535 (defvar bat-generic-mode-syntax-table nil
536 "Syntax table in use in `bat-generic-mode' buffers.")
538 (defvar bat-generic-mode-keymap (make-sparse-keymap)
539 "Keymap for `bat-generic-mode'.")
541 (defun bat-generic-mode-compile ()
542 "Run the current BAT file in a compilation buffer."
543 (interactive)
544 (let ((compilation-buffer-name-function
545 (function
546 (lambda (_ign)
547 (concat "*" (buffer-file-name) "*")))))
548 (compile
549 (concat (w32-shell-name) " -c " (buffer-file-name)))))
551 (eval-when-compile (require 'comint))
552 (declare-function comint-mode "comint" ())
553 (declare-function comint-exec "comint" (buffer name command startfile switches))
555 (defun bat-generic-mode-run-as-comint ()
556 "Run the current BAT file in a comint buffer."
557 (interactive)
558 (require 'comint)
559 (let* ((file (buffer-file-name))
560 (buf-name (concat "*" file "*")))
561 (with-current-buffer (get-buffer-create buf-name)
562 (erase-buffer)
563 (comint-mode)
564 (comint-exec
565 buf-name
566 file
567 (w32-shell-name)
569 (list "-c" file))
570 (display-buffer buf-name))))
572 (define-key bat-generic-mode-keymap "\C-c\C-c" 'bat-generic-mode-compile)
574 ;; Make underscores count as words
575 (unless bat-generic-mode-syntax-table
576 (setq bat-generic-mode-syntax-table (make-syntax-table))
577 (modify-syntax-entry ?_ "w" bat-generic-mode-syntax-table))
579 ;; bat-generic-mode doesn't use the comment functionality of
580 ;; define-generic-mode because it has a three-letter comment-string,
581 ;; so we do it here manually instead
582 (defun generic-bat-mode-setup-function ()
583 (make-local-variable 'parse-sexp-ignore-comments)
584 (make-local-variable 'comment-start)
585 (make-local-variable 'comment-start-skip)
586 (make-local-variable 'comment-end)
587 (setq imenu-generic-expression '((nil "^:\\(\\sw+\\)" 1))
588 parse-sexp-ignore-comments t
589 comment-end ""
590 comment-start "REM "
591 comment-start-skip "[Rr][Ee][Mm] *")
592 (set-syntax-table bat-generic-mode-syntax-table)
593 ;; Make keywords case-insensitive
594 (setq font-lock-defaults '(generic-font-lock-keywords nil t))
595 (use-local-map bat-generic-mode-keymap)))
597 ;;; Mailagent
598 ;; Mailagent is a Unix mail filtering program. Anyone wanna do a
599 ;; generic mode for procmail?
600 (when (memq 'mailagent-rules-generic-mode generic-extras-enable-list)
602 (define-generic-mode mailagent-rules-generic-mode
603 '(?#)
604 '("SAVE" "DELETE" "PIPE" "ANNOTATE" "REJECT")
605 '(("^\\(\\sw+\\)\\s-*=" 1 font-lock-variable-name-face)
606 ("\\s-/\\([^/]+\\)/[i, \t\n]" 1 font-lock-constant-face))
607 '("\\.rules\\'")
608 (list
609 (function
610 (lambda ()
611 (setq imenu-generic-expression
612 '((nil "\\s-/\\([^/]+\\)/[i, \t\n]" 1))))))
613 "Generic mode for Mailagent rules files."))
615 ;; Solaris/Sys V prototype files
616 (when (memq 'prototype-generic-mode generic-extras-enable-list)
618 (define-generic-mode prototype-generic-mode
619 '(?#)
621 '(("^\\([0-9]\\)?\\s-*\\([a-z]\\)\\s-+\\([A-Za-z_]+\\)\\s-+\\([^\n\r]*\\)$"
622 (2 font-lock-constant-face)
623 (3 font-lock-keyword-face))
624 ("^\\([a-z]\\) \\([A-Za-z_]+\\)=\\([^\n\r]*\\)$"
625 (1 font-lock-constant-face)
626 (2 font-lock-keyword-face)
627 (3 font-lock-variable-name-face))
628 ("^\\(!\\s-*\\(search\\|include\\|default\\)\\)\\s-*\\([^\n\r]*\\)$"
629 (1 font-lock-keyword-face)
630 (3 font-lock-variable-name-face))
631 ("^\\(!\\s-*\\sw+\\)=\\([^\n\r]*\\)$"
632 (1 font-lock-keyword-face)
633 (2 font-lock-variable-name-face)))
634 '("prototype\\'")
636 "Generic mode for Sys V prototype files."))
638 ;; Solaris/Sys V pkginfo files
639 (when (memq 'pkginfo-generic-mode generic-extras-enable-list)
641 (define-generic-mode pkginfo-generic-mode
642 '(?#)
644 '(("^\\([A-Za-z_]+\\)=\\([^\n\r]*\\)$"
645 (1 font-lock-keyword-face)
646 (2 font-lock-variable-name-face)))
647 '("pkginfo\\'")
649 "Generic mode for Sys V pkginfo files."))
651 ;; Javascript mode
652 ;; Obsolete; defer to js-mode from js.el.
653 (when (memq 'javascript-generic-mode generic-extras-enable-list)
654 (define-obsolete-function-alias 'javascript-generic-mode 'js-mode "24.3")
655 (define-obsolete-variable-alias 'javascript-generic-mode-hook 'js-mode-hook "24.3"))
657 ;; VRML files
658 (when (memq 'vrml-generic-mode generic-extras-enable-list)
660 (define-generic-mode vrml-generic-mode
661 '(?#)
662 '("DEF"
663 "NULL"
664 "USE"
665 "Viewpoint"
666 "ambientIntensity"
667 "appearance"
668 "children"
669 "color"
670 "coord"
671 "coordIndex"
672 "creaseAngle"
673 "diffuseColor"
674 "emissiveColor"
675 "fieldOfView"
676 "geometry"
677 "info"
678 "material"
679 "normal"
680 "orientation"
681 "position"
682 "shininess"
683 "specularColor"
684 "texCoord"
685 "texture"
686 "textureTransform"
687 "title"
688 "transparency"
689 "type")
690 '(("USE\\s-+\\([-A-Za-z0-9_]+\\)"
691 (1 font-lock-constant-face))
692 ("DEF\\s-+\\([-A-Za-z0-9_]+\\)\\s-+\\([A-Za-z0-9]+\\)\\s-*{"
693 (1 font-lock-type-face)
694 (2 font-lock-constant-face))
695 ("^\\s-*\\([-A-Za-z0-9_]+\\)\\s-*{"
696 (1 font-lock-function-name-face))
697 ("^\\s-*\\(geometry\\|appearance\\|material\\)\\s-+\\([-A-Za-z0-9_]+\\)"
698 (2 font-lock-variable-name-face)))
699 '("\\.wrl\\'")
700 (list
701 (function
702 (lambda ()
703 (setq imenu-generic-expression
704 '((nil "^\\([A-Za-z0-9_]+\\)\\s-*{" 1)
705 ("*Definitions*"
706 "DEF\\s-+\\([-A-Za-z0-9_]+\\)\\s-+\\([A-Za-z0-9]+\\)\\s-*{"
707 1))))))
708 "Generic Mode for VRML files."))
710 ;; Java Manifests
711 (when (memq 'java-manifest-generic-mode generic-extras-enable-list)
713 (define-generic-mode java-manifest-generic-mode
714 '(?#)
715 '("Name"
716 "Digest-Algorithms"
717 "Manifest-Version"
718 "Required-Version"
719 "Signature-Version"
720 "Magic"
721 "Java-Bean"
722 "Depends-On")
723 '(("^Name:\\s-+\\([^\n\r]*\\)$"
724 (1 font-lock-variable-name-face))
725 ("^\\(Manifest\\|Required\\|Signature\\)-Version:\\s-+\\([^\n\r]*\\)$"
726 (2 font-lock-constant-face)))
727 '("[mM][aA][nN][iI][fF][eE][sS][tT]\\.[mM][fF]\\'")
729 "Generic mode for Java Manifest files."))
731 ;; Java properties files
732 (when (memq 'java-properties-generic-mode generic-extras-enable-list)
734 (define-generic-mode java-properties-generic-mode
735 '(?! ?#)
737 (eval-when-compile
738 (let ((java-properties-key
739 "\\(\\([-A-Za-z0-9_\\./]\\|\\(\\\\[ =:]\\)\\)+\\)")
740 (java-properties-value
741 "\\([^\r\n]*\\)"))
742 ;; Property and value can be separated in a number of different ways:
743 ;; * whitespace
744 ;; * an equal sign
745 ;; * a colon
746 (mapcar
747 (function
748 (lambda (elt)
749 (list
750 (concat "^" java-properties-key elt java-properties-value "$")
751 '(1 font-lock-constant-face)
752 '(4 font-lock-variable-name-face))))
753 ;; These are the separators
754 '(":\\s-*" "\\s-+" "\\s-*=\\s-*"))))
756 (list
757 (function
758 (lambda ()
759 (setq imenu-generic-expression
760 '((nil "^\\([^#! \t\n\r=:]+\\)" 1))))))
761 "Generic mode for Java properties files."))
763 ;; C shell alias definitions
764 (when (memq 'alias-generic-mode generic-extras-enable-list)
766 (define-generic-mode alias-generic-mode
767 '(?#)
768 '("alias" "unalias")
769 '(("^alias\\s-+\\([-A-Za-z0-9_]+\\)\\s-+"
770 (1 font-lock-variable-name-face))
771 ("^unalias\\s-+\\([-A-Za-z0-9_]+\\)\\s-*$"
772 (1 font-lock-variable-name-face)))
773 '("alias\\'")
774 (list
775 (function
776 (lambda ()
777 (setq imenu-generic-expression
778 '((nil "^\\(alias\\|unalias\\)\\s-+\\([-a-zA-Z0-9_]+\\)" 2))))))
779 "Generic mode for C Shell alias files."))
781 ;;; Windows RC files
782 ;; Contributed by ACorreir@pervasive-sw.com (Alfred Correira)
783 (when (memq 'rc-generic-mode generic-extras-enable-list)
785 (define-generic-mode rc-generic-mode
786 ;; '(?\/)
787 '("//")
788 '("ACCELERATORS"
789 "AUTO3STATE"
790 "AUTOCHECKBOX"
791 "AUTORADIOBUTTON"
792 "BITMAP"
793 "BOTTOMMARGIN"
794 "BUTTON"
795 "CAPTION"
796 "CHARACTERISTICS"
797 "CHECKBOX"
798 "CLASS"
799 "COMBOBOX"
800 "CONTROL"
801 "CTEXT"
802 "CURSOR"
803 "DEFPUSHBUTTON"
804 "DESIGNINFO"
805 "DIALOG"
806 "DISCARDABLE"
807 "EDITTEXT"
808 "EXSTYLE"
809 "FONT"
810 "GROUPBOX"
811 "GUIDELINES"
812 "ICON"
813 "LANGUAGE"
814 "LEFTMARGIN"
815 "LISTBOX"
816 "LTEXT"
817 "MENUITEM SEPARATOR"
818 "MENUITEM"
819 "MENU"
820 "MOVEABLE"
821 "POPUP"
822 "PRELOAD"
823 "PURE"
824 "PUSHBOX"
825 "PUSHBUTTON"
826 "RADIOBUTTON"
827 "RCDATA"
828 "RIGHTMARGIN"
829 "RTEXT"
830 "SCROLLBAR"
831 "SEPARATOR"
832 "STATE3"
833 "STRINGTABLE"
834 "STYLE"
835 "TEXTINCLUDE"
836 "TOOLBAR"
837 "TOPMARGIN"
838 "VERSIONINFO"
839 "VERSION")
840 ;; the choice of what tokens go where is somewhat arbitrary,
841 ;; as is the choice of which value tokens are included, as
842 ;; the choice of face for each token group
843 (eval-when-compile
844 (list
845 (generic-make-keywords-list
846 '("FILEFLAGSMASK"
847 "FILEFLAGS"
848 "FILEOS"
849 "FILESUBTYPE"
850 "FILETYPE"
851 "FILEVERSION"
852 "PRODUCTVERSION")
853 font-lock-type-face)
854 (generic-make-keywords-list
855 '("BEGIN"
856 "BLOCK"
857 "END"
858 "VALUE")
859 font-lock-function-name-face)
860 '("^#[ \t]*include[ \t]+\\(<[^>\"\n]+>\\)" 1 font-lock-string-face)
861 '("^#[ \t]*define[ \t]+\\(\\sw+\\)(" 1 font-lock-function-name-face)
862 '("^#[ \t]*\\(elif\\|if\\)\\>"
863 ("\\<\\(defined\\)\\>[ \t]*(?\\(\\sw+\\)?" nil nil
864 (1 font-lock-constant-face)
865 (2 font-lock-variable-name-face nil t)))
866 '("^#[ \t]*\\(\\sw+\\)\\>[ \t]*\\(\\sw+\\)?"
867 (1 font-lock-constant-face)
868 (2 font-lock-variable-name-face nil t))))
869 '("\\.[rR][cC]\\'")
871 "Generic mode for MS-Windows Resource files."))
873 ;; InstallShield RUL files
874 ;; Contributed by Alfred.Correira@Pervasive.Com
875 ;; Bugfixes by "Rolf Sandau" <Rolf.Sandau@marconi.com>
876 (when (memq 'rul-generic-mode generic-extras-enable-list)
878 (eval-when-compile
880 ;;; build the regexp strings using regexp-opt
881 (defconst installshield-statement-keyword-list
882 '("abort"
883 "begin"
884 "call"
885 "case"
886 "declare"
887 "default"
888 "downto"
889 "elseif"
890 "else"
891 "endfor"
892 "endif"
893 "endswitch"
894 "endwhile"
895 "end"
896 "exit"
897 "external"
898 "for"
899 "function"
900 ;; "goto" -- handled elsewhere
901 "if"
902 "program"
903 "prototype"
904 "repeat"
905 "return"
906 "step"
907 "switch"
908 "then"
909 "to"
910 "typedef"
911 "until"
912 "void"
913 "while")
914 "Statement keywords used in InstallShield 3 and 5.")
916 (defconst installshield-system-functions-list
917 '("AddFolderIcon"
918 "AddProfString"
919 "AddressString"
920 "AppCommand"
921 "AskDestPath"
922 "AskOptions"
923 "AskPath"
924 "AskText"
925 "AskYesNo"
926 "BatchDeleteEx"
927 "BatchFileLoad"
928 "BatchFileSave"
929 "BatchFind"
930 "BatchGetFileName"
931 "BatchMoveEx"
932 "BatchSetFileName"
933 "ChangeDirectory"
934 "CloseFile"
935 "CmdGetHwndDlg"
936 "ComponentAddItem" ; differs between IS3 and IS5
937 "ComponentCompareSizeRequired" ; IS5 only
938 "ComponentDialog"
939 "ComponentError" ; IS5 only
940 "ComponentFileEnum" ; IS5 only
941 "ComponentFileInfo" ; IS5 only
942 "ComponentFilterLanguage" ; IS5 only
943 "ComponentFilterOS" ; IS5 only
944 "ComponentGetData" ; IS5 only
945 "ComponentGetItemInfo" ; IS3 only
946 "ComponentGetItemSize" ; differs between IS3 and IS5
947 "ComponentIsItemSelected" ; differs between IS3 and IS5
948 "ComponentListItems"
949 "ComponentMoveData" ; IS5 only
950 "ComponentSelectItem" ; differs between IS3 and IS5
951 "ComponentSetData" ; IS5 only
952 "ComponentSetItemInfo" ; IS3 only
953 "ComponentSetTarget" ; IS5 only
954 "ComponentSetupTypeEnum" ; IS5 only
955 "ComponentSetupTypeGetData" ; IS5 only
956 "ComponentSetupTypeSet" ; IS5 only
957 "ComponentTotalSize"
958 "ComponentValidate" ; IS5 only
959 "CompressAdd" ; IS3 only
960 "CompressDel" ; IS3 only
961 "CompressEnum" ; IS3 only
962 "CompressGet" ; IS3 only
963 "CompressInfo" ; IS3 only
964 "CopyFile"
965 "CreateDir"
966 "CreateFile"
967 "CreateProgramFolder"
968 "DeinstallSetReference" ; IS5 only
969 "DeinstallStart"
970 "Delay"
971 "DeleteDir"
972 "DeleteFile"
973 "DialogSetInfo"
974 "Disable"
975 "DoInstall"
976 "Do"
977 "Enable"
978 "EnterDisk"
979 "ExistsDir"
980 "ExistsDisk"
981 "ExitProgMan"
982 "EzBatchAddPath"
983 "EzBatchAddString"
984 "EzBatchReplace"
985 "EzConfigAddDriver"
986 "EzConfigAddString"
987 "EzConfigGetValue"
988 "EzConfigSetValue"
989 "EzDefineDialog"
990 "FileCompare"
991 "FileDeleteLine"
992 "FileGrep"
993 "FileInsertLine"
994 "FileSetBeginDefine" ; IS3 only
995 "FileSetEndDefine" ; IS3 only
996 "FileSetPerformEz" ; IS3 only
997 "FileSetPerform" ; IS3 only
998 "FileSetReset" ; IS3 only
999 "FileSetRoot" ; IS3 only
1000 "FindAllDirs"
1001 "FindAllFiles"
1002 "FindFile"
1003 "FindWindow"
1004 "GetDiskSpace"
1005 "GetDisk"
1006 "GetEnvVar"
1007 "GetExtents"
1008 "GetFileInfo"
1009 "GetLine"
1010 "GetProfInt"
1011 "GetProfString"
1012 "GetSystemInfo"
1013 "GetValidDrivesList"
1014 "GetVersion"
1015 "GetWindowHandle"
1016 "InstallationInfo"
1017 "Is"
1018 "LaunchApp"
1019 "LaunchAppAndWait"
1020 "ListAddItem"
1021 "ListAddString"
1022 "ListCount"
1023 "ListCreate"
1024 "ListDestroy"
1025 "ListFindItem"
1026 "ListFindString"
1027 "ListGetFirstItem"
1028 "ListGetFirstString"
1029 "ListGetNextItem"
1030 "ListGetNextString"
1031 "ListReadFromFile"
1032 "ListSetCurrentItem"
1033 "ListSetNextItem"
1034 "ListSetNextString"
1035 "ListSetIndex"
1036 "ListWriteToFile"
1037 "LongPathToQuote"
1038 "LongPathToShortPath"
1039 "MessageBox"
1040 "NumToStr"
1041 "OpenFileMode"
1042 "OpenFile"
1043 "ParsePath"
1044 "PathAdd"
1045 "PathDelete"
1046 "PathFind"
1047 "PathGet"
1048 "PathMove"
1049 "PathSet"
1050 "Path"
1051 "PlaceBitmap"
1052 "PlaceWindow"
1053 "PlayMMedia" ; IS5 only
1054 "ProgDefGroupType"
1055 "RegDBCreateKeyEx"
1056 "RegDBDeleteValue"
1057 "RegDBGetItem"
1058 "RegDBKeyExist"
1059 "RegDBSetItem"
1060 "RegDBGetKeyValueEx"
1061 "RegDBSetKeyValueEx"
1062 "RegDBSetDefaultRoot"
1063 "RenameFile"
1064 "ReplaceFolderIcon"
1065 "ReplaceProfString"
1066 "SdAskDestPath"
1067 "SdAskOptions"
1068 "SdAskOptionsList"
1069 "SdBitmap"
1070 "SdCloseDlg"
1071 "SdComponentAdvCheckSpace"
1072 "SdComponentAdvInit"
1073 "SdComponentAdvUpdateSpace"
1074 "SdComponentDialog"
1075 "SdComponentDialog2"
1076 "SdComponentDialogAdv"
1077 "SdComponentDialogEx"
1078 "SdComponentDlgCheckSpace"
1079 "SdComponentMult"
1080 "SdConfirmNewDir"
1081 "SdConfirmRegistration"
1082 "SdDiskSpace"
1083 "SdDisplayTopics"
1084 "SdDoStdButton"
1085 "SdEnablement"
1086 "SdError"
1087 "SdFinish"
1088 "SdFinishInit32"
1089 "SdFinishReboot"
1090 "SdGeneralInit"
1091 "SdGetItemName"
1092 "SdGetTextExtent"
1093 "SdGetUserCompanyInfo"
1094 "SdInit"
1095 "SdIsShellExplorer"
1096 "SdIsStdButton"
1097 "SdLicense"
1098 "SdMakeName"
1099 "SdOptionInit"
1100 "SdOptionSetState"
1101 "SdOptionsButtons"
1102 "SdOptionsButtonsInit"
1103 "SdPlugInProductName"
1104 "SdProductName"
1105 "SdRegEnableButton"
1106 "SdRegExEnableButton"
1107 "SdRegisterUser"
1108 "SdRegisterUserEx"
1109 "SdRemoveEndSpace"
1110 "SdSelectFolder"
1111 "SdSetSequentialItems"
1112 "SdSetStatic"
1113 "SdSetupTypeEx" ; IS5 only
1114 "SdSetupType"
1115 "SdShowAnyDialog"
1116 "SdShowDlgEdit1"
1117 "SdShowDlgEdit2"
1118 "SdShowDlgEdit3"
1119 "SdShowFileMods"
1120 "SdShowInfoList"
1121 "SdShowMsg"
1122 "SdStartCopy"
1123 "SdUnInit"
1124 "SdUpdateComponentSelection"
1125 "SdWelcome"
1126 "SendMessage"
1127 "SetColor"
1128 "SetFont"
1129 "SetDialogTitle"
1130 "SetDisplayEffect" ; IS5 only
1131 "SetFileInfo"
1132 "SetForegroundWindow"
1133 "SetStatusWindow"
1134 "SetTitle"
1135 "SetupType"
1136 "ShowProgramFolder"
1137 "Split" ; IS3 only
1138 "SprintfBox"
1139 "Sprintf"
1140 "StatusUpdate"
1141 "StrCompare"
1142 "StrFind"
1143 "StrGetTokens"
1144 "StrLength"
1145 "StrRemoveLastSlash"
1146 "StrToLower"
1147 "StrToNum"
1148 "StrToUpper"
1149 "StrSub"
1150 "VarRestore"
1151 "VarSave"
1152 "VerCompare"
1153 "VerGetFileVersion"
1154 "WaitOnDialog"
1155 "Welcome"
1156 "WriteLine"
1157 "WriteProfString"
1158 "XCopyFile")
1159 "System functions defined in InstallShield 3 and 5.")
1161 (defconst installshield-system-variables-list
1162 '("BATCH_INSTALL"
1163 "CMDLINE"
1164 "COMMONFILES"
1165 "CORECOMPONENTHANDLING"
1166 "DIALOGCACHE"
1167 "ERRORFILENAME"
1168 "FOLDER_DESKTOP"
1169 "FOLDER_PROGRAMS"
1170 "FOLDER_STARTMENU"
1171 "FOLDER_STARTUP"
1172 "INFOFILENAME"
1173 "ISRES"
1174 "ISUSER"
1175 "ISVERSION"
1176 "MEDIA"
1177 "MODE"
1178 "PROGRAMFILES"
1179 "SELECTED_LANGUAGE"
1180 "SRCDIR"
1181 "SRCDISK"
1182 "SUPPORTDIR"
1183 "TARGETDIR"
1184 "TARGETDISK"
1185 "UNINST"
1186 "WINDIR"
1187 "WINDISK"
1188 "WINMAJOR"
1189 "WINSYSDIR"
1190 "WINSYSDISK")
1191 "System variables used in InstallShield 3 and 5.")
1193 (defconst installshield-types-list
1194 '("BOOL"
1195 "BYREF"
1196 "CHAR"
1197 "HIWORD"
1198 "HWND"
1199 "INT"
1200 "LIST"
1201 "LONG"
1202 "LOWORD"
1203 "LPSTR"
1204 "NUMBER"
1205 "NUMBERLIST"
1206 "POINTER"
1207 "QUAD"
1208 "RGB"
1209 "SHORT"
1210 "STRINGLIST"
1211 "STRING")
1212 "Type keywords used in InstallShield 3 and 5.")
1214 ;;; some might want to skip highlighting these to improve performance
1215 (defconst installshield-funarg-constants-list
1216 '("AFTER"
1217 "APPEND"
1218 "ALLCONTENTS"
1219 "BACKBUTTON"
1220 "BACKGROUNDCAPTION"
1221 "BACKGROUND"
1222 "BACK"
1223 "BASEMEMORY"
1224 "BEFORE"
1225 "BIOS"
1226 "BITMAPICON"
1227 "BK_BLUE"
1228 "BK_GREEN"
1229 "BK_RED"
1230 "BLUE"
1231 "BOOTUPDRIVE"
1232 "CANCEL"
1233 "CDROM_DRIVE"
1234 "CDROM"
1235 "CHECKBOX95"
1236 "CHECKBOX"
1237 "CHECKLINE"
1238 "CHECKMARK"
1239 "COLORS"
1240 "COMMANDEX"
1241 "COMMAND"
1242 "COMP_NORMAL"
1243 "COMP_UPDATE_DATE"
1244 "COMP_UPDATE_SAME"
1245 "COMP_UPDATE_VERSION"
1246 "COMPACT"
1247 "CONTINUE"
1248 "CPU"
1249 "CUSTOM"
1250 "DATE"
1251 "DEFWINDOWMODE"
1252 "DIR_WRITEABLE"
1253 "DIRECTORY"
1254 "DISABLE"
1255 "DISK_TOTALSPACE"
1256 "DISK"
1257 "DLG_OPTIONS"
1258 "DLG_PATH"
1259 "DLG_TEXT"
1260 "DLG_ASK_YESNO"
1261 "DLG_ENTER_DISK"
1262 "DLG_ERR"
1263 "DLG_INFO_ALTIMAGE"
1264 "DLG_INFO_CHECKSELECTION"
1265 "DLG_INFO_KUNITS"
1266 "DLG_INFO_USEDECIMAL"
1267 "DLG_MSG_INFORMATION"
1268 "DLG_MSG_SEVERE"
1269 "DLG_MSG_WARNING"
1270 "DLG_STATUS"
1271 "DLG_WARNING"
1272 "DLG_USER_CAPTION"
1273 "DRIVE"
1274 "ENABLE"
1275 "END_OF_FILE"
1276 "END_OF_LIST"
1277 "ENVSPACE"
1278 "EQUALS"
1279 "EXCLUDE_SUBDIR"
1280 "EXCLUSIVE"
1281 "EXISTS"
1282 "EXIT"
1283 "EXTENDED_MEMORY"
1284 "EXTENSION_ONLY"
1285 "FAILIFEXISTS"
1286 "FALSE"
1287 "FEEDBACK_FULL"
1288 "FILE_ATTR_ARCHIVED"
1289 "FILE_ATTR_DIRECTORY"
1290 "FILE_ATTR_HIDDEN"
1291 "FILE_ATTR_NORMAL"
1292 "FILE_ATTR_READONLY"
1293 "FILE_ATTR_SYSTEM"
1294 "FILE_ATTRIBUTE"
1295 "FILE_DATE"
1296 "FILE_LINE_LENGTH"
1297 "FILE_MODE_APPEND"
1298 "FILE_MODE_BINARYREADONLY"
1299 "FILE_MODE_BINARY"
1300 "FILE_MODE_NORMAL"
1301 "FILE_NO_VERSION"
1302 "FILE_NOT_FOUND"
1303 "FILE_SIZE"
1304 "FILE_TIME"
1305 "FILENAME_ONLY"
1306 "FILENAME"
1307 "FIXED_DRIVE"
1308 "FOLDER_DESKTOP"
1309 "FOLDER_PROGRAMS"
1310 "FOLDER_STARTMENU"
1311 "FOLDER_STARTUP"
1312 "FREEENVSPACE"
1313 "FULLWINDOWMODE"
1314 "FULL"
1315 "FONT_TITLE"
1316 "GREATER_THAN"
1317 "GREEN"
1318 "HKEY_CLASSES_ROOT"
1319 "HKEY_CURRENT_USER"
1320 "HKEY_LOCAL_MACHINE"
1321 "HKEY_USERS"
1322 "HOURGLASS"
1323 "INCLUDE_SUBDIR"
1324 "INDVFILESTATUS"
1325 "INFORMATION"
1326 "IS_WINDOWSNT"
1327 "IS_WINDOWS95"
1328 "IS_WINDOWS"
1329 "IS_WIN32S"
1330 "ISTYPE"
1331 "LANGUAGE_DRV"
1332 "LANGUAGE"
1333 "LESS_THAN"
1334 "LIST_NULL"
1335 "LISTFIRST"
1336 "LISTNEXT"
1337 "LOCKEDFILE"
1338 "LOGGING"
1339 "LOWER_LEFT"
1340 "LOWER_RIGHT"
1341 "MAGENTA"
1342 "MOUSE_DRV"
1343 "MOUSE"
1344 "NETWORK_DRV"
1345 "NETWORK"
1346 "NEXT"
1347 "NONEXCLUSIVE"
1348 "NORMALMODE"
1349 "NOSET"
1350 "NOTEXISTS"
1351 "NOWAIT"
1352 "NO"
1353 "OFF"
1354 "ONLYDIR"
1355 "ON"
1356 "OSMAJOR"
1357 "OSMINOR"
1358 "OS"
1359 "OTHER_FAILURE"
1360 "PARALLEL"
1361 "PARTIAL"
1362 "PATH_EXISTS"
1363 "PATH"
1364 "RED"
1365 "REGDB_APPPATH_DEFAULT"
1366 "REGDB_APPPATH"
1367 "REGDB_BINARY"
1368 "REGDB_ERR_CONNECTIONEXISTS"
1369 "REGDB_ERR_CORRUPTEDREGISTRY"
1370 "REGDB_ERR_INITIALIZATION"
1371 "REGDB_ERR_INVALIDHANDLE"
1372 "REGDB_ERR_INVALIDNAME"
1373 "REGDB_NUMBER"
1374 "REGDB_STRING_EXPAND"
1375 "REGDB_STRING_MULTI"
1376 "REGDB_STRING"
1377 "REGDB_UNINSTALL_NAME"
1378 "REMOTE_DRIVE"
1379 "REMOVEABLE_DRIVE"
1380 "REPLACE_ITEM"
1381 "REPLACE"
1382 "RESET"
1383 "RESTART"
1384 "ROOT"
1385 "SELFREGISTER"
1386 "SERIAL"
1387 "SET"
1388 "SEVERE"
1389 "SHAREDFILE"
1390 "SHARE"
1391 "SILENTMODE"
1392 "SRCTARGETDIR"
1393 "STATUSBAR"
1394 "STATUSDLG"
1395 "STATUSOLD"
1396 "STATUS"
1397 "STYLE_NORMAL"
1398 "SW_MAXIMIZE"
1399 "SW_MINIMIZE"
1400 "SW_RESTORE"
1401 "SW_SHOW"
1402 "SYS_BOOTMACHINE"
1403 "TIME"
1404 "TRUE"
1405 "TYPICAL"
1406 "UPPER_LEFT"
1407 "UPPER_RIGHT"
1408 "VALID_PATH"
1409 "VERSION"
1410 "VIDEO"
1411 "VOLUMELABEL"
1412 "YELLOW"
1413 "YES"
1414 "WAIT"
1415 "WARNING"
1416 "WINMAJOR"
1417 "WINMINOR"
1418 "WIN32SINSTALLED"
1419 "WIN32SMAJOR"
1420 "WIN32SMINOR")
1421 "Function argument constants used in InstallShield 3 and 5."))
1423 (defvar rul-generic-mode-syntax-table nil
1424 "Syntax table to use in `rul-generic-mode' buffers.")
1426 (setq rul-generic-mode-syntax-table
1427 (make-syntax-table c++-mode-syntax-table))
1429 (modify-syntax-entry ?\r "> b" rul-generic-mode-syntax-table)
1430 (modify-syntax-entry ?\n "> b" rul-generic-mode-syntax-table)
1432 (modify-syntax-entry ?/ ". 124b" rul-generic-mode-syntax-table)
1433 (modify-syntax-entry ?* ". 23" rul-generic-mode-syntax-table)
1435 ;; here manually instead
1436 (defun generic-rul-mode-setup-function ()
1437 (make-local-variable 'parse-sexp-ignore-comments)
1438 (make-local-variable 'comment-start)
1439 (make-local-variable 'comment-start-skip)
1440 (make-local-variable 'comment-end)
1441 (setq imenu-generic-expression
1442 '((nil "^function\\s-+\\([A-Za-z0-9_]+\\)" 1))
1443 parse-sexp-ignore-comments t
1444 comment-end "*/"
1445 comment-start "/*"
1446 ;;; comment-end ""
1447 ;;; comment-start "//"
1448 ;;; comment-start-skip ""
1450 ;; (set-syntax-table rul-generic-mode-syntax-table)
1451 (setq font-lock-syntax-table rul-generic-mode-syntax-table))
1453 ;; moved mode-definition behind defun-definition to be warning-free - 15.11.02/RSan
1454 (define-generic-mode rul-generic-mode
1455 ;; Using "/*" and "*/" doesn't seem to be working right
1456 '("//" ("/*" . "*/" ))
1457 (eval-when-compile installshield-statement-keyword-list)
1458 (eval-when-compile
1459 (list
1460 ;; preprocessor constructs
1461 '("#[ \t]*include[ \t]+\\(<[^>\"\n]+>\\)"
1462 1 font-lock-string-face)
1463 '("#[ \t]*\\(\\sw+\\)\\>[ \t]*\\(\\sw+\\)?"
1464 (1 font-lock-constant-face)
1465 (2 font-lock-variable-name-face nil t))
1466 ;; indirect string constants
1467 '("\\(@[A-Za-z][A-Za-z0-9_]+\\)" 1 font-lock-builtin-face)
1468 ;; gotos
1469 '("[ \t]*\\(\\sw+:\\)" 1 font-lock-constant-face)
1470 '("\\<\\(goto\\)\\>[ \t]*\\(\\sw+\\)?"
1471 (1 font-lock-keyword-face)
1472 (2 font-lock-constant-face nil t))
1473 ;; system variables
1474 (generic-make-keywords-list
1475 installshield-system-variables-list
1476 font-lock-variable-name-face "[^_]" "[^_]")
1477 ;; system functions
1478 (generic-make-keywords-list
1479 installshield-system-functions-list
1480 font-lock-function-name-face "[^_]" "[^_]")
1481 ;; type keywords
1482 (generic-make-keywords-list
1483 installshield-types-list
1484 font-lock-type-face "[^_]" "[^_]")
1485 ;; function argument constants
1486 (generic-make-keywords-list
1487 installshield-funarg-constants-list
1488 font-lock-variable-name-face "[^_]" "[^_]"))) ; is this face the best choice?
1489 '("\\.[rR][uU][lL]\\'")
1490 '(generic-rul-mode-setup-function)
1491 "Generic mode for InstallShield RUL files.")
1493 (define-skeleton rul-if
1494 "Insert an if statement."
1495 "condition: "
1496 "if(" str ") then" \n
1497 > _ \n
1498 ( "other condition, %s: "
1499 > "elseif(" str ") then" \n
1500 > \n)
1501 > "else" \n
1502 > \n
1503 resume:
1504 > "endif;")
1506 (define-skeleton rul-function
1507 "Insert a function statement."
1508 "function: "
1509 "function " str " ()" \n
1510 ( "local variables, %s: "
1511 > " " str ";" \n)
1512 > "begin" \n
1513 > _ \n
1514 resume:
1515 > "end;"))
1517 ;; Additions by ACorreir@pervasive-sw.com (Alfred Correira)
1518 (when (memq 'mailrc-generic-mode generic-extras-enable-list)
1520 (define-generic-mode mailrc-generic-mode
1521 '(?#)
1522 '("alias"
1523 "else"
1524 "endif"
1525 "group"
1526 "if"
1527 "ignore"
1528 "set"
1529 "source"
1530 "unset")
1531 '(("^\\s-*\\(alias\\|group\\)\\s-+\\([-A-Za-z0-9_]+\\)\\s-+\\([^\n\r#]*\\)\\(#.*\\)?$"
1532 (2 font-lock-constant-face)
1533 (3 font-lock-variable-name-face))
1534 ("^\\s-*\\(unset\\|set\\|ignore\\)\\s-+\\([-A-Za-z0-9_]+\\)=?\\([^\n\r#]*\\)\\(#.*\\)?$"
1535 (2 font-lock-constant-face)
1536 (3 font-lock-variable-name-face))
1537 ("^\\s-*\\(source\\)\\s-+\\([^\n\r#]*\\)\\(#.*\\)?$"
1538 (2 font-lock-variable-name-face)))
1539 '("\\.mailrc\\'")
1541 "Mode for mailrc files."))
1543 ;; Inetd.conf
1544 (when (memq 'inetd-conf-generic-mode generic-extras-enable-list)
1546 (define-generic-mode inetd-conf-generic-mode
1547 '(?#)
1548 '("stream"
1549 "dgram"
1550 "tcp"
1551 "udp"
1552 "wait"
1553 "nowait"
1554 "internal")
1555 '(("^\\([-A-Za-z0-9_]+\\)" 1 font-lock-type-face))
1556 '("/etc/inetd.conf\\'")
1557 (list
1558 (function
1559 (lambda ()
1560 (setq imenu-generic-expression
1561 '((nil "^\\([-A-Za-z0-9_]+\\)" 1))))))))
1563 ;; Services
1564 (when (memq 'etc-services-generic-mode generic-extras-enable-list)
1566 (define-generic-mode etc-services-generic-mode
1567 '(?#)
1568 '("tcp"
1569 "udp"
1570 "ddp")
1571 '(("^\\([-A-Za-z0-9_]+\\)\\s-+\\([0-9]+\\)/"
1572 (1 font-lock-type-face)
1573 (2 font-lock-variable-name-face)))
1574 '("/etc/services\\'")
1575 (list
1576 (function
1577 (lambda ()
1578 (setq imenu-generic-expression
1579 '((nil "^\\([-A-Za-z0-9_]+\\)" 1))))))))
1581 ;; Password and Group files
1582 (when (memq 'etc-passwd-generic-mode generic-extras-enable-list)
1584 (define-generic-mode etc-passwd-generic-mode
1585 nil ;; No comment characters
1586 '("root") ;; Only one keyword
1587 (eval-when-compile
1588 (list
1589 (list
1590 (concat
1592 ;; User name -- Never blank!
1593 "\\([^:]+\\)"
1595 ;; Password, UID and GID
1596 (mapconcat
1597 'identity
1598 (make-list 3 "\\([^:]+\\)")
1599 ":")
1601 ;; GECOS/Name -- might be blank
1602 "\\([^:]*\\)"
1604 ;; Home directory and shell
1605 "\\([^:]+\\)"
1606 ":?"
1607 "\\([^:]*\\)"
1608 "$")
1609 '(1 font-lock-type-face)
1610 '(5 font-lock-variable-name-face)
1611 '(6 font-lock-constant-face)
1612 '(7 font-lock-warning-face))
1613 '("^\\([^:]+\\):\\([^:]*\\):\\([0-9]+\\):\\(.*\\)$"
1614 (1 font-lock-type-face)
1615 (4 font-lock-variable-name-face))))
1616 '("/etc/passwd\\'" "/etc/group\\'")
1617 (list
1618 (function
1619 (lambda ()
1620 (setq imenu-generic-expression
1621 '((nil "^\\([-A-Za-z0-9_]+\\):" 1))))))))
1623 ;; Fstab
1624 (when (memq 'etc-fstab-generic-mode generic-extras-enable-list)
1626 (define-generic-mode etc-fstab-generic-mode
1627 '(?#)
1628 '("adfs"
1629 "affs"
1630 "autofs"
1631 "coda"
1632 "coherent"
1633 "cramfs"
1634 "devpts"
1635 "efs"
1636 "ext2"
1637 "ext3"
1638 "ext4"
1639 "hfs"
1640 "hpfs"
1641 "iso9660"
1642 "jfs"
1643 "minix"
1644 "msdos"
1645 "ncpfs"
1646 "nfs"
1647 "ntfs"
1648 "proc"
1649 "qnx4"
1650 "reiserfs"
1651 "romfs"
1652 "smbfs"
1653 "cifs"
1654 "usbdevfs"
1655 "sysv"
1656 "sysfs"
1657 "tmpfs"
1658 "udf"
1659 "ufs"
1660 "umsdos"
1661 "vfat"
1662 "xenix"
1663 "xfs"
1664 "swap"
1665 "auto"
1666 "ignore")
1667 '(("^\\([^# \t]+\\)\\s-+\\([^# \t]+\\)"
1668 (1 font-lock-type-face t)
1669 (2 font-lock-variable-name-face t)))
1670 '("/etc/[v]*fstab\\'")
1671 (list
1672 (function
1673 (lambda ()
1674 (setq imenu-generic-expression
1675 '((nil "^\\([^# \t]+\\)\\s-+" 1))))))))
1677 ;; /etc/sudoers
1678 (when (memq 'etc-sudoers-generic-mode generic-extras-enable-list)
1680 (define-generic-mode etc-sudoers-generic-mode
1681 '(?#)
1682 '("User_Alias" "Runas_Alias" "Host_Alias" "Cmnd_Alias"
1683 "NOPASSWD" "PASSWD" "NOEXEC" "EXEC"
1684 "ALL")
1685 '(("\\<\\(root\\|su\\)\\>" 1 font-lock-warning-face)
1686 ("\\(\\*\\)" 1 font-lock-warning-face)
1687 ("\\<\\(%[A-Za-z0-9_]+\\)\\>" 1 font-lock-variable-name-face))
1688 '("/etc/sudoers\\'")
1690 "Generic mode for sudoers configuration files."))
1692 ;; From Jacques Duthen <jacques.duthen@sncf.fr>
1693 (when (memq 'show-tabs-generic-mode generic-extras-enable-list)
1695 (eval-when-compile
1697 (defconst show-tabs-generic-mode-font-lock-defaults-1
1698 '(;; trailing spaces must come before...
1699 ("[ \t]+$" . 'show-tabs-space)
1700 ;; ...embedded tabs
1701 ("[^\n\t]\\(\t+\\)" (1 'show-tabs-tab))))
1703 (defconst show-tabs-generic-mode-font-lock-defaults-2
1704 '(;; trailing spaces must come before...
1705 ("[ \t]+$" . 'show-tabs-space)
1706 ;; ...tabs
1707 ("\t+" . 'show-tabs-tab))))
1709 (defface show-tabs-tab
1710 '((((class grayscale) (background light)) (:background "DimGray" :weight bold))
1711 (((class grayscale) (background dark)) (:background "LightGray" :weight bold))
1712 (((class color) (min-colors 88)) (:background "red1"))
1713 (((class color)) (:background "red"))
1714 (t (:weight bold)))
1715 "Font Lock mode face used to highlight TABs."
1716 :group 'generic-x)
1717 (define-obsolete-face-alias 'show-tabs-tab-face 'show-tabs-tab "22.1")
1719 (defface show-tabs-space
1720 '((((class grayscale) (background light)) (:background "DimGray" :weight bold))
1721 (((class grayscale) (background dark)) (:background "LightGray" :weight bold))
1722 (((class color) (min-colors 88)) (:background "yellow1"))
1723 (((class color)) (:background "yellow"))
1724 (t (:weight bold)))
1725 "Font Lock mode face used to highlight spaces."
1726 :group 'generic-x)
1727 (define-obsolete-face-alias 'show-tabs-space-face 'show-tabs-space "22.1")
1729 (define-generic-mode show-tabs-generic-mode
1730 nil ;; no comment char
1731 nil ;; no keywords
1732 (eval-when-compile show-tabs-generic-mode-font-lock-defaults-1)
1733 nil ;; no auto-mode-alist
1734 ;; '(show-tabs-generic-mode-hook-fun)
1736 "Generic mode to show tabs and trailing spaces."))
1738 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1739 ;; DNS modes
1740 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1742 (when (memq 'named-boot-generic-mode generic-extras-enable-list)
1744 (define-generic-mode named-boot-generic-mode
1745 ;; List of comment characters
1746 '(?\;)
1747 ;; List of keywords
1748 '("cache" "primary" "secondary" "forwarders" "limit" "options"
1749 "directory" "check-names")
1750 ;; List of additional font-lock-expressions
1751 '(("\\([0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+\\)" 1 font-lock-constant-face)
1752 ("^directory\\s-+\\(.*\\)" 1 font-lock-variable-name-face)
1753 ("^\\(primary\\|cache\\)\\s-+\\([.A-Za-z]+\\)\\s-+\\(.*\\)"
1754 (2 font-lock-variable-name-face)
1755 (3 font-lock-constant-face)))
1756 ;; List of additional automode-alist expressions
1757 '("/etc/named.boot\\'")
1758 ;; List of set up functions to call
1759 nil))
1761 (when (memq 'named-database-generic-mode generic-extras-enable-list)
1763 (define-generic-mode named-database-generic-mode
1764 ;; List of comment characters
1765 '(?\;)
1766 ;; List of keywords
1767 '("IN" "NS" "CNAME" "SOA" "PTR" "MX" "A")
1768 ;; List of additional font-lock-expressions
1769 '(("\\([0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+\\)" 1 font-lock-constant-face)
1770 ("^\\([.A-Za-z0-9]+\\)" 1 font-lock-variable-name-face))
1771 ;; List of additional auto-mode-alist expressions
1773 ;; List of set up functions to call
1774 nil)
1776 (defvar named-database-time-string "%Y%m%d%H"
1777 "Timestring for named serial numbers.")
1779 (defun named-database-print-serial ()
1780 "Print a serial number based on the current date."
1781 (interactive)
1782 (insert (format-time-string named-database-time-string (current-time)))))
1784 (when (memq 'resolve-conf-generic-mode generic-extras-enable-list)
1786 (define-generic-mode resolve-conf-generic-mode
1787 ;; List of comment characters
1788 '(?#)
1789 ;; List of keywords
1790 '("nameserver" "domain" "search" "sortlist" "options")
1791 ;; List of additional font-lock-expressions
1793 ;; List of additional auto-mode-alist expressions
1794 '("/etc/resolv[e]?.conf\\'")
1795 ;; List of set up functions to call
1796 nil))
1798 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1799 ;; Modes for spice and common electrical engineering circuit netlist formats
1800 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1802 (when (memq 'spice-generic-mode generic-extras-enable-list)
1804 (define-generic-mode spice-generic-mode
1806 '("and"
1807 "cccs"
1808 "ccvs"
1809 "delay"
1810 "nand"
1811 "nor"
1812 "npwl"
1813 "or"
1814 "par"
1815 "ppwl"
1816 "pwl"
1817 "vccap"
1818 "vccs"
1819 "vcr"
1820 "vcvs")
1821 '(("^\\s-*\\([*].*\\)" 1 font-lock-comment-face)
1822 (" \\(\\$ .*\\)$" 1 font-lock-comment-face)
1823 ("^\\(\\$ .*\\)$" 1 font-lock-comment-face)
1824 ("\\([*].*\\)" 1 font-lock-comment-face)
1825 ("^\\([+]\\)" 1 font-lock-string-face)
1826 ("^\\s-*\\([.]\\w+\\>\\)" 1 font-lock-keyword-face)
1827 ("\\(\\([.]\\|_\\|\\w\\)+\\)\\s-*=" 1 font-lock-variable-name-face)
1828 ("\\('[^']+'\\)" 1 font-lock-string-face)
1829 ("\\(\"[^\"]+\"\\)" 1 font-lock-string-face))
1830 '("\\.[sS][pP]\\'"
1831 "\\.[sS][pP][iI]\\'"
1832 "\\.[sS][pP][iI][cC][eE]\\'"
1833 "\\.[iI][nN][cC]\\'")
1834 (list
1835 'generic-bracket-support
1836 ;; Make keywords case-insensitive
1837 (function
1838 (lambda()
1839 (setq font-lock-defaults '(generic-font-lock-keywords nil t)))))
1840 "Generic mode for SPICE circuit netlist files."))
1842 (when (memq 'ibis-generic-mode generic-extras-enable-list)
1844 (define-generic-mode ibis-generic-mode
1845 '(?|)
1847 '(("[[]\\([^]]*\\)[]]" 1 font-lock-keyword-face)
1848 ("\\(\\(_\\|\\w\\)+\\)\\s-*=" 1 font-lock-variable-name-face))
1849 '("\\.[iI][bB][sS]\\'")
1850 '(generic-bracket-support)
1851 "Generic mode for IBIS circuit netlist files."))
1853 (when (memq 'astap-generic-mode generic-extras-enable-list)
1855 (define-generic-mode astap-generic-mode
1857 '("analyze"
1858 "description"
1859 "elements"
1860 "execution"
1861 "features"
1862 "functions"
1863 "ground"
1864 "model"
1865 "outputs"
1866 "print"
1867 "run"
1868 "controls"
1869 "table")
1870 '(("^\\s-*\\([*].*\\)" 1 font-lock-comment-face)
1871 (";\\s-*\\([*].*\\)" 1 font-lock-comment-face)
1872 ("^\\s-*\\([.]\\w+\\>\\)" 1 font-lock-keyword-face)
1873 ("\\('[^']+'\\)" 1 font-lock-string-face)
1874 ("\\(\"[^\"]+\"\\)" 1 font-lock-string-face)
1875 ("[(,]\\s-*\\(\\([.]\\|_\\|\\w\\)+\\)\\s-*=" 1 font-lock-variable-name-face))
1876 '("\\.[aA][pP]\\'"
1877 "\\.[aA][sS][xX]\\'"
1878 "\\.[aA][sS][tT][aA][pP]\\'"
1879 "\\.[pP][sS][pP]\\'"
1880 "\\.[dD][eE][cC][kK]\\'"
1881 "\\.[gG][oO][dD][aA][tT][aA]")
1882 (list
1883 'generic-bracket-support
1884 ;; Make keywords case-insensitive
1885 (function
1886 (lambda()
1887 (setq font-lock-defaults '(generic-font-lock-keywords nil t)))))
1888 "Generic mode for ASTAP circuit netlist files."))
1890 (when (memq 'etc-modules-conf-generic-mode generic-extras-enable-list)
1892 (define-generic-mode etc-modules-conf-generic-mode
1893 ;; List of comment characters
1894 '(?#)
1895 ;; List of keywords
1896 '("above"
1897 "alias"
1898 "below"
1899 "define"
1900 "depfile"
1901 "else"
1902 "elseif"
1903 "endif"
1904 "if"
1905 "include"
1906 "insmod_opt"
1907 "install"
1908 "keep"
1909 "options"
1910 "path"
1911 "generic_stringfile"
1912 "pcimapfile"
1913 "isapnpmapfile"
1914 "usbmapfile"
1915 "parportmapfile"
1916 "ieee1394mapfile"
1917 "pnpbiosmapfile"
1918 "probe"
1919 "probeall"
1920 "prune"
1921 "post-install"
1922 "post-remove"
1923 "pre-install"
1924 "pre-remove"
1925 "remove"
1926 "persistdir")
1927 ;; List of additional font-lock-expressions
1929 ;; List of additional automode-alist expressions
1930 '("/etc/modules.conf" "/etc/conf.modules")
1931 ;; List of set up functions to call
1932 nil))
1934 (provide 'generic-x)
1936 ;;; generic-x.el ends here