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