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