* lisp/progmodes/octave-mod.el (octave-mark-block): Move out of tokens and
[emacs.git] / lisp / generic-x.el
blob878021ec5c501dffd56ccfb3dde21601a682b26a
1 ;;; generic-x.el --- A collection of generic modes
3 ;; Copyright (C) 1997-1998, 2001-2012 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 (defun bat-generic-mode-run-as-comint ()
553 "Run the current BAT file in a comint buffer."
554 (interactive)
555 (require 'comint)
556 (let* ((file (buffer-file-name))
557 (buf-name (concat "*" file "*")))
558 (with-current-buffer (get-buffer-create buf-name)
559 (erase-buffer)
560 (comint-mode)
561 (comint-exec
562 buf-name
563 file
564 (w32-shell-name)
566 (list "-c" file))
567 (display-buffer buf-name))))
569 (define-key bat-generic-mode-keymap "\C-c\C-c" 'bat-generic-mode-compile)
571 ;; Make underscores count as words
572 (unless bat-generic-mode-syntax-table
573 (setq bat-generic-mode-syntax-table (make-syntax-table))
574 (modify-syntax-entry ?_ "w" bat-generic-mode-syntax-table))
576 ;; bat-generic-mode doesn't use the comment functionality of
577 ;; define-generic-mode because it has a three-letter comment-string,
578 ;; so we do it here manually instead
579 (defun generic-bat-mode-setup-function ()
580 (make-local-variable 'parse-sexp-ignore-comments)
581 (make-local-variable 'comment-start)
582 (make-local-variable 'comment-start-skip)
583 (make-local-variable 'comment-end)
584 (setq imenu-generic-expression '((nil "^:\\(\\sw+\\)" 1))
585 parse-sexp-ignore-comments t
586 comment-end ""
587 comment-start "REM "
588 comment-start-skip "[Rr][Ee][Mm] *")
589 (set-syntax-table bat-generic-mode-syntax-table)
590 ;; Make keywords case-insensitive
591 (setq font-lock-defaults '(generic-font-lock-keywords nil t))
592 (use-local-map bat-generic-mode-keymap)))
594 ;;; Mailagent
595 ;; Mailagent is a Unix mail filtering program. Anyone wanna do a
596 ;; generic mode for procmail?
597 (when (memq 'mailagent-rules-generic-mode generic-extras-enable-list)
599 (define-generic-mode mailagent-rules-generic-mode
600 '(?#)
601 '("SAVE" "DELETE" "PIPE" "ANNOTATE" "REJECT")
602 '(("^\\(\\sw+\\)\\s-*=" 1 font-lock-variable-name-face)
603 ("\\s-/\\([^/]+\\)/[i, \t\n]" 1 font-lock-constant-face))
604 '("\\.rules\\'")
605 (list
606 (function
607 (lambda ()
608 (setq imenu-generic-expression
609 '((nil "\\s-/\\([^/]+\\)/[i, \t\n]" 1))))))
610 "Generic mode for Mailagent rules files."))
612 ;; Solaris/Sys V prototype files
613 (when (memq 'prototype-generic-mode generic-extras-enable-list)
615 (define-generic-mode prototype-generic-mode
616 '(?#)
618 '(("^\\([0-9]\\)?\\s-*\\([a-z]\\)\\s-+\\([A-Za-z_]+\\)\\s-+\\([^\n\r]*\\)$"
619 (2 font-lock-constant-face)
620 (3 font-lock-keyword-face))
621 ("^\\([a-z]\\) \\([A-Za-z_]+\\)=\\([^\n\r]*\\)$"
622 (1 font-lock-constant-face)
623 (2 font-lock-keyword-face)
624 (3 font-lock-variable-name-face))
625 ("^\\(!\\s-*\\(search\\|include\\|default\\)\\)\\s-*\\([^\n\r]*\\)$"
626 (1 font-lock-keyword-face)
627 (3 font-lock-variable-name-face))
628 ("^\\(!\\s-*\\sw+\\)=\\([^\n\r]*\\)$"
629 (1 font-lock-keyword-face)
630 (2 font-lock-variable-name-face)))
631 '("prototype\\'")
633 "Generic mode for Sys V prototype files."))
635 ;; Solaris/Sys V pkginfo files
636 (when (memq 'pkginfo-generic-mode generic-extras-enable-list)
638 (define-generic-mode pkginfo-generic-mode
639 '(?#)
641 '(("^\\([A-Za-z_]+\\)=\\([^\n\r]*\\)$"
642 (1 font-lock-keyword-face)
643 (2 font-lock-variable-name-face)))
644 '("pkginfo\\'")
646 "Generic mode for Sys V pkginfo files."))
648 ;; Javascript mode
649 ;; Obsolete; defer to js-mode from js.el.
650 (when (memq 'javascript-generic-mode generic-extras-enable-list)
651 (define-obsolete-function-alias 'javascript-generic-mode 'js-mode "24.3")
652 (define-obsolete-variable-alias 'javascript-generic-mode-hook 'js-mode-hook "24.3"))
654 ;; VRML files
655 (when (memq 'vrml-generic-mode generic-extras-enable-list)
657 (define-generic-mode vrml-generic-mode
658 '(?#)
659 '("DEF"
660 "NULL"
661 "USE"
662 "Viewpoint"
663 "ambientIntensity"
664 "appearance"
665 "children"
666 "color"
667 "coord"
668 "coordIndex"
669 "creaseAngle"
670 "diffuseColor"
671 "emissiveColor"
672 "fieldOfView"
673 "geometry"
674 "info"
675 "material"
676 "normal"
677 "orientation"
678 "position"
679 "shininess"
680 "specularColor"
681 "texCoord"
682 "texture"
683 "textureTransform"
684 "title"
685 "transparency"
686 "type")
687 '(("USE\\s-+\\([-A-Za-z0-9_]+\\)"
688 (1 font-lock-constant-face))
689 ("DEF\\s-+\\([-A-Za-z0-9_]+\\)\\s-+\\([A-Za-z0-9]+\\)\\s-*{"
690 (1 font-lock-type-face)
691 (2 font-lock-constant-face))
692 ("^\\s-*\\([-A-Za-z0-9_]+\\)\\s-*{"
693 (1 font-lock-function-name-face))
694 ("^\\s-*\\(geometry\\|appearance\\|material\\)\\s-+\\([-A-Za-z0-9_]+\\)"
695 (2 font-lock-variable-name-face)))
696 '("\\.wrl\\'")
697 (list
698 (function
699 (lambda ()
700 (setq imenu-generic-expression
701 '((nil "^\\([A-Za-z0-9_]+\\)\\s-*{" 1)
702 ("*Definitions*"
703 "DEF\\s-+\\([-A-Za-z0-9_]+\\)\\s-+\\([A-Za-z0-9]+\\)\\s-*{"
704 1))))))
705 "Generic Mode for VRML files."))
707 ;; Java Manifests
708 (when (memq 'java-manifest-generic-mode generic-extras-enable-list)
710 (define-generic-mode java-manifest-generic-mode
711 '(?#)
712 '("Name"
713 "Digest-Algorithms"
714 "Manifest-Version"
715 "Required-Version"
716 "Signature-Version"
717 "Magic"
718 "Java-Bean"
719 "Depends-On")
720 '(("^Name:\\s-+\\([^\n\r]*\\)$"
721 (1 font-lock-variable-name-face))
722 ("^\\(Manifest\\|Required\\|Signature\\)-Version:\\s-+\\([^\n\r]*\\)$"
723 (2 font-lock-constant-face)))
724 '("[mM][aA][nN][iI][fF][eE][sS][tT]\\.[mM][fF]\\'")
726 "Generic mode for Java Manifest files."))
728 ;; Java properties files
729 (when (memq 'java-properties-generic-mode generic-extras-enable-list)
731 (define-generic-mode java-properties-generic-mode
732 '(?! ?#)
734 (eval-when-compile
735 (let ((java-properties-key
736 "\\(\\([-A-Za-z0-9_\\./]\\|\\(\\\\[ =:]\\)\\)+\\)")
737 (java-properties-value
738 "\\([^\r\n]*\\)"))
739 ;; Property and value can be separated in a number of different ways:
740 ;; * whitespace
741 ;; * an equal sign
742 ;; * a colon
743 (mapcar
744 (function
745 (lambda (elt)
746 (list
747 (concat "^" java-properties-key elt java-properties-value "$")
748 '(1 font-lock-constant-face)
749 '(4 font-lock-variable-name-face))))
750 ;; These are the separators
751 '(":\\s-*" "\\s-+" "\\s-*=\\s-*"))))
753 (list
754 (function
755 (lambda ()
756 (setq imenu-generic-expression
757 '((nil "^\\([^#! \t\n\r=:]+\\)" 1))))))
758 "Generic mode for Java properties files."))
760 ;; C shell alias definitions
761 (when (memq 'alias-generic-mode generic-extras-enable-list)
763 (define-generic-mode alias-generic-mode
764 '(?#)
765 '("alias" "unalias")
766 '(("^alias\\s-+\\([-A-Za-z0-9_]+\\)\\s-+"
767 (1 font-lock-variable-name-face))
768 ("^unalias\\s-+\\([-A-Za-z0-9_]+\\)\\s-*$"
769 (1 font-lock-variable-name-face)))
770 '("alias\\'")
771 (list
772 (function
773 (lambda ()
774 (setq imenu-generic-expression
775 '((nil "^\\(alias\\|unalias\\)\\s-+\\([-a-zA-Z0-9_]+\\)" 2))))))
776 "Generic mode for C Shell alias files."))
778 ;;; Windows RC files
779 ;; Contributed by ACorreir@pervasive-sw.com (Alfred Correira)
780 (when (memq 'rc-generic-mode generic-extras-enable-list)
782 (define-generic-mode rc-generic-mode
783 ;; '(?\/)
784 '("//")
785 '("ACCELERATORS"
786 "AUTO3STATE"
787 "AUTOCHECKBOX"
788 "AUTORADIOBUTTON"
789 "BITMAP"
790 "BOTTOMMARGIN"
791 "BUTTON"
792 "CAPTION"
793 "CHARACTERISTICS"
794 "CHECKBOX"
795 "CLASS"
796 "COMBOBOX"
797 "CONTROL"
798 "CTEXT"
799 "CURSOR"
800 "DEFPUSHBUTTON"
801 "DESIGNINFO"
802 "DIALOG"
803 "DISCARDABLE"
804 "EDITTEXT"
805 "EXSTYLE"
806 "FONT"
807 "GROUPBOX"
808 "GUIDELINES"
809 "ICON"
810 "LANGUAGE"
811 "LEFTMARGIN"
812 "LISTBOX"
813 "LTEXT"
814 "MENUITEM SEPARATOR"
815 "MENUITEM"
816 "MENU"
817 "MOVEABLE"
818 "POPUP"
819 "PRELOAD"
820 "PURE"
821 "PUSHBOX"
822 "PUSHBUTTON"
823 "RADIOBUTTON"
824 "RCDATA"
825 "RIGHTMARGIN"
826 "RTEXT"
827 "SCROLLBAR"
828 "SEPARATOR"
829 "STATE3"
830 "STRINGTABLE"
831 "STYLE"
832 "TEXTINCLUDE"
833 "TOOLBAR"
834 "TOPMARGIN"
835 "VERSIONINFO"
836 "VERSION")
837 ;; the choice of what tokens go where is somewhat arbitrary,
838 ;; as is the choice of which value tokens are included, as
839 ;; the choice of face for each token group
840 (eval-when-compile
841 (list
842 (generic-make-keywords-list
843 '("FILEFLAGSMASK"
844 "FILEFLAGS"
845 "FILEOS"
846 "FILESUBTYPE"
847 "FILETYPE"
848 "FILEVERSION"
849 "PRODUCTVERSION")
850 font-lock-type-face)
851 (generic-make-keywords-list
852 '("BEGIN"
853 "BLOCK"
854 "END"
855 "VALUE")
856 font-lock-function-name-face)
857 '("^#[ \t]*include[ \t]+\\(<[^>\"\n]+>\\)" 1 font-lock-string-face)
858 '("^#[ \t]*define[ \t]+\\(\\sw+\\)(" 1 font-lock-function-name-face)
859 '("^#[ \t]*\\(elif\\|if\\)\\>"
860 ("\\<\\(defined\\)\\>[ \t]*(?\\(\\sw+\\)?" nil nil
861 (1 font-lock-constant-face)
862 (2 font-lock-variable-name-face nil t)))
863 '("^#[ \t]*\\(\\sw+\\)\\>[ \t]*\\(\\sw+\\)?"
864 (1 font-lock-constant-face)
865 (2 font-lock-variable-name-face nil t))))
866 '("\\.[rR][cC]\\'")
868 "Generic mode for MS-Windows Resource files."))
870 ;; InstallShield RUL files
871 ;; Contributed by Alfred.Correira@Pervasive.Com
872 ;; Bugfixes by "Rolf Sandau" <Rolf.Sandau@marconi.com>
873 (when (memq 'rul-generic-mode generic-extras-enable-list)
875 (eval-when-compile
877 ;;; build the regexp strings using regexp-opt
878 (defconst installshield-statement-keyword-list
879 '("abort"
880 "begin"
881 "call"
882 "case"
883 "declare"
884 "default"
885 "downto"
886 "elseif"
887 "else"
888 "endfor"
889 "endif"
890 "endswitch"
891 "endwhile"
892 "end"
893 "exit"
894 "external"
895 "for"
896 "function"
897 ;; "goto" -- handled elsewhere
898 "if"
899 "program"
900 "prototype"
901 "repeat"
902 "return"
903 "step"
904 "switch"
905 "then"
906 "to"
907 "typedef"
908 "until"
909 "void"
910 "while")
911 "Statement keywords used in InstallShield 3 and 5.")
913 (defconst installshield-system-functions-list
914 '("AddFolderIcon"
915 "AddProfString"
916 "AddressString"
917 "AppCommand"
918 "AskDestPath"
919 "AskOptions"
920 "AskPath"
921 "AskText"
922 "AskYesNo"
923 "BatchDeleteEx"
924 "BatchFileLoad"
925 "BatchFileSave"
926 "BatchFind"
927 "BatchGetFileName"
928 "BatchMoveEx"
929 "BatchSetFileName"
930 "ChangeDirectory"
931 "CloseFile"
932 "CmdGetHwndDlg"
933 "ComponentAddItem" ; differs between IS3 and IS5
934 "ComponentCompareSizeRequired" ; IS5 only
935 "ComponentDialog"
936 "ComponentError" ; IS5 only
937 "ComponentFileEnum" ; IS5 only
938 "ComponentFileInfo" ; IS5 only
939 "ComponentFilterLanguage" ; IS5 only
940 "ComponentFilterOS" ; IS5 only
941 "ComponentGetData" ; IS5 only
942 "ComponentGetItemInfo" ; IS3 only
943 "ComponentGetItemSize" ; differs between IS3 and IS5
944 "ComponentIsItemSelected" ; differs between IS3 and IS5
945 "ComponentListItems"
946 "ComponentMoveData" ; IS5 only
947 "ComponentSelectItem" ; differs between IS3 and IS5
948 "ComponentSetData" ; IS5 only
949 "ComponentSetItemInfo" ; IS3 only
950 "ComponentSetTarget" ; IS5 only
951 "ComponentSetupTypeEnum" ; IS5 only
952 "ComponentSetupTypeGetData" ; IS5 only
953 "ComponentSetupTypeSet" ; IS5 only
954 "ComponentTotalSize"
955 "ComponentValidate" ; IS5 only
956 "CompressAdd" ; IS3 only
957 "CompressDel" ; IS3 only
958 "CompressEnum" ; IS3 only
959 "CompressGet" ; IS3 only
960 "CompressInfo" ; IS3 only
961 "CopyFile"
962 "CreateDir"
963 "CreateFile"
964 "CreateProgramFolder"
965 "DeinstallSetReference" ; IS5 only
966 "DeinstallStart"
967 "Delay"
968 "DeleteDir"
969 "DeleteFile"
970 "DialogSetInfo"
971 "Disable"
972 "DoInstall"
973 "Do"
974 "Enable"
975 "EnterDisk"
976 "ExistsDir"
977 "ExistsDisk"
978 "ExitProgMan"
979 "EzBatchAddPath"
980 "EzBatchAddString"
981 "EzBatchReplace"
982 "EzConfigAddDriver"
983 "EzConfigAddString"
984 "EzConfigGetValue"
985 "EzConfigSetValue"
986 "EzDefineDialog"
987 "FileCompare"
988 "FileDeleteLine"
989 "FileGrep"
990 "FileInsertLine"
991 "FileSetBeginDefine" ; IS3 only
992 "FileSetEndDefine" ; IS3 only
993 "FileSetPerformEz" ; IS3 only
994 "FileSetPerform" ; IS3 only
995 "FileSetReset" ; IS3 only
996 "FileSetRoot" ; IS3 only
997 "FindAllDirs"
998 "FindAllFiles"
999 "FindFile"
1000 "FindWindow"
1001 "GetDiskSpace"
1002 "GetDisk"
1003 "GetEnvVar"
1004 "GetExtents"
1005 "GetFileInfo"
1006 "GetLine"
1007 "GetProfInt"
1008 "GetProfString"
1009 "GetSystemInfo"
1010 "GetValidDrivesList"
1011 "GetVersion"
1012 "GetWindowHandle"
1013 "InstallationInfo"
1014 "Is"
1015 "LaunchApp"
1016 "LaunchAppAndWait"
1017 "ListAddItem"
1018 "ListAddString"
1019 "ListCount"
1020 "ListCreate"
1021 "ListDestroy"
1022 "ListFindItem"
1023 "ListFindString"
1024 "ListGetFirstItem"
1025 "ListGetFirstString"
1026 "ListGetNextItem"
1027 "ListGetNextString"
1028 "ListReadFromFile"
1029 "ListSetCurrentItem"
1030 "ListSetNextItem"
1031 "ListSetNextString"
1032 "ListSetIndex"
1033 "ListWriteToFile"
1034 "LongPathToQuote"
1035 "LongPathToShortPath"
1036 "MessageBox"
1037 "NumToStr"
1038 "OpenFileMode"
1039 "OpenFile"
1040 "ParsePath"
1041 "PathAdd"
1042 "PathDelete"
1043 "PathFind"
1044 "PathGet"
1045 "PathMove"
1046 "PathSet"
1047 "Path"
1048 "PlaceBitmap"
1049 "PlaceWindow"
1050 "PlayMMedia" ; IS5 only
1051 "ProgDefGroupType"
1052 "RegDBCreateKeyEx"
1053 "RegDBDeleteValue"
1054 "RegDBGetItem"
1055 "RegDBKeyExist"
1056 "RegDBSetItem"
1057 "RegDBGetKeyValueEx"
1058 "RegDBSetKeyValueEx"
1059 "RegDBSetDefaultRoot"
1060 "RenameFile"
1061 "ReplaceFolderIcon"
1062 "ReplaceProfString"
1063 "SdAskDestPath"
1064 "SdAskOptions"
1065 "SdAskOptionsList"
1066 "SdBitmap"
1067 "SdCloseDlg"
1068 "SdComponentAdvCheckSpace"
1069 "SdComponentAdvInit"
1070 "SdComponentAdvUpdateSpace"
1071 "SdComponentDialog"
1072 "SdComponentDialog2"
1073 "SdComponentDialogAdv"
1074 "SdComponentDialogEx"
1075 "SdComponentDlgCheckSpace"
1076 "SdComponentMult"
1077 "SdConfirmNewDir"
1078 "SdConfirmRegistration"
1079 "SdDiskSpace"
1080 "SdDisplayTopics"
1081 "SdDoStdButton"
1082 "SdEnablement"
1083 "SdError"
1084 "SdFinish"
1085 "SdFinishInit32"
1086 "SdFinishReboot"
1087 "SdGeneralInit"
1088 "SdGetItemName"
1089 "SdGetTextExtent"
1090 "SdGetUserCompanyInfo"
1091 "SdInit"
1092 "SdIsShellExplorer"
1093 "SdIsStdButton"
1094 "SdLicense"
1095 "SdMakeName"
1096 "SdOptionInit"
1097 "SdOptionSetState"
1098 "SdOptionsButtons"
1099 "SdOptionsButtonsInit"
1100 "SdPlugInProductName"
1101 "SdProductName"
1102 "SdRegEnableButton"
1103 "SdRegExEnableButton"
1104 "SdRegisterUser"
1105 "SdRegisterUserEx"
1106 "SdRemoveEndSpace"
1107 "SdSelectFolder"
1108 "SdSetSequentialItems"
1109 "SdSetStatic"
1110 "SdSetupTypeEx" ; IS5 only
1111 "SdSetupType"
1112 "SdShowAnyDialog"
1113 "SdShowDlgEdit1"
1114 "SdShowDlgEdit2"
1115 "SdShowDlgEdit3"
1116 "SdShowFileMods"
1117 "SdShowInfoList"
1118 "SdShowMsg"
1119 "SdStartCopy"
1120 "SdUnInit"
1121 "SdUpdateComponentSelection"
1122 "SdWelcome"
1123 "SendMessage"
1124 "SetColor"
1125 "SetFont"
1126 "SetDialogTitle"
1127 "SetDisplayEffect" ; IS5 only
1128 "SetFileInfo"
1129 "SetForegroundWindow"
1130 "SetStatusWindow"
1131 "SetTitle"
1132 "SetupType"
1133 "ShowProgramFolder"
1134 "Split" ; IS3 only
1135 "SprintfBox"
1136 "Sprintf"
1137 "StatusUpdate"
1138 "StrCompare"
1139 "StrFind"
1140 "StrGetTokens"
1141 "StrLength"
1142 "StrRemoveLastSlash"
1143 "StrToLower"
1144 "StrToNum"
1145 "StrToUpper"
1146 "StrSub"
1147 "VarRestore"
1148 "VarSave"
1149 "VerCompare"
1150 "VerGetFileVersion"
1151 "WaitOnDialog"
1152 "Welcome"
1153 "WriteLine"
1154 "WriteProfString"
1155 "XCopyFile")
1156 "System functions defined in InstallShield 3 and 5.")
1158 (defconst installshield-system-variables-list
1159 '("BATCH_INSTALL"
1160 "CMDLINE"
1161 "COMMONFILES"
1162 "CORECOMPONENTHANDLING"
1163 "DIALOGCACHE"
1164 "ERRORFILENAME"
1165 "FOLDER_DESKTOP"
1166 "FOLDER_PROGRAMS"
1167 "FOLDER_STARTMENU"
1168 "FOLDER_STARTUP"
1169 "INFOFILENAME"
1170 "ISRES"
1171 "ISUSER"
1172 "ISVERSION"
1173 "MEDIA"
1174 "MODE"
1175 "PROGRAMFILES"
1176 "SELECTED_LANGUAGE"
1177 "SRCDIR"
1178 "SRCDISK"
1179 "SUPPORTDIR"
1180 "TARGETDIR"
1181 "TARGETDISK"
1182 "UNINST"
1183 "WINDIR"
1184 "WINDISK"
1185 "WINMAJOR"
1186 "WINSYSDIR"
1187 "WINSYSDISK")
1188 "System variables used in InstallShield 3 and 5.")
1190 (defconst installshield-types-list
1191 '("BOOL"
1192 "BYREF"
1193 "CHAR"
1194 "HIWORD"
1195 "HWND"
1196 "INT"
1197 "LIST"
1198 "LONG"
1199 "LOWORD"
1200 "LPSTR"
1201 "NUMBER"
1202 "NUMBERLIST"
1203 "POINTER"
1204 "QUAD"
1205 "RGB"
1206 "SHORT"
1207 "STRINGLIST"
1208 "STRING")
1209 "Type keywords used in InstallShield 3 and 5.")
1211 ;;; some might want to skip highlighting these to improve performance
1212 (defconst installshield-funarg-constants-list
1213 '("AFTER"
1214 "APPEND"
1215 "ALLCONTENTS"
1216 "BACKBUTTON"
1217 "BACKGROUNDCAPTION"
1218 "BACKGROUND"
1219 "BACK"
1220 "BASEMEMORY"
1221 "BEFORE"
1222 "BIOS"
1223 "BITMAPICON"
1224 "BK_BLUE"
1225 "BK_GREEN"
1226 "BK_RED"
1227 "BLUE"
1228 "BOOTUPDRIVE"
1229 "CANCEL"
1230 "CDROM_DRIVE"
1231 "CDROM"
1232 "CHECKBOX95"
1233 "CHECKBOX"
1234 "CHECKLINE"
1235 "CHECKMARK"
1236 "COLORS"
1237 "COMMANDEX"
1238 "COMMAND"
1239 "COMP_NORMAL"
1240 "COMP_UPDATE_DATE"
1241 "COMP_UPDATE_SAME"
1242 "COMP_UPDATE_VERSION"
1243 "COMPACT"
1244 "CONTINUE"
1245 "CPU"
1246 "CUSTOM"
1247 "DATE"
1248 "DEFWINDOWMODE"
1249 "DIR_WRITEABLE"
1250 "DIRECTORY"
1251 "DISABLE"
1252 "DISK_TOTALSPACE"
1253 "DISK"
1254 "DLG_OPTIONS"
1255 "DLG_PATH"
1256 "DLG_TEXT"
1257 "DLG_ASK_YESNO"
1258 "DLG_ENTER_DISK"
1259 "DLG_ERR"
1260 "DLG_INFO_ALTIMAGE"
1261 "DLG_INFO_CHECKSELECTION"
1262 "DLG_INFO_KUNITS"
1263 "DLG_INFO_USEDECIMAL"
1264 "DLG_MSG_INFORMATION"
1265 "DLG_MSG_SEVERE"
1266 "DLG_MSG_WARNING"
1267 "DLG_STATUS"
1268 "DLG_WARNING"
1269 "DLG_USER_CAPTION"
1270 "DRIVE"
1271 "ENABLE"
1272 "END_OF_FILE"
1273 "END_OF_LIST"
1274 "ENVSPACE"
1275 "EQUALS"
1276 "EXCLUDE_SUBDIR"
1277 "EXCLUSIVE"
1278 "EXISTS"
1279 "EXIT"
1280 "EXTENDED_MEMORY"
1281 "EXTENSION_ONLY"
1282 "FAILIFEXISTS"
1283 "FALSE"
1284 "FEEDBACK_FULL"
1285 "FILE_ATTR_ARCHIVED"
1286 "FILE_ATTR_DIRECTORY"
1287 "FILE_ATTR_HIDDEN"
1288 "FILE_ATTR_NORMAL"
1289 "FILE_ATTR_READONLY"
1290 "FILE_ATTR_SYSTEM"
1291 "FILE_ATTRIBUTE"
1292 "FILE_DATE"
1293 "FILE_LINE_LENGTH"
1294 "FILE_MODE_APPEND"
1295 "FILE_MODE_BINARYREADONLY"
1296 "FILE_MODE_BINARY"
1297 "FILE_MODE_NORMAL"
1298 "FILE_NO_VERSION"
1299 "FILE_NOT_FOUND"
1300 "FILE_SIZE"
1301 "FILE_TIME"
1302 "FILENAME_ONLY"
1303 "FILENAME"
1304 "FIXED_DRIVE"
1305 "FOLDER_DESKTOP"
1306 "FOLDER_PROGRAMS"
1307 "FOLDER_STARTMENU"
1308 "FOLDER_STARTUP"
1309 "FREEENVSPACE"
1310 "FULLWINDOWMODE"
1311 "FULL"
1312 "FONT_TITLE"
1313 "GREATER_THAN"
1314 "GREEN"
1315 "HKEY_CLASSES_ROOT"
1316 "HKEY_CURRENT_USER"
1317 "HKEY_LOCAL_MACHINE"
1318 "HKEY_USERS"
1319 "HOURGLASS"
1320 "INCLUDE_SUBDIR"
1321 "INDVFILESTATUS"
1322 "INFORMATION"
1323 "IS_WINDOWSNT"
1324 "IS_WINDOWS95"
1325 "IS_WINDOWS"
1326 "IS_WIN32S"
1327 "ISTYPE"
1328 "LANGUAGE_DRV"
1329 "LANGUAGE"
1330 "LESS_THAN"
1331 "LIST_NULL"
1332 "LISTFIRST"
1333 "LISTNEXT"
1334 "LOCKEDFILE"
1335 "LOGGING"
1336 "LOWER_LEFT"
1337 "LOWER_RIGHT"
1338 "MAGENTA"
1339 "MOUSE_DRV"
1340 "MOUSE"
1341 "NETWORK_DRV"
1342 "NETWORK"
1343 "NEXT"
1344 "NONEXCLUSIVE"
1345 "NORMALMODE"
1346 "NOSET"
1347 "NOTEXISTS"
1348 "NOWAIT"
1349 "NO"
1350 "OFF"
1351 "ONLYDIR"
1352 "ON"
1353 "OSMAJOR"
1354 "OSMINOR"
1355 "OS"
1356 "OTHER_FAILURE"
1357 "PARALLEL"
1358 "PARTIAL"
1359 "PATH_EXISTS"
1360 "PATH"
1361 "RED"
1362 "REGDB_APPPATH_DEFAULT"
1363 "REGDB_APPPATH"
1364 "REGDB_BINARY"
1365 "REGDB_ERR_CONNECTIONEXISTS"
1366 "REGDB_ERR_CORRUPTEDREGISTRY"
1367 "REGDB_ERR_INITIALIZATION"
1368 "REGDB_ERR_INVALIDHANDLE"
1369 "REGDB_ERR_INVALIDNAME"
1370 "REGDB_NUMBER"
1371 "REGDB_STRING_EXPAND"
1372 "REGDB_STRING_MULTI"
1373 "REGDB_STRING"
1374 "REGDB_UNINSTALL_NAME"
1375 "REMOTE_DRIVE"
1376 "REMOVEABLE_DRIVE"
1377 "REPLACE_ITEM"
1378 "REPLACE"
1379 "RESET"
1380 "RESTART"
1381 "ROOT"
1382 "SELFREGISTER"
1383 "SERIAL"
1384 "SET"
1385 "SEVERE"
1386 "SHAREDFILE"
1387 "SHARE"
1388 "SILENTMODE"
1389 "SRCTARGETDIR"
1390 "STATUSBAR"
1391 "STATUSDLG"
1392 "STATUSOLD"
1393 "STATUS"
1394 "STYLE_NORMAL"
1395 "SW_MAXIMIZE"
1396 "SW_MINIMIZE"
1397 "SW_RESTORE"
1398 "SW_SHOW"
1399 "SYS_BOOTMACHINE"
1400 "TIME"
1401 "TRUE"
1402 "TYPICAL"
1403 "UPPER_LEFT"
1404 "UPPER_RIGHT"
1405 "VALID_PATH"
1406 "VERSION"
1407 "VIDEO"
1408 "VOLUMELABEL"
1409 "YELLOW"
1410 "YES"
1411 "WAIT"
1412 "WARNING"
1413 "WINMAJOR"
1414 "WINMINOR"
1415 "WIN32SINSTALLED"
1416 "WIN32SMAJOR"
1417 "WIN32SMINOR")
1418 "Function argument constants used in InstallShield 3 and 5."))
1420 (defvar rul-generic-mode-syntax-table nil
1421 "Syntax table to use in `rul-generic-mode' buffers.")
1423 (setq rul-generic-mode-syntax-table
1424 (make-syntax-table c++-mode-syntax-table))
1426 (modify-syntax-entry ?\r "> b" rul-generic-mode-syntax-table)
1427 (modify-syntax-entry ?\n "> b" rul-generic-mode-syntax-table)
1429 (modify-syntax-entry ?/ ". 124b" rul-generic-mode-syntax-table)
1430 (modify-syntax-entry ?* ". 23" rul-generic-mode-syntax-table)
1432 ;; here manually instead
1433 (defun generic-rul-mode-setup-function ()
1434 (make-local-variable 'parse-sexp-ignore-comments)
1435 (make-local-variable 'comment-start)
1436 (make-local-variable 'comment-start-skip)
1437 (make-local-variable 'comment-end)
1438 (setq imenu-generic-expression
1439 '((nil "^function\\s-+\\([A-Za-z0-9_]+\\)" 1))
1440 parse-sexp-ignore-comments t
1441 comment-end "*/"
1442 comment-start "/*"
1443 ;;; comment-end ""
1444 ;;; comment-start "//"
1445 ;;; comment-start-skip ""
1447 ;; (set-syntax-table rul-generic-mode-syntax-table)
1448 (setq font-lock-syntax-table rul-generic-mode-syntax-table))
1450 ;; moved mode-definition behind defun-definition to be warning-free - 15.11.02/RSan
1451 (define-generic-mode rul-generic-mode
1452 ;; Using "/*" and "*/" doesn't seem to be working right
1453 '("//" ("/*" . "*/" ))
1454 (eval-when-compile installshield-statement-keyword-list)
1455 (eval-when-compile
1456 (list
1457 ;; preprocessor constructs
1458 '("#[ \t]*include[ \t]+\\(<[^>\"\n]+>\\)"
1459 1 font-lock-string-face)
1460 '("#[ \t]*\\(\\sw+\\)\\>[ \t]*\\(\\sw+\\)?"
1461 (1 font-lock-constant-face)
1462 (2 font-lock-variable-name-face nil t))
1463 ;; indirect string constants
1464 '("\\(@[A-Za-z][A-Za-z0-9_]+\\)" 1 font-lock-builtin-face)
1465 ;; gotos
1466 '("[ \t]*\\(\\sw+:\\)" 1 font-lock-constant-face)
1467 '("\\<\\(goto\\)\\>[ \t]*\\(\\sw+\\)?"
1468 (1 font-lock-keyword-face)
1469 (2 font-lock-constant-face nil t))
1470 ;; system variables
1471 (generic-make-keywords-list
1472 installshield-system-variables-list
1473 font-lock-variable-name-face "[^_]" "[^_]")
1474 ;; system functions
1475 (generic-make-keywords-list
1476 installshield-system-functions-list
1477 font-lock-function-name-face "[^_]" "[^_]")
1478 ;; type keywords
1479 (generic-make-keywords-list
1480 installshield-types-list
1481 font-lock-type-face "[^_]" "[^_]")
1482 ;; function argument constants
1483 (generic-make-keywords-list
1484 installshield-funarg-constants-list
1485 font-lock-variable-name-face "[^_]" "[^_]"))) ; is this face the best choice?
1486 '("\\.[rR][uU][lL]\\'")
1487 '(generic-rul-mode-setup-function)
1488 "Generic mode for InstallShield RUL files.")
1490 (define-skeleton rul-if
1491 "Insert an if statement."
1492 "condition: "
1493 "if(" str ") then" \n
1494 > _ \n
1495 ( "other condition, %s: "
1496 > "elseif(" str ") then" \n
1497 > \n)
1498 > "else" \n
1499 > \n
1500 resume:
1501 > "endif;")
1503 (define-skeleton rul-function
1504 "Insert a function statement."
1505 "function: "
1506 "function " str " ()" \n
1507 ( "local variables, %s: "
1508 > " " str ";" \n)
1509 > "begin" \n
1510 > _ \n
1511 resume:
1512 > "end;"))
1514 ;; Additions by ACorreir@pervasive-sw.com (Alfred Correira)
1515 (when (memq 'mailrc-generic-mode generic-extras-enable-list)
1517 (define-generic-mode mailrc-generic-mode
1518 '(?#)
1519 '("alias"
1520 "else"
1521 "endif"
1522 "group"
1523 "if"
1524 "ignore"
1525 "set"
1526 "source"
1527 "unset")
1528 '(("^\\s-*\\(alias\\|group\\)\\s-+\\([-A-Za-z0-9_]+\\)\\s-+\\([^\n\r#]*\\)\\(#.*\\)?$"
1529 (2 font-lock-constant-face)
1530 (3 font-lock-variable-name-face))
1531 ("^\\s-*\\(unset\\|set\\|ignore\\)\\s-+\\([-A-Za-z0-9_]+\\)=?\\([^\n\r#]*\\)\\(#.*\\)?$"
1532 (2 font-lock-constant-face)
1533 (3 font-lock-variable-name-face))
1534 ("^\\s-*\\(source\\)\\s-+\\([^\n\r#]*\\)\\(#.*\\)?$"
1535 (2 font-lock-variable-name-face)))
1536 '("\\.mailrc\\'")
1538 "Mode for mailrc files."))
1540 ;; Inetd.conf
1541 (when (memq 'inetd-conf-generic-mode generic-extras-enable-list)
1543 (define-generic-mode inetd-conf-generic-mode
1544 '(?#)
1545 '("stream"
1546 "dgram"
1547 "tcp"
1548 "udp"
1549 "wait"
1550 "nowait"
1551 "internal")
1552 '(("^\\([-A-Za-z0-9_]+\\)" 1 font-lock-type-face))
1553 '("/etc/inetd.conf\\'")
1554 (list
1555 (function
1556 (lambda ()
1557 (setq imenu-generic-expression
1558 '((nil "^\\([-A-Za-z0-9_]+\\)" 1))))))))
1560 ;; Services
1561 (when (memq 'etc-services-generic-mode generic-extras-enable-list)
1563 (define-generic-mode etc-services-generic-mode
1564 '(?#)
1565 '("tcp"
1566 "udp"
1567 "ddp")
1568 '(("^\\([-A-Za-z0-9_]+\\)\\s-+\\([0-9]+\\)/"
1569 (1 font-lock-type-face)
1570 (2 font-lock-variable-name-face)))
1571 '("/etc/services\\'")
1572 (list
1573 (function
1574 (lambda ()
1575 (setq imenu-generic-expression
1576 '((nil "^\\([-A-Za-z0-9_]+\\)" 1))))))))
1578 ;; Password and Group files
1579 (when (memq 'etc-passwd-generic-mode generic-extras-enable-list)
1581 (define-generic-mode etc-passwd-generic-mode
1582 nil ;; No comment characters
1583 '("root") ;; Only one keyword
1584 (eval-when-compile
1585 (list
1586 (list
1587 (concat
1589 ;; User name -- Never blank!
1590 "\\([^:]+\\)"
1592 ;; Password, UID and GID
1593 (mapconcat
1594 'identity
1595 (make-list 3 "\\([^:]+\\)")
1596 ":")
1598 ;; GECOS/Name -- might be blank
1599 "\\([^:]*\\)"
1601 ;; Home directory and shell
1602 "\\([^:]+\\)"
1603 ":?"
1604 "\\([^:]*\\)"
1605 "$")
1606 '(1 font-lock-type-face)
1607 '(5 font-lock-variable-name-face)
1608 '(6 font-lock-constant-face)
1609 '(7 font-lock-warning-face))
1610 '("^\\([^:]+\\):\\([^:]*\\):\\([0-9]+\\):\\(.*\\)$"
1611 (1 font-lock-type-face)
1612 (4 font-lock-variable-name-face))))
1613 '("/etc/passwd\\'" "/etc/group\\'")
1614 (list
1615 (function
1616 (lambda ()
1617 (setq imenu-generic-expression
1618 '((nil "^\\([-A-Za-z0-9_]+\\):" 1))))))))
1620 ;; Fstab
1621 (when (memq 'etc-fstab-generic-mode generic-extras-enable-list)
1623 (define-generic-mode etc-fstab-generic-mode
1624 '(?#)
1625 '("adfs"
1626 "affs"
1627 "autofs"
1628 "coda"
1629 "coherent"
1630 "cramfs"
1631 "devpts"
1632 "efs"
1633 "ext2"
1634 "ext3"
1635 "ext4"
1636 "hfs"
1637 "hpfs"
1638 "iso9660"
1639 "jfs"
1640 "minix"
1641 "msdos"
1642 "ncpfs"
1643 "nfs"
1644 "ntfs"
1645 "proc"
1646 "qnx4"
1647 "reiserfs"
1648 "romfs"
1649 "smbfs"
1650 "cifs"
1651 "usbdevfs"
1652 "sysv"
1653 "sysfs"
1654 "tmpfs"
1655 "udf"
1656 "ufs"
1657 "umsdos"
1658 "vfat"
1659 "xenix"
1660 "xfs"
1661 "swap"
1662 "auto"
1663 "ignore")
1664 '(("^\\([^# \t]+\\)\\s-+\\([^# \t]+\\)"
1665 (1 font-lock-type-face t)
1666 (2 font-lock-variable-name-face t)))
1667 '("/etc/[v]*fstab\\'")
1668 (list
1669 (function
1670 (lambda ()
1671 (setq imenu-generic-expression
1672 '((nil "^\\([^# \t]+\\)\\s-+" 1))))))))
1674 ;; /etc/sudoers
1675 (when (memq 'etc-sudoers-generic-mode generic-extras-enable-list)
1677 (define-generic-mode etc-sudoers-generic-mode
1678 '(?#)
1679 '("User_Alias" "Runas_Alias" "Host_Alias" "Cmnd_Alias"
1680 "NOPASSWD" "PASSWD" "NOEXEC" "EXEC"
1681 "ALL")
1682 '(("\\<\\(root\\|su\\)\\>" 1 font-lock-warning-face)
1683 ("\\(\\*\\)" 1 font-lock-warning-face)
1684 ("\\<\\(%[A-Za-z0-9_]+\\)\\>" 1 font-lock-variable-name-face))
1685 '("/etc/sudoers\\'")
1687 "Generic mode for sudoers configuration files."))
1689 ;; From Jacques Duthen <jacques.duthen@sncf.fr>
1690 (when (memq 'show-tabs-generic-mode generic-extras-enable-list)
1692 (eval-when-compile
1694 (defconst show-tabs-generic-mode-font-lock-defaults-1
1695 '(;; trailing spaces must come before...
1696 ("[ \t]+$" . 'show-tabs-space)
1697 ;; ...embedded tabs
1698 ("[^\n\t]\\(\t+\\)" (1 'show-tabs-tab))))
1700 (defconst show-tabs-generic-mode-font-lock-defaults-2
1701 '(;; trailing spaces must come before...
1702 ("[ \t]+$" . 'show-tabs-space)
1703 ;; ...tabs
1704 ("\t+" . 'show-tabs-tab))))
1706 (defface show-tabs-tab
1707 '((((class grayscale) (background light)) (:background "DimGray" :weight bold))
1708 (((class grayscale) (background dark)) (:background "LightGray" :weight bold))
1709 (((class color) (min-colors 88)) (:background "red1"))
1710 (((class color)) (:background "red"))
1711 (t (:weight bold)))
1712 "Font Lock mode face used to highlight TABs."
1713 :group 'generic-x)
1714 (define-obsolete-face-alias 'show-tabs-tab-face 'show-tabs-tab "22.1")
1716 (defface show-tabs-space
1717 '((((class grayscale) (background light)) (:background "DimGray" :weight bold))
1718 (((class grayscale) (background dark)) (:background "LightGray" :weight bold))
1719 (((class color) (min-colors 88)) (:background "yellow1"))
1720 (((class color)) (:background "yellow"))
1721 (t (:weight bold)))
1722 "Font Lock mode face used to highlight spaces."
1723 :group 'generic-x)
1724 (define-obsolete-face-alias 'show-tabs-space-face 'show-tabs-space "22.1")
1726 (define-generic-mode show-tabs-generic-mode
1727 nil ;; no comment char
1728 nil ;; no keywords
1729 (eval-when-compile show-tabs-generic-mode-font-lock-defaults-1)
1730 nil ;; no auto-mode-alist
1731 ;; '(show-tabs-generic-mode-hook-fun)
1733 "Generic mode to show tabs and trailing spaces."))
1735 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1736 ;; DNS modes
1737 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1739 (when (memq 'named-boot-generic-mode generic-extras-enable-list)
1741 (define-generic-mode named-boot-generic-mode
1742 ;; List of comment characters
1743 '(?\;)
1744 ;; List of keywords
1745 '("cache" "primary" "secondary" "forwarders" "limit" "options"
1746 "directory" "check-names")
1747 ;; List of additional font-lock-expressions
1748 '(("\\([0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+\\)" 1 font-lock-constant-face)
1749 ("^directory\\s-+\\(.*\\)" 1 font-lock-variable-name-face)
1750 ("^\\(primary\\|cache\\)\\s-+\\([.A-Za-z]+\\)\\s-+\\(.*\\)"
1751 (2 font-lock-variable-name-face)
1752 (3 font-lock-constant-face)))
1753 ;; List of additional automode-alist expressions
1754 '("/etc/named.boot\\'")
1755 ;; List of set up functions to call
1756 nil))
1758 (when (memq 'named-database-generic-mode generic-extras-enable-list)
1760 (define-generic-mode named-database-generic-mode
1761 ;; List of comment characters
1762 '(?\;)
1763 ;; List of keywords
1764 '("IN" "NS" "CNAME" "SOA" "PTR" "MX" "A")
1765 ;; List of additional font-lock-expressions
1766 '(("\\([0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+\\)" 1 font-lock-constant-face)
1767 ("^\\([.A-Za-z0-9]+\\)" 1 font-lock-variable-name-face))
1768 ;; List of additional auto-mode-alist expressions
1770 ;; List of set up functions to call
1771 nil)
1773 (defvar named-database-time-string "%Y%m%d%H"
1774 "Timestring for named serial numbers.")
1776 (defun named-database-print-serial ()
1777 "Print a serial number based on the current date."
1778 (interactive)
1779 (insert (format-time-string named-database-time-string (current-time)))))
1781 (when (memq 'resolve-conf-generic-mode generic-extras-enable-list)
1783 (define-generic-mode resolve-conf-generic-mode
1784 ;; List of comment characters
1785 '(?#)
1786 ;; List of keywords
1787 '("nameserver" "domain" "search" "sortlist" "options")
1788 ;; List of additional font-lock-expressions
1790 ;; List of additional auto-mode-alist expressions
1791 '("/etc/resolv[e]?.conf\\'")
1792 ;; List of set up functions to call
1793 nil))
1795 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1796 ;; Modes for spice and common electrical engineering circuit netlist formats
1797 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1799 (when (memq 'spice-generic-mode generic-extras-enable-list)
1801 (define-generic-mode spice-generic-mode
1803 '("and"
1804 "cccs"
1805 "ccvs"
1806 "delay"
1807 "nand"
1808 "nor"
1809 "npwl"
1810 "or"
1811 "par"
1812 "ppwl"
1813 "pwl"
1814 "vccap"
1815 "vccs"
1816 "vcr"
1817 "vcvs")
1818 '(("^\\s-*\\([*].*\\)" 1 font-lock-comment-face)
1819 (" \\(\\$ .*\\)$" 1 font-lock-comment-face)
1820 ("^\\(\\$ .*\\)$" 1 font-lock-comment-face)
1821 ("\\([*].*\\)" 1 font-lock-comment-face)
1822 ("^\\([+]\\)" 1 font-lock-string-face)
1823 ("^\\s-*\\([.]\\w+\\>\\)" 1 font-lock-keyword-face)
1824 ("\\(\\([.]\\|_\\|\\w\\)+\\)\\s-*=" 1 font-lock-variable-name-face)
1825 ("\\('[^']+'\\)" 1 font-lock-string-face)
1826 ("\\(\"[^\"]+\"\\)" 1 font-lock-string-face))
1827 '("\\.[sS][pP]\\'"
1828 "\\.[sS][pP][iI]\\'"
1829 "\\.[sS][pP][iI][cC][eE]\\'"
1830 "\\.[iI][nN][cC]\\'")
1831 (list
1832 'generic-bracket-support
1833 ;; Make keywords case-insensitive
1834 (function
1835 (lambda()
1836 (setq font-lock-defaults '(generic-font-lock-keywords nil t)))))
1837 "Generic mode for SPICE circuit netlist files."))
1839 (when (memq 'ibis-generic-mode generic-extras-enable-list)
1841 (define-generic-mode ibis-generic-mode
1842 '(?|)
1844 '(("[[]\\([^]]*\\)[]]" 1 font-lock-keyword-face)
1845 ("\\(\\(_\\|\\w\\)+\\)\\s-*=" 1 font-lock-variable-name-face))
1846 '("\\.[iI][bB][sS]\\'")
1847 '(generic-bracket-support)
1848 "Generic mode for IBIS circuit netlist files."))
1850 (when (memq 'astap-generic-mode generic-extras-enable-list)
1852 (define-generic-mode astap-generic-mode
1854 '("analyze"
1855 "description"
1856 "elements"
1857 "execution"
1858 "features"
1859 "functions"
1860 "ground"
1861 "model"
1862 "outputs"
1863 "print"
1864 "run"
1865 "controls"
1866 "table")
1867 '(("^\\s-*\\([*].*\\)" 1 font-lock-comment-face)
1868 (";\\s-*\\([*].*\\)" 1 font-lock-comment-face)
1869 ("^\\s-*\\([.]\\w+\\>\\)" 1 font-lock-keyword-face)
1870 ("\\('[^']+'\\)" 1 font-lock-string-face)
1871 ("\\(\"[^\"]+\"\\)" 1 font-lock-string-face)
1872 ("[(,]\\s-*\\(\\([.]\\|_\\|\\w\\)+\\)\\s-*=" 1 font-lock-variable-name-face))
1873 '("\\.[aA][pP]\\'"
1874 "\\.[aA][sS][xX]\\'"
1875 "\\.[aA][sS][tT][aA][pP]\\'"
1876 "\\.[pP][sS][pP]\\'"
1877 "\\.[dD][eE][cC][kK]\\'"
1878 "\\.[gG][oO][dD][aA][tT][aA]")
1879 (list
1880 'generic-bracket-support
1881 ;; Make keywords case-insensitive
1882 (function
1883 (lambda()
1884 (setq font-lock-defaults '(generic-font-lock-keywords nil t)))))
1885 "Generic mode for ASTAP circuit netlist files."))
1887 (when (memq 'etc-modules-conf-generic-mode generic-extras-enable-list)
1889 (define-generic-mode etc-modules-conf-generic-mode
1890 ;; List of comment characters
1891 '(?#)
1892 ;; List of keywords
1893 '("above"
1894 "alias"
1895 "below"
1896 "define"
1897 "depfile"
1898 "else"
1899 "elseif"
1900 "endif"
1901 "if"
1902 "include"
1903 "insmod_opt"
1904 "install"
1905 "keep"
1906 "options"
1907 "path"
1908 "generic_stringfile"
1909 "pcimapfile"
1910 "isapnpmapfile"
1911 "usbmapfile"
1912 "parportmapfile"
1913 "ieee1394mapfile"
1914 "pnpbiosmapfile"
1915 "probe"
1916 "probeall"
1917 "prune"
1918 "post-install"
1919 "post-remove"
1920 "pre-install"
1921 "pre-remove"
1922 "remove"
1923 "persistdir")
1924 ;; List of additional font-lock-expressions
1926 ;; List of additional automode-alist expressions
1927 '("/etc/modules.conf" "/etc/conf.modules")
1928 ;; List of set up functions to call
1929 nil))
1931 (provide 'generic-x)
1933 ;;; generic-x.el ends here