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