aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLute Kamstra2005-03-21 17:10:57 +0000
committerLute Kamstra2005-03-21 17:10:57 +0000
commitd86771563f6f960b0950a8be9751baca9fb73c6b (patch)
tree0838847411880ef7e6b49c28c0b1ace8a39e6def
parentea67f0cee4c6513c5366fb395efa6bd381a62a4a (diff)
downloademacs-d86771563f6f960b0950a8be9751baca9fb73c6b.tar.gz
emacs-d86771563f6f960b0950a8be9751baca9fb73c6b.zip
Don't prevent compilation. Don't require generic.
Follow coding conventions. Minor code cleanup. (etc-fstab-generic-mode): Add some keywords.
-rw-r--r--lisp/generic-x.el1459
1 files changed, 683 insertions, 776 deletions
diff --git a/lisp/generic-x.el b/lisp/generic-x.el
index 88703af799f..94f41c96e22 100644
--- a/lisp/generic-x.el
+++ b/lisp/generic-x.el
@@ -1,6 +1,6 @@
1;;; generic-x.el --- Extra Modes for generic-mode -*- no-byte-compile: t -*- 1;;; generic-x.el --- Extra Modes for generic-mode
2 2
3;; Copyright (C) 1997, 1998, 2003 Free Software Foundation, Inc. 3;; Copyright (C) 1997, 1998, 2003, 2005 Free Software Foundation, Inc.
4 4
5;; Author: Peter Breton <pbreton@cs.umb.edu> 5;; Author: Peter Breton <pbreton@cs.umb.edu>
6;; Created: Tue Oct 08 1996 6;; Created: Tue Oct 08 1996
@@ -34,7 +34,7 @@
34;; (require 'generic-x) 34;; (require 'generic-x)
35;; 35;;
36;; You can decide which modes to load by setting the variable 36;; You can decide which modes to load by setting the variable
37;; `generic-extras-enable-list'. Some platform-specific modes are 37;; `generic-extras-enable-list'. Some platform-specific modes are
38;; affected by the variables `generic-define-mswindows-modes' and 38;; affected by the variables `generic-define-mswindows-modes' and
39;; `generic-define-unix-modes' (which see). 39;; `generic-define-unix-modes' (which see).
40;; 40;;
@@ -92,7 +92,6 @@
92 92
93;;; Code: 93;;; Code:
94 94
95(require 'generic)
96(require 'font-lock) 95(require 'font-lock)
97 96
98(defgroup generic-x nil 97(defgroup generic-x nil
@@ -103,53 +102,52 @@
103 102
104(defcustom generic-extras-enable-list nil 103(defcustom generic-extras-enable-list nil
105 "*List of generic modes to enable by default. 104 "*List of generic modes to enable by default.
106Each entry in the list should be a symbol. 105Each entry in the list should be a symbol. The variables
107The variables `generic-define-mswindows-modes' and `generic-define-unix-modes' 106`generic-define-mswindows-modes' and `generic-define-unix-modes'
108also affect which generic modes are defined. 107also affect which generic modes are defined. Please note that if
109Please note that if you set this variable after generic-x is loaded, 108you set this variable after generic-x is loaded, you must reload
110you must reload generic-x to enable the specified modes." 109generic-x to enable the specified modes."
111 :group 'generic-x 110 :group 'generic-x
112 :type '(repeat sexp) 111 :type '(repeat sexp))
113 )
114 112
115(defcustom generic-define-mswindows-modes 113(defcustom generic-define-mswindows-modes
116 (memq system-type (list 'windows-nt 'ms-dos)) 114 (memq system-type '(windows-nt ms-dos))
117 "*If non-nil, some MS-Windows specific generic modes will be defined." 115 "*If non-nil, some MS-Windows specific generic modes will be defined."
118 :group 'generic-x 116 :group 'generic-x
119 :type 'boolean 117 :type 'boolean)
120 )
121 118
122(defcustom generic-define-unix-modes 119(defcustom generic-define-unix-modes
123 (not (memq system-type (list 'windows-nt 'ms-dos))) 120 (not (memq system-type '(windows-nt ms-dos)))
124 "*If non-nil, some Unix specific generic modes will be defined." 121 "*If non-nil, some Unix specific generic modes will be defined."
125 :group 'generic-x 122 :group 'generic-x
126 :type 'boolean 123 :type 'boolean)
127 )
128 124
129(and generic-define-mswindows-modes 125(and generic-define-mswindows-modes
130 (setq generic-extras-enable-list 126 (setq generic-extras-enable-list
131 (append (list 'bat-generic-mode 'ini-generic-mode 127 (append (list 'bat-generic-mode
132 'inf-generic-mode 'rc-generic-mode 128 'ini-generic-mode
133 'reg-generic-mode 'rul-generic-mode 129 'inf-generic-mode
134 'hosts-generic-mode 130 'rc-generic-mode
135 'apache-conf-generic-mode 131 'reg-generic-mode
136 'apache-log-generic-mode 132 'rul-generic-mode
137 ) 133 'hosts-generic-mode
138 generic-extras-enable-list))) 134 'apache-conf-generic-mode
135 'apache-log-generic-mode)
136 generic-extras-enable-list)))
139 137
140(and generic-define-unix-modes 138(and generic-define-unix-modes
141 (setq generic-extras-enable-list 139 (setq generic-extras-enable-list
142 (append (list 'apache-conf-generic-mode 140 (append (list 'apache-conf-generic-mode
143 'apache-log-generic-mode 141 'apache-log-generic-mode
144 'samba-generic-mode 142 'samba-generic-mode
145 'hosts-generic-mode 'fvwm-generic-mode 143 'hosts-generic-mode
144 'fvwm-generic-mode
146 'x-resource-generic-mode 145 'x-resource-generic-mode
147 'alias-generic-mode 146 'alias-generic-mode
148 'inetd-conf-generic-mode 147 'inetd-conf-generic-mode
149 'etc-services-generic-mode 148 'etc-services-generic-mode
150 'etc-passwd-generic-mode 149 'etc-passwd-generic-mode
151 'etc-fstab-generic-mode 150 'etc-fstab-generic-mode)
152 )
153 generic-extras-enable-list))) 151 generic-extras-enable-list)))
154 152
155;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 153;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -157,382 +155,345 @@ you must reload generic-x to enable the specified modes."
157;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 155;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
158 156
159;;; Apache 157;;; Apache
160(and 158(when (memq 'apache-conf-generic-mode generic-extras-enable-list)
161 (memq 'apache-conf-generic-mode generic-extras-enable-list) 159
162 160(define-generic-mode apache-conf-generic-mode
163(define-generic-mode 'apache-conf-generic-mode 161 (list ?#)
164 (list ?#) 162 nil
165 nil 163 '(("^\\s-*\\(<.*>\\)" 1 'font-lock-constant-face)
166 '(("^\\s-*\\(<.*>\\)" 1 'font-lock-constant-face) 164 ("^\\s-*\\(\\sw+\\)\\s-" 1 'font-lock-variable-name-face))
167 ("^\\s-*\\(\\sw+\\)\\s-" 1 'font-lock-variable-name-face)) 165 (list "srm\\.conf\\'" "httpd\\.conf\\'" "access\\.conf\\'")
168 (list "srm\\.conf\\'" "httpd\\.conf\\'" "access\\.conf\\'") 166 (list
169 (list 167 (function
170 (function 168 (lambda ()
171 (lambda ()
172 (setq imenu-generic-expression 169 (setq imenu-generic-expression
173 '((nil "^\\([-A-Za-z0-9_]+\\)" 1) 170 '((nil "^\\([-A-Za-z0-9_]+\\)" 1)
174 ("*Directories*" "^\\s-*<Directory\\s-*\\([^>]+\\)>" 1) 171 ("*Directories*" "^\\s-*<Directory\\s-*\\([^>]+\\)>" 1)
175 ("*Locations*" "^\\s-*<Location\\s-*\\([^>]+\\)>" 1) 172 ("*Locations*" "^\\s-*<Location\\s-*\\([^>]+\\)>" 1))))))
176 )) 173 "Generic mode for Apache or HTTPD configuration files."))
177 )))
178 "Generic mode for Apache or HTTPD configuration files."))
179 174
180(and 175(when (memq 'apache-log-generic-mode generic-extras-enable-list)
181 (memq 'apache-log-generic-mode generic-extras-enable-list)
182 176
183(define-generic-mode 'apache-log-generic-mode 177(define-generic-mode apache-log-generic-mode
184 nil 178 nil
185 nil 179 nil
186 ;; Hostname ? user date request return-code number-of-bytes 180 ;; Hostname ? user date request return-code number-of-bytes
187 '(("^\\([-a-zA-z0-9.]+\\) - [-A-Za-z]+ \\(\\[.*\\]\\)" 181 '(("^\\([-a-zA-z0-9.]+\\) - [-A-Za-z]+ \\(\\[.*\\]\\)"
188 (1 font-lock-constant-face) 182 (1 font-lock-constant-face)
189 (2 font-lock-variable-name-face)) 183 (2 font-lock-variable-name-face)))
190 )
191 (list "access_log\\'") 184 (list "access_log\\'")
192 nil 185 nil
193 "Mode for Apache log files")) 186 "Mode for Apache log files"))
194 187
195;;; Samba 188;;; Samba
196(and 189(when (memq 'samba-generic-mode generic-extras-enable-list)
197 (memq 'samba-generic-mode generic-extras-enable-list) 190
198 191(define-generic-mode samba-generic-mode
199(define-generic-mode 'samba-generic-mode 192 (list ?\; ?#)
200 (list ?\; ?#) 193 nil
201 nil 194 '(("^\\(\\[.*\\]\\)" 1 'font-lock-constant-face)
202 '( 195 ("^\\s-*\\(.+\\)=\\([^\r\n]*\\)"
203 ("^\\(\\[.*\\]\\)" 1 'font-lock-constant-face) 196 (1 'font-lock-variable-name-face)
204 ("^\\s-*\\(.+\\)=\\([^\r\n]*\\)" 197 (2 'font-lock-type-face)))
205 (1 'font-lock-variable-name-face) 198 (list "smb\\.conf\\'")
206 (2 'font-lock-type-face)) 199 (list 'generic-bracket-support)
207 ) 200 "Generic mode for Samba configuration files."))
208 (list "smb\\.conf\\'")
209 (list 'generic-bracket-support)
210 "Generic mode for Samba configuration files."))
211 201
212;;; Fvwm 202;;; Fvwm
213;; This is pretty basic. Also, modes for other window managers could 203;; This is pretty basic. Also, modes for other window managers could
214;; be defined as well. 204;; be defined as well.
215(and 205(when (memq 'fvwm-generic-mode generic-extras-enable-list)
216(memq 'fvwm-generic-mode generic-extras-enable-list)
217 206
218(define-generic-mode 'fvwm-generic-mode 207(define-generic-mode fvwm-generic-mode
219 (list ?#) 208 (list ?#)
220 (list 209 (list
221 "AddToMenu" 210 "AddToMenu"
222 "AddToFunc" 211 "AddToFunc"
223 "ButtonStyle" 212 "ButtonStyle"
224 "EndFunction" 213 "EndFunction"
225 "EndPopup" 214 "EndPopup"
226 "Function" 215 "Function"
227 "IconPath" 216 "IconPath"
228 "Key" 217 "Key"
229 "ModulePath" 218 "ModulePath"
230 "Mouse" 219 "Mouse"
231 "PixmapPath" 220 "PixmapPath"
232 "Popup" 221 "Popup"
233 "Style" 222 "Style")
234 ) 223 nil
235 nil 224 (list "\\.fvwmrc\\'" "\\.fvwm2rc\\'")
236 (list "\\.fvwmrc\\'" "\\.fvwm2rc\\'") 225 nil
237 nil 226 "Generic mode for FVWM configuration files."))
238 "Generic mode for FVWM configuration files."))
239 227
240;;; X Resource 228;;; X Resource
241;; I'm pretty sure I've seen an actual mode to do this, but I don't 229;; I'm pretty sure I've seen an actual mode to do this, but I don't
242;; think it's standard with Emacs 230;; think it's standard with Emacs
243(and 231(when (memq 'x-resource-generic-mode generic-extras-enable-list)
244 (memq 'x-resource-generic-mode generic-extras-enable-list)
245 232
246(define-generic-mode 'x-resource-generic-mode 233(define-generic-mode x-resource-generic-mode
247 (list ?!) 234 (list ?!)
248 nil 235 nil
249 '(("^\\([^:\n]+:\\)" 1 'font-lock-variable-name-face)) 236 '(("^\\([^:\n]+:\\)" 1 'font-lock-variable-name-face))
250 (list "\\.Xdefaults\\'" "\\.Xresources\\'" "\\.Xenvironment\\'" "\\.ad\\'") 237 (list "\\.Xdefaults\\'" "\\.Xresources\\'" "\\.Xenvironment\\'" "\\.ad\\'")
251 nil 238 nil
252 "Generic mode for X Resource configuration files.")) 239 "Generic mode for X Resource configuration files."))
253 240
254;;; Hosts 241;;; Hosts
255(and 242(when (memq 'hosts-generic-mode generic-extras-enable-list)
256 (memq 'hosts-generic-mode generic-extras-enable-list)
257 243
258(define-generic-mode 'hosts-generic-mode 244(define-generic-mode hosts-generic-mode
259 (list ?#) 245 (list ?#)
260 (list "localhost") 246 (list "localhost")
261 '(("\\([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+\\)" 1 'font-lock-constant-face)) 247 '(("\\([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+\\)" 1 'font-lock-constant-face))
262 (list "[hH][oO][sS][tT][sS]\\'") 248 (list "[hH][oO][sS][tT][sS]\\'")
263 nil 249 nil
264 "Generic mode for HOSTS files.")) 250 "Generic mode for HOSTS files."))
265 251
266;;; Windows INF files 252;;; Windows INF files
267(and 253(when (memq 'inf-generic-mode generic-extras-enable-list)
268 (memq 'inf-generic-mode generic-extras-enable-list)
269 254
270(define-generic-mode 'inf-generic-mode 255(define-generic-mode inf-generic-mode
271 (list ?\;) 256 (list ?\;)
272 nil 257 nil
273 '(("^\\(\\[.*\\]\\)" 1 'font-lock-constant-face)) 258 '(("^\\(\\[.*\\]\\)" 1 'font-lock-constant-face))
274 (list "\\.[iI][nN][fF]\\'") 259 (list "\\.[iI][nN][fF]\\'")
275 (list 'generic-bracket-support) 260 (list 'generic-bracket-support)
276 "Generic mode for MS-Windows INF files.")) 261 "Generic mode for MS-Windows INF files."))
277 262
278;;; Windows INI files 263;;; Windows INI files
279;; Should define escape character as well! 264;; Should define escape character as well!
280(and 265(when (memq 'ini-generic-mode generic-extras-enable-list)
281 (memq 'ini-generic-mode generic-extras-enable-list) 266
282 267(define-generic-mode ini-generic-mode
283(define-generic-mode 'ini-generic-mode 268 (list ?\;)
284 (list ?\;) 269 nil
285 nil 270 '(("^\\(\\[.*\\]\\)" 1 'font-lock-constant-face)
286 '(("^\\(\\[.*\\]\\)" 1 'font-lock-constant-face) 271 ("^\\([^=\n\r]*\\)=\\([^\n\r]*\\)$"
287 ("^\\([^=\n\r]*\\)=\\([^\n\r]*\\)$" 272 (1 font-lock-function-name-face)
288 (1 font-lock-function-name-face) 273 (2 font-lock-variable-name-face)))
289 (2 font-lock-variable-name-face))) 274 (list "\\.[iI][nN][iI]\\'")
290 (list "\\.[iI][nN][iI]\\'") 275 (list
291 (list 276 (function
292 (function 277 (lambda ()
293 (lambda () 278 (setq imenu-generic-expression
294 (setq imenu-generic-expression 279 '((nil "^\\[\\(.*\\)\\]" 1)
295 '((nil "^\\[\\(.*\\)\\]" 1) 280 ("*Variables*" "^\\s-*\\([^=]+\\)\\s-*=" 1))))))
296 ("*Variables*" "^\\s-*\\([^=]+\\)\\s-*=" 1))) 281 "Generic mode for MS-Windows INI files."))
297 )))
298 "Generic mode for MS-Windows INI files."))
299 282
300;;; Windows REG files 283;;; Windows REG files
301;;; Unfortunately, Windows 95 and Windows NT have different REG file syntax! 284;;; Unfortunately, Windows 95 and Windows NT have different REG file syntax!
302(and 285(when (memq 'reg-generic-mode generic-extras-enable-list)
303 (memq 'reg-generic-mode generic-extras-enable-list) 286
304 287(define-generic-mode reg-generic-mode
305(define-generic-mode 'reg-generic-mode 288 '(?\;)
306 '(?\;) 289 '("key" "classes_root" "REGEDIT" "REGEDIT4")
307 '("key" "classes_root" "REGEDIT" "REGEDIT4") 290 '(("\\(\\[.*]\\)" 1 'font-lock-constant-face)
308 '(("\\(\\[.*]\\)" 1 'font-lock-constant-face) 291 ("^\\([^\n\r]*\\)\\s-*=" 1 'font-lock-variable-name-face))
309 ("^\\([^\n\r]*\\)\\s-*=" 1 'font-lock-variable-name-face)) 292 '("\\.[rR][eE][gG]\\'")
310 '("\\.[rR][eE][gG]\\'") 293 (list
311 (list 294 (function
312 (function 295 (lambda ()
313 (lambda () 296 (setq imenu-generic-expression
314 (setq imenu-generic-expression 297 '((nil "^\\s-*\\(.*\\)\\s-*=" 1))))))
315 '((nil "^\\s-*\\(.*\\)\\s-*=" 1)))))) 298 "Generic mode for MS-Windows Registry files."))
316 "Generic mode for MS-Windows Registry files."))
317 299
318;;; DOS/Windows BAT files 300;;; DOS/Windows BAT files
319(if (not (memq 'bat-generic-mode generic-extras-enable-list)) 301(when (memq 'bat-generic-mode generic-extras-enable-list)
320 nil 302
321(define-generic-mode 'bat-generic-mode 303(define-generic-mode bat-generic-mode
322 nil 304 nil
323 nil 305 nil
306 (list
307 ;; Make this one first in the list, otherwise comments will
308 ;; be over-written by other variables
309 (list "^[@ \t]*\\([rR][eE][mM][^\n\r]*\\)" 1 'font-lock-comment-face t)
310 (list "^[ \t]*\\(::.*\\)" 1 'font-lock-comment-face t)
311 (list
312 "^[@ \t]*\\([bB][rR][eE][aA][kK]\\|[vV][eE][rR][iI][fF][yY]\\)[ \t]+\\([oO]\\([nN]\\|[fF][fF]\\)\\)"
313 '(1 font-lock-builtin-face)
314 '(2 font-lock-constant-face t t))
315 ;; Any text (except ON/OFF) following ECHO is a string.
316 (list
317 "^[@ \t]*\\([eE][cC][hH][oO]\\)[ \t]+\\(\\([oO]\\([nN]\\|[fF][fF]\\)\\)\\|\\([^>|\r\n]+\\)\\)"
318 '(1 font-lock-builtin-face)
319 '(3 font-lock-constant-face t t)
320 '(5 font-lock-string-face t t))
321 ;; These keywords appear as the first word on a line. (Actually, they
322 ;; can also appear after "if ..." or "for ..." clause, but since they
323 ;; are frequently used in simple text, we punt.)
324 ;; In `generic-bat-mode-setup-function' we make the keywords
325 ;; case-insensitive
326 (generic-make-keywords-list
324 (list 327 (list
325 ;; Make this one first in the list, otherwise comments will 328 "for"
326 ;; be over-written by other variables 329 "if")
327 (list "^[@ \t]*\\([rR][eE][mM][^\n\r]*\\)" 1 'font-lock-comment-face t) 330 'font-lock-keyword-face "^[@ \t]*")
328 (list "^[ \t]*\\(::.*\\)" 1 'font-lock-comment-face t) 331 ;; These keywords can be anywhere on a line
329 (list 332 ;; In `generic-bat-mode-setup-function' we make the keywords
330 "^[@ \t]*\\([bB][rR][eE][aA][kK]\\|[vV][eE][rR][iI][fF][yY]\\)[ \t]+\\([oO]\\([nN]\\|[fF][fF]\\)\\)" 333 ;; case-insensitive
331 '(1 font-lock-builtin-face) 334 (generic-make-keywords-list
332 '(2 font-lock-constant-face t t))
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.)
342 ;; In `generic-bat-mode-setup-function' we make the keywords
343 ;; case-insensitive
344 (generic-make-keywords-list
345 (list
346 "for"
347 "if"
348 )
349 'font-lock-keyword-face "^[@ \t]*")
350 ;; These keywords can be anywhere on a line
351 ;; In `generic-bat-mode-setup-function' we make the keywords
352 ;; case-insensitive
353 (generic-make-keywords-list
354 (list
355 "do"
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.
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]")
380 (list "^[ \t]*\\(:\\sw+\\)" 1 'font-lock-function-name-face t)
381 (list "\\(%\\sw+%\\)" 1 'font-lock-variable-name-face t)
382 (list "\\(%[0-9]\\)" 1 'font-lock-variable-name-face t)
383 (list "\\(/[^/ \"\t\n]+\\)" 1 'font-lock-type-face)
384 (list "[\t ]+\\([+-][^\t\n\" ]+\\)" 1 'font-lock-type-face)
385 (list "[ \t\n|]\\<\\([gG][oO][tT][oO]\\)\\>[ \t]*\\(\\sw+\\)?"
386 '(1 font-lock-keyword-face)
387 '(2 font-lock-function-name-face nil t))
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))
391
392 )
393 (list 335 (list
394 "\\.[bB][aA][tT]\\'" 336 "do"
395 "\\`[cC][oO][nN][fF][iI][gG]\\." 337 "exist"
396 "\\`[aA][uU][tT][oO][eE][xX][eE][cC]\\." ) 338 "errorlevel"
397 (list 'generic-bat-mode-setup-function) 339 "goto"
398 "Generic mode for MS-Windows BAT files.") 340 "not")
399 341 'font-lock-keyword-face)
400 (defvar bat-generic-mode-syntax-table nil 342 ;; These are built-in commands. Only frequently-used ones are listed.
401 "Syntax table in use in bat-generic-mode buffers.") 343 (generic-make-keywords-list
402 344 (list
403 (defvar bat-generic-mode-keymap (make-sparse-keymap) 345 "CALL" "call" "Call"
404 "Keymap for bet-generic-mode.") 346 "CD" "cd" "Cd"
405 347 "CLS" "cls" "Cls"
406 (defun bat-generic-mode-compile () 348 "COPY" "copy" "Copy"
407 "Run the current BAT file in a compilation buffer." 349 "DEL" "del" "Del"
408 (interactive) 350 "ECHO" "echo" "Echo"
409 (let ((compilation-buffer-name-function 351 "MD" "md" "Md"
410 (function 352 "PATH" "path" "Path"
411 (lambda(ign) 353 "PAUSE" "pause" "Pause"
412 (concat "*" (buffer-file-name) "*"))) 354 "PROMPT" "prompt" "Prompt"
413 ) 355 "RD" "rd" "Rd"
414 ) 356 "REN" "ren" "Ren"
415 (compile 357 "SET" "set" "Set"
416 (concat (w32-shell-name) " -c " (buffer-file-name))))) 358 "START" "start" "Start"
417 359 "SHIFT" "shift" "Shift")
418 (defun bat-generic-mode-run-as-comint () 360 'font-lock-builtin-face "[ \t|\n]")
419 "Run the current BAT file in a comint buffer." 361 (list "^[ \t]*\\(:\\sw+\\)" 1 'font-lock-function-name-face t)
420 (interactive) 362 (list "\\(%\\sw+%\\)" 1 'font-lock-variable-name-face t)
421 (require 'comint) 363 (list "\\(%[0-9]\\)" 1 'font-lock-variable-name-face t)
422 (let* ((file (buffer-file-name)) 364 (list "\\(/[^/ \"\t\n]+\\)" 1 'font-lock-type-face)
423 (buf-name (concat "*" file "*"))) 365 (list "[\t ]+\\([+-][^\t\n\" ]+\\)" 1 'font-lock-type-face)
424 (save-excursion 366 (list "[ \t\n|]\\<\\([gG][oO][tT][oO]\\)\\>[ \t]*\\(\\sw+\\)?"
425 (set-buffer 367 '(1 font-lock-keyword-face)
426 (get-buffer-create buf-name)) 368 '(2 font-lock-function-name-face nil t))
427 (erase-buffer) 369 (list "[ \t\n|]\\<\\([sS][eE][tT]\\)\\>[ \t]*\\(\\sw+\\)?[ \t]*=?"
428 (comint-mode) 370 '(1 font-lock-builtin-face)
429 (comint-exec 371 '(2 font-lock-variable-name-face t t)))
430 buf-name 372 (list
431 file 373 "\\.[bB][aA][tT]\\'"
432 (w32-shell-name) 374 "\\`[cC][oO][nN][fF][iI][gG]\\."
433 nil 375 "\\`[aA][uU][tT][oO][eE][xX][eE][cC]\\." )
434 (list 376 (list 'generic-bat-mode-setup-function)
435 "-c" 377 "Generic mode for MS-Windows BAT files.")
436 file 378
437 ) 379(defvar bat-generic-mode-syntax-table nil
438 ) 380 "Syntax table in use in bat-generic-mode buffers.")
439 (display-buffer buf-name)))) 381
440 382(defvar bat-generic-mode-keymap (make-sparse-keymap)
441 (define-key bat-generic-mode-keymap "\C-c\C-c" 'bat-generic-mode-compile) 383 "Keymap for bet-generic-mode.")
442 384
443 ;; Make underscores count as words 385(defun bat-generic-mode-compile ()
444 (if bat-generic-mode-syntax-table 386 "Run the current BAT file in a compilation buffer."
445 nil 387 (interactive)
446 (setq bat-generic-mode-syntax-table (make-syntax-table)) 388 (let ((compilation-buffer-name-function
447 (modify-syntax-entry ?_ "w" bat-generic-mode-syntax-table)) 389 (function
448 390 (lambda(ign)
449 ;; bat-generic-mode doesn't use the comment functionality of generic-mode 391 (concat "*" (buffer-file-name) "*")))))
450 ;; because it has a three-letter comment-string, so we do it 392 (compile
451 ;; here manually instead 393 (concat (w32-shell-name) " -c " (buffer-file-name)))))
452 (defun generic-bat-mode-setup-function () 394
453 (make-local-variable 'parse-sexp-ignore-comments) 395(defun bat-generic-mode-run-as-comint ()
454 (make-local-variable 'comment-start) 396 "Run the current BAT file in a comint buffer."
455 (make-local-variable 'comment-start-skip) 397 (interactive)
456 (make-local-variable 'comment-end) 398 (require 'comint)
457 (setq imenu-generic-expression '((nil "^:\\(\\sw+\\)" 1)) 399 (let* ((file (buffer-file-name))
458 parse-sexp-ignore-comments t 400 (buf-name (concat "*" file "*")))
459 comment-end "" 401 (save-excursion
460 comment-start "REM " 402 (set-buffer
461 comment-start-skip "[Rr][Ee][Mm] *" 403 (get-buffer-create buf-name))
462 ) 404 (erase-buffer)
463 (set-syntax-table bat-generic-mode-syntax-table) 405 (comint-mode)
464 ;; Make keywords case-insensitive 406 (comint-exec
465 (setq font-lock-defaults (list 'generic-font-lock-defaults nil t)) 407 buf-name
466 (use-local-map bat-generic-mode-keymap) 408 file
467 ) 409 (w32-shell-name)
468 ) 410 nil
411 (list "-c" file))
412 (display-buffer buf-name))))
413
414(define-key bat-generic-mode-keymap "\C-c\C-c" 'bat-generic-mode-compile)
415
416;; Make underscores count as words
417(unless bat-generic-mode-syntax-table
418 (setq bat-generic-mode-syntax-table (make-syntax-table))
419 (modify-syntax-entry ?_ "w" bat-generic-mode-syntax-table))
420
421;; bat-generic-mode doesn't use the comment functionality of generic-mode
422;; because it has a three-letter comment-string, so we do it
423;; here manually instead
424(defun generic-bat-mode-setup-function ()
425 (make-local-variable 'parse-sexp-ignore-comments)
426 (make-local-variable 'comment-start)
427 (make-local-variable 'comment-start-skip)
428 (make-local-variable 'comment-end)
429 (setq imenu-generic-expression '((nil "^:\\(\\sw+\\)" 1))
430 parse-sexp-ignore-comments t
431 comment-end ""
432 comment-start "REM "
433 comment-start-skip "[Rr][Ee][Mm] *")
434 (set-syntax-table bat-generic-mode-syntax-table)
435 ;; Make keywords case-insensitive
436 (setq font-lock-defaults (list 'generic-font-lock-defaults nil t))
437 (use-local-map bat-generic-mode-keymap)))
469 438
470;;; Mailagent 439;;; Mailagent
471;; Mailagent is a Unix mail filtering program. Anyone wanna do a generic mode 440;; Mailagent is a Unix mail filtering program. Anyone wanna do a generic mode
472;; for procmail? 441;; for procmail?
473(and 442(when (memq 'mailagent-rules-generic-mode generic-extras-enable-list)
474 (memq 'mailagent-rules-generic-mode generic-extras-enable-list) 443
475 444(define-generic-mode mailagent-rules-generic-mode
476(define-generic-mode 'mailagent-rules-generic-mode 445 (list ?#)
477 (list ?#) 446 (list "SAVE" "DELETE" "PIPE" "ANNOTATE" "REJECT")
478 (list "SAVE" "DELETE" "PIPE" "ANNOTATE" "REJECT") 447 '(("^\\(\\sw+\\)\\s-*=" 1 'font-lock-variable-name-face)
479 '(("^\\(\\sw+\\)\\s-*=" 1 'font-lock-variable-name-face) 448 ("\\s-/\\([^/]+\\)/[i, \t\n]" 1 'font-lock-constant-face))
480 ("\\s-/\\([^/]+\\)/[i, \t\n]" 1 'font-lock-constant-face)) 449 (list "\\.rules\\'")
481 (list "\\.rules\\'") 450 (list 'mailagent-rules-setup-function)
482 (list 'mailagent-rules-setup-function) 451 "Mode for Mailagent rules files.")
483 "Mode for Mailagent rules files.")
484 452
485(defun mailagent-rules-setup-function () 453(defun mailagent-rules-setup-function ()
486 (make-local-variable 'imenu-generic-expression) 454 (make-local-variable 'imenu-generic-expression)
487 (setq imenu-generic-expression 455 (setq imenu-generic-expression
488 '((nil "\\s-/\\([^/]+\\)/[i, \t\n]" 1)))) 456 '((nil "\\s-/\\([^/]+\\)/[i, \t\n]" 1)))))
489 )
490 457
491;; Solaris/Sys V prototype files 458;; Solaris/Sys V prototype files
492(and 459(when (memq 'prototype-generic-mode generic-extras-enable-list)
493 (memq 'prototype-generic-mode generic-extras-enable-list) 460
494 461(define-generic-mode prototype-generic-mode
495(define-generic-mode 'prototype-generic-mode 462 (list ?#)
496 (list ?#) 463 nil
497 nil 464 '(("^\\([0-9]\\)?\\s-*\\([a-z]\\)\\s-+\\([A-Za-z_]+\\)\\s-+\\([^\n\r]*\\)$"
498 '( 465 (2 font-lock-constant-face)
499 ("^\\([0-9]\\)?\\s-*\\([a-z]\\)\\s-+\\([A-Za-z_]+\\)\\s-+\\([^\n\r]*\\)$" 466 (3 font-lock-keyword-face))
500 (2 font-lock-constant-face) 467 ("^\\([a-z]\\) \\([A-Za-z_]+\\)=\\([^\n\r]*\\)$"
501 (3 font-lock-keyword-face)) 468 (1 font-lock-constant-face)
502 ("^\\([a-z]\\) \\([A-Za-z_]+\\)=\\([^\n\r]*\\)$" 469 (2 font-lock-keyword-face)
503 (1 font-lock-constant-face) 470 (3 font-lock-variable-name-face))
504 (2 font-lock-keyword-face) 471 ("^\\(!\\s-*\\(search\\|include\\|default\\)\\)\\s-*\\([^\n\r]*\\)$"
505 (3 font-lock-variable-name-face)) 472 (1 font-lock-keyword-face)
506 ("^\\(!\\s-*\\(search\\|include\\|default\\)\\)\\s-*\\([^\n\r]*\\)$" 473 (3 font-lock-variable-name-face))
507 (1 font-lock-keyword-face) 474 ("^\\(!\\s-*\\sw+\\)=\\([^\n\r]*\\)$"
508 (3 font-lock-variable-name-face)) 475 (1 font-lock-keyword-face)
509 ("^\\(!\\s-*\\sw+\\)=\\([^\n\r]*\\)$" 476 (2 font-lock-variable-name-face)))
510 (1 font-lock-keyword-face) 477 (list "prototype\\'")
511 (2 font-lock-variable-name-face)) 478 nil
512 ) 479 "Mode for Sys V prototype files."))
513 (list "prototype\\'")
514 nil
515 "Mode for Sys V prototype files."))
516 480
517;; Solaris/Sys V pkginfo files 481;; Solaris/Sys V pkginfo files
518(and 482(when (memq 'pkginfo-generic-mode generic-extras-enable-list)
519 (memq 'pkginfo-generic-mode generic-extras-enable-list) 483
520 484(define-generic-mode pkginfo-generic-mode
521(define-generic-mode 'pkginfo-generic-mode 485 (list ?#)
522 (list ?#) 486 nil
523 nil 487 '(("^\\([A-Za-z_]+\\)=\\([^\n\r]*\\)$"
524 '( 488 (1 font-lock-keyword-face)
525 ("^\\([A-Za-z_]+\\)=\\([^\n\r]*\\)$" 489 (2 font-lock-variable-name-face)))
526 (1 font-lock-keyword-face) 490 (list "pkginfo\\'")
527 (2 font-lock-variable-name-face)) 491 nil
528 ) 492 "Mode for Sys V pkginfo files."))
529 (list "pkginfo\\'")
530 nil
531 "Mode for Sys V pkginfo files."))
532 493
533;; Javascript mode 494;; Javascript mode
534;; Includes extra keywords from Armando Singer [asinger@MAIL.COLGATE.EDU] 495;; Includes extra keywords from Armando Singer [asinger@MAIL.COLGATE.EDU]
535(define-generic-mode 'javascript-generic-mode 496(define-generic-mode javascript-generic-mode
536 (list "//" '("/*" . "*/")) 497 (list "//" '("/*" . "*/"))
537 (list 498 (list
538 "break" 499 "break"
@@ -594,27 +555,23 @@ you must reload generic-x to enable the specified modes."
594 "synchronized" 555 "synchronized"
595 "throws" 556 "throws"
596 "transient" 557 "transient"
597 "true" 558 "true")
598 )
599 (list 559 (list
600 (list "^\\s-*function\\s-+\\([A-Za-z0-9_]+\\)" 560 (list "^\\s-*function\\s-+\\([A-Za-z0-9_]+\\)"
601 '(1 font-lock-function-name-face)) 561 '(1 font-lock-function-name-face))
602 (list "^\\s-*var\\s-+\\([A-Za-z0-9_]+\\)" 562 (list "^\\s-*var\\s-+\\([A-Za-z0-9_]+\\)"
603 '(1 font-lock-variable-name-face)) 563 '(1 font-lock-variable-name-face)))
604 )
605 (list "\\.js\\'") 564 (list "\\.js\\'")
606 (list 565 (list
607 (function 566 (function
608 (lambda () 567 (lambda ()
609 (setq imenu-generic-expression 568 (setq imenu-generic-expression
610 '((nil "^function\\s-+\\([A-Za-z0-9_]+\\)" 1) 569 '((nil "^function\\s-+\\([A-Za-z0-9_]+\\)" 1)
611 ("*Variables*" "^var\\s-+\\([A-Za-z0-9_]+\\)" 1) 570 ("*Variables*" "^var\\s-+\\([A-Za-z0-9_]+\\)" 1))))))
612 ))
613 )))
614 "Mode for JavaScript files.") 571 "Mode for JavaScript files.")
615 572
616;; VRML files 573;; VRML files
617(define-generic-mode 'vrml-generic-mode 574(define-generic-mode vrml-generic-mode
618 (list ?#) 575 (list ?#)
619 (list 576 (list
620 "DEF" 577 "DEF"
@@ -644,8 +601,7 @@ you must reload generic-x to enable the specified modes."
644 "textureTransform" 601 "textureTransform"
645 "title" 602 "title"
646 "transparency" 603 "transparency"
647 "type" 604 "type")
648 )
649 (list 605 (list
650 (list "USE\\s-+\\([-A-Za-z0-9_]+\\)" 606 (list "USE\\s-+\\([-A-Za-z0-9_]+\\)"
651 '(1 font-lock-constant-face)) 607 '(1 font-lock-constant-face))
@@ -656,8 +612,7 @@ you must reload generic-x to enable the specified modes."
656 '(1 font-lock-function-name-face)) 612 '(1 font-lock-function-name-face))
657 (list 613 (list
658 "^\\s-*\\(geometry\\|appearance\\|material\\)\\s-+\\([-A-Za-z0-9_]+\\)" 614 "^\\s-*\\(geometry\\|appearance\\|material\\)\\s-+\\([-A-Za-z0-9_]+\\)"
659 '(2 font-lock-variable-name-face)) 615 '(2 font-lock-variable-name-face)))
660 )
661 (list "\\.wrl\\'") 616 (list "\\.wrl\\'")
662 (list 617 (list
663 (function 618 (function
@@ -666,12 +621,11 @@ you must reload generic-x to enable the specified modes."
666 '((nil "^\\([A-Za-z0-9_]+\\)\\s-*{" 1) 621 '((nil "^\\([A-Za-z0-9_]+\\)\\s-*{" 1)
667 ("*Definitions*" 622 ("*Definitions*"
668 "DEF\\s-+\\([-A-Za-z0-9_]+\\)\\s-+\\([A-Za-z0-9]+\\)\\s-*{" 623 "DEF\\s-+\\([-A-Za-z0-9_]+\\)\\s-+\\([A-Za-z0-9]+\\)\\s-*{"
669 1))) 624 1))))))
670 )))
671 "Generic Mode for VRML files.") 625 "Generic Mode for VRML files.")
672 626
673;; Java Manifests 627;; Java Manifests
674(define-generic-mode 'java-manifest-generic-mode 628(define-generic-mode java-manifest-generic-mode
675 (list ?#) 629 (list ?#)
676 (list 630 (list
677 "Name" 631 "Name"
@@ -681,26 +635,23 @@ you must reload generic-x to enable the specified modes."
681 "Signature-Version" 635 "Signature-Version"
682 "Magic" 636 "Magic"
683 "Java-Bean" 637 "Java-Bean"
684 "Depends-On" 638 "Depends-On")
685 )
686 '(("^Name:\\s-+\\([^\n\r]*\\)$" 639 '(("^Name:\\s-+\\([^\n\r]*\\)$"
687 (1 font-lock-variable-name-face)) 640 (1 font-lock-variable-name-face))
688 ("^\\(Manifest\\|Required\\|Signature\\)-Version:\\s-+\\([^\n\r]*\\)$" 641 ("^\\(Manifest\\|Required\\|Signature\\)-Version:\\s-+\\([^\n\r]*\\)$"
689 (2 font-lock-constant-face)) 642 (2 font-lock-constant-face)))
690 )
691 (list "[mM][aA][nN][iI][fF][eE][sS][tT]\\.[mM][fF]\\'") 643 (list "[mM][aA][nN][iI][fF][eE][sS][tT]\\.[mM][fF]\\'")
692 nil 644 nil
693 "Mode for Java Manifest files") 645 "Mode for Java Manifest files")
694 646
695;; Java properties files 647;; Java properties files
696(define-generic-mode 'java-properties-generic-mode 648(define-generic-mode java-properties-generic-mode
697 (list ?! ?#) 649 (list ?! ?#)
698 nil 650 nil
699 (let ((java-properties-key 651 (let ((java-properties-key
700 "\\(\\([-A-Za-z0-9_\\./]\\|\\(\\\\[ =:]\\)\\)+\\)") 652 "\\(\\([-A-Za-z0-9_\\./]\\|\\(\\\\[ =:]\\)\\)+\\)")
701 (java-properties-value 653 (java-properties-value
702 "\\([^\r\n]*\\)") 654 "\\([^\r\n]*\\)"))
703 )
704 ;; Property and value can be separated in a number of different ways: 655 ;; Property and value can be separated in a number of different ways:
705 ;; * whitespace 656 ;; * whitespace
706 ;; * an equal sign 657 ;; * an equal sign
@@ -711,143 +662,133 @@ you must reload generic-x to enable the specified modes."
711 (list 662 (list
712 (concat "^" java-properties-key elt java-properties-value "$") 663 (concat "^" java-properties-key elt java-properties-value "$")
713 '(1 font-lock-constant-face) 664 '(1 font-lock-constant-face)
714 '(4 font-lock-variable-name-face) 665 '(4 font-lock-variable-name-face))))
715 )))
716 ;; These are the separators 666 ;; These are the separators
717 (list ":\\s-*" "\\s-+" "\\s-*=\\s-*") 667 (list ":\\s-*" "\\s-+" "\\s-*=\\s-*")))
718 )
719 )
720 nil 668 nil
721 (list 669 (list
722 (function 670 (function
723 (lambda () 671 (lambda ()
724 (setq imenu-generic-expression 672 (setq imenu-generic-expression
725 '((nil "^\\([^#! \t\n\r=:]+\\)" 1))) 673 '((nil "^\\([^#! \t\n\r=:]+\\)" 1))))))
726 )))
727 "Mode for Java properties files.") 674 "Mode for Java properties files.")
728 675
729;; C shell alias definitions 676;; C shell alias definitions
730(and 677(when (memq 'alias-generic-mode generic-extras-enable-list)
731 (memq 'alias-generic-mode generic-extras-enable-list)
732 678
733(define-generic-mode 'alias-generic-mode 679(define-generic-mode alias-generic-mode
734 (list ?#) 680 (list ?#)
735 (list "alias" "unalias") 681 (list "alias" "unalias")
736 '(("^alias\\s-+\\([-A-Za-z0-9_]+\\)\\s-+" 682 '(("^alias\\s-+\\([-A-Za-z0-9_]+\\)\\s-+"
737 (1 font-lock-variable-name-face)) 683 (1 font-lock-variable-name-face))
738 ("^unalias\\s-+\\([-A-Za-z0-9_]+\\)\\s-*$" 684 ("^unalias\\s-+\\([-A-Za-z0-9_]+\\)\\s-*$"
739 (1 font-lock-variable-name-face)) 685 (1 font-lock-variable-name-face)))
740 )
741 (list "alias\\'") 686 (list "alias\\'")
742 (list 687 (list
743 (function 688 (function
744 (lambda () 689 (lambda ()
745 (setq imenu-generic-expression 690 (setq imenu-generic-expression
746 '((nil "^\\(alias\\|unalias\\)\\s-+\\([-a-zA-Z0-9_]+\\)" 2))) 691 '((nil "^\\(alias\\|unalias\\)\\s-+\\([-a-zA-Z0-9_]+\\)" 2))))))
747 ))) 692 "Mode for C Shell alias files."))
748 "Mode for C Shell alias files.")
749)
750 693
751;;; Windows RC files 694;;; Windows RC files
752;; Contributed by ACorreir@pervasive-sw.com (Alfred Correira) 695;; Contributed by ACorreir@pervasive-sw.com (Alfred Correira)
753(and 696(when (memq 'rc-generic-mode generic-extras-enable-list)
754 (memq 'rc-generic-mode generic-extras-enable-list) 697
755 698(define-generic-mode rc-generic-mode
756(define-generic-mode 'rc-generic-mode 699 ;; (list ?\/)
757;; (list ?\/) 700 (list "//")
758 (list "//") 701 '("ACCELERATORS"
759 '("ACCELERATORS" 702 "AUTO3STATE"
760 "AUTO3STATE" 703 "AUTOCHECKBOX"
761 "AUTOCHECKBOX" 704 "AUTORADIOBUTTON"
762 "AUTORADIOBUTTON" 705 "BITMAP"
763 "BITMAP" 706 "BOTTOMMARGIN"
764 "BOTTOMMARGIN" 707 "BUTTON"
765 "BUTTON" 708 "CAPTION"
766 "CAPTION" 709 "CHARACTERISTICS"
767 "CHARACTERISTICS" 710 "CHECKBOX"
768 "CHECKBOX" 711 "CLASS"
769 "CLASS" 712 "COMBOBOX"
770 "COMBOBOX" 713 "CONTROL"
771 "CONTROL" 714 "CTEXT"
772 "CTEXT" 715 "CURSOR"
773 "CURSOR" 716 "DEFPUSHBUTTON"
774 "DEFPUSHBUTTON" 717 "DESIGNINFO"
775 "DESIGNINFO" 718 "DIALOG"
776 "DIALOG" 719 "DISCARDABLE"
777 "DISCARDABLE" 720 "EDITTEXT"
778 "EDITTEXT" 721 "EXSTYLE"
779 "EXSTYLE" 722 "FONT"
780 "FONT" 723 "GROUPBOX"
781 "GROUPBOX" 724 "GUIDELINES"
782 "GUIDELINES" 725 "ICON"
783 "ICON" 726 "LANGUAGE"
784 "LANGUAGE" 727 "LEFTMARGIN"
785 "LEFTMARGIN" 728 "LISTBOX"
786 "LISTBOX" 729 "LTEXT"
787 "LTEXT" 730 "MENUITEM SEPARATOR"
788 "MENUITEM SEPARATOR" 731 "MENUITEM"
789 "MENUITEM" 732 "MENU"
790 "MENU" 733 "MOVEABLE"
791 "MOVEABLE" 734 "POPUP"
792 "POPUP" 735 "PRELOAD"
793 "PRELOAD" 736 "PURE"
794 "PURE" 737 "PUSHBOX"
795 "PUSHBOX" 738 "PUSHBUTTON"
796 "PUSHBUTTON" 739 "RADIOBUTTON"
797 "RADIOBUTTON" 740 "RCDATA"
798 "RCDATA" 741 "RIGHTMARGIN"
799 "RIGHTMARGIN" 742 "RTEXT"
800 "RTEXT" 743 "SCROLLBAR"
801 "SCROLLBAR" 744 "SEPARATOR"
802 "SEPARATOR" 745 "STATE3"
803 "STATE3" 746 "STRINGTABLE"
804 "STRINGTABLE" 747 "STYLE"
805 "STYLE" 748 "TEXTINCLUDE"
806 "TEXTINCLUDE" 749 "TOOLBAR"
807 "TOOLBAR" 750 "TOPMARGIN"
808 "TOPMARGIN" 751 "VERSIONINFO"
809 "VERSIONINFO" 752 "VERSION")
810 "VERSION" 753 ;; the choice of what tokens go where is somewhat arbitrary,
811 ) 754 ;; as is the choice of which value tokens are included, as
812 ;; the choice of what tokens go where is somewhat arbitrary, 755 ;; the choice of face for each token group
813 ;; as is the choice of which value tokens are included, as 756 (list
814 ;; the choice of face for each token group 757 (eval-when-compile
815 (list 758 (generic-make-keywords-list
816 (eval-when-compile 759 (list
817 (generic-make-keywords-list 760 "FILEFLAGSMASK"
818 (list 761 "FILEFLAGS"
819 "FILEFLAGSMASK" 762 "FILEOS"
820 "FILEFLAGS" 763 "FILESUBTYPE"
821 "FILEOS" 764 "FILETYPE"
822 "FILESUBTYPE" 765 "FILEVERSION"
823 "FILETYPE" 766 "PRODUCTVERSION")
824 "FILEVERSION" 767 'font-lock-type-face))
825 "PRODUCTVERSION" 768 (eval-when-compile
826 ) 'font-lock-type-face)) 769 (generic-make-keywords-list
827 (eval-when-compile 770 (list
828 (generic-make-keywords-list 771 "BEGIN"
829 (list 772 "BLOCK"
830 "BEGIN" 773 "END"
831 "BLOCK" 774 "VALUE")
832 "END" 775 'font-lock-function-name-face))
833 "VALUE" 776 '("^#[ \t]*include[ \t]+\\(<[^>\"\n]+>\\)" 1 font-lock-string-face)
834 ) 'font-lock-function-name-face)) 777 '("^#[ \t]*define[ \t]+\\(\\sw+\\)(" 1 font-lock-function-name-face)
835 '("^#[ \t]*include[ \t]+\\(<[^>\"\n]+>\\)" 1 font-lock-string-face) 778 '("^#[ \t]*\\(elif\\|if\\)\\>"
836 '("^#[ \t]*define[ \t]+\\(\\sw+\\)(" 1 font-lock-function-name-face) 779 ("\\<\\(defined\\)\\>[ \t]*(?\\(\\sw+\\)?" nil nil
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+\\)?"
841 (1 font-lock-constant-face) (2 font-lock-variable-name-face nil t))) 780 (1 font-lock-constant-face) (2 font-lock-variable-name-face nil t)))
842 (list "\\.[rR][cC]$") 781 '("^#[ \t]*\\(\\sw+\\)\\>[ \t]*\\(\\sw+\\)?"
843 nil 782 (1 font-lock-constant-face) (2 font-lock-variable-name-face nil t)))
844 "Generic mode for MS-Windows Resource files.")) 783 (list "\\.[rR][cC]$")
784 nil
785 "Generic mode for MS-Windows Resource files."))
845 786
846;; InstallShield RUL files 787;; InstallShield RUL files
847;; Contributed by Alfred.Correira@Pervasive.Com 788;; Contributed by Alfred.Correira@Pervasive.Com
848;; Bugfixes by "Rolf Sandau" <Rolf.Sandau@marconi.com> 789;; Bugfixes by "Rolf Sandau" <Rolf.Sandau@marconi.com>
849(and 790(when (memq 'rul-generic-mode generic-extras-enable-list)
850(memq 'rul-generic-mode generic-extras-enable-list) 791
851;;; build the regexp strings using regexp-opt 792;;; build the regexp strings using regexp-opt
852(defvar installshield-statement-keyword-list 793(defvar installshield-statement-keyword-list
853 (list 794 (list
@@ -882,8 +823,7 @@ you must reload generic-x to enable the specified modes."
882 "typedef" 823 "typedef"
883 "until" 824 "until"
884 "void" 825 "void"
885 "while" 826 "while")
886 )
887 "Statement keywords used in InstallShield 3 and 5.") 827 "Statement keywords used in InstallShield 3 and 5.")
888 828
889(defvar installshield-system-functions-list 829(defvar installshield-system-functions-list
@@ -907,39 +847,39 @@ you must reload generic-x to enable the specified modes."
907 "ChangeDirectory" 847 "ChangeDirectory"
908 "CloseFile" 848 "CloseFile"
909 "CmdGetHwndDlg" 849 "CmdGetHwndDlg"
910 "ComponentAddItem" ; differs between IS3 and IS5 850 "ComponentAddItem" ; differs between IS3 and IS5
911 "ComponentCompareSizeRequired" ; IS5 only 851 "ComponentCompareSizeRequired" ; IS5 only
912 "ComponentDialog" 852 "ComponentDialog"
913 "ComponentError" ; IS5 only 853 "ComponentError" ; IS5 only
914 "ComponentFileEnum" ; IS5 only 854 "ComponentFileEnum" ; IS5 only
915 "ComponentFileInfo" ; IS5 only 855 "ComponentFileInfo" ; IS5 only
916 "ComponentFilterLanguage" ; IS5 only 856 "ComponentFilterLanguage" ; IS5 only
917 "ComponentFilterOS" ; IS5 only 857 "ComponentFilterOS" ; IS5 only
918 "ComponentGetData" ; IS5 only 858 "ComponentGetData" ; IS5 only
919 "ComponentGetItemInfo" ; IS3 only 859 "ComponentGetItemInfo" ; IS3 only
920 "ComponentGetItemSize" ; differs between IS3 and IS5 860 "ComponentGetItemSize" ; differs between IS3 and IS5
921 "ComponentIsItemSelected" ; differs between IS3 and IS5 861 "ComponentIsItemSelected" ; differs between IS3 and IS5
922 "ComponentListItems" 862 "ComponentListItems"
923 "ComponentMoveData" ; IS5 only 863 "ComponentMoveData" ; IS5 only
924 "ComponentSelectItem" ; differs between IS3 and IS5 864 "ComponentSelectItem" ; differs between IS3 and IS5
925 "ComponentSetData" ; IS5 only 865 "ComponentSetData" ; IS5 only
926 "ComponentSetItemInfo" ; IS3 only 866 "ComponentSetItemInfo" ; IS3 only
927 "ComponentSetTarget" ; IS5 only 867 "ComponentSetTarget" ; IS5 only
928 "ComponentSetupTypeEnum" ; IS5 only 868 "ComponentSetupTypeEnum" ; IS5 only
929 "ComponentSetupTypeGetData" ; IS5 only 869 "ComponentSetupTypeGetData" ; IS5 only
930 "ComponentSetupTypeSet" ; IS5 only 870 "ComponentSetupTypeSet" ; IS5 only
931 "ComponentTotalSize" 871 "ComponentTotalSize"
932 "ComponentValidate" ; IS5 only 872 "ComponentValidate" ; IS5 only
933 "CompressAdd" ; IS3 only 873 "CompressAdd" ; IS3 only
934 "CompressDel" ; IS3 only 874 "CompressDel" ; IS3 only
935 "CompressEnum" ; IS3 only 875 "CompressEnum" ; IS3 only
936 "CompressGet" ; IS3 only 876 "CompressGet" ; IS3 only
937 "CompressInfo" ; IS3 only 877 "CompressInfo" ; IS3 only
938 "CopyFile" 878 "CopyFile"
939 "CreateDir" 879 "CreateDir"
940 "CreateFile" 880 "CreateFile"
941 "CreateProgramFolder" 881 "CreateProgramFolder"
942 "DeinstallSetReference" ; IS5 only 882 "DeinstallSetReference" ; IS5 only
943 "DeinstallStart" 883 "DeinstallStart"
944 "Delay" 884 "Delay"
945 "DeleteDir" 885 "DeleteDir"
@@ -965,12 +905,12 @@ you must reload generic-x to enable the specified modes."
965 "FileDeleteLine" 905 "FileDeleteLine"
966 "FileGrep" 906 "FileGrep"
967 "FileInsertLine" 907 "FileInsertLine"
968 "FileSetBeginDefine" ; IS3 only 908 "FileSetBeginDefine" ; IS3 only
969 "FileSetEndDefine" ; IS3 only 909 "FileSetEndDefine" ; IS3 only
970 "FileSetPerformEz" ; IS3 only 910 "FileSetPerformEz" ; IS3 only
971 "FileSetPerform" ; IS3 only 911 "FileSetPerform" ; IS3 only
972 "FileSetReset" ; IS3 only 912 "FileSetReset" ; IS3 only
973 "FileSetRoot" ; IS3 only 913 "FileSetRoot" ; IS3 only
974 "FindAllDirs" 914 "FindAllDirs"
975 "FindAllFiles" 915 "FindAllFiles"
976 "FindFile" 916 "FindFile"
@@ -1024,7 +964,7 @@ you must reload generic-x to enable the specified modes."
1024 "Path" 964 "Path"
1025 "PlaceBitmap" 965 "PlaceBitmap"
1026 "PlaceWindow" 966 "PlaceWindow"
1027 "PlayMMedia" ; IS5 only 967 "PlayMMedia" ; IS5 only
1028 "ProgDefGroupType" 968 "ProgDefGroupType"
1029 "RegDBCreateKeyEx" 969 "RegDBCreateKeyEx"
1030 "RegDBDeleteValue" 970 "RegDBDeleteValue"
@@ -1084,7 +1024,7 @@ you must reload generic-x to enable the specified modes."
1084 "SdSelectFolder" 1024 "SdSelectFolder"
1085 "SdSetSequentialItems" 1025 "SdSetSequentialItems"
1086 "SdSetStatic" 1026 "SdSetStatic"
1087 "SdSetupTypeEx" ; IS5 only 1027 "SdSetupTypeEx" ; IS5 only
1088 "SdSetupType" 1028 "SdSetupType"
1089 "SdShowAnyDialog" 1029 "SdShowAnyDialog"
1090 "SdShowDlgEdit1" 1030 "SdShowDlgEdit1"
@@ -1101,14 +1041,14 @@ you must reload generic-x to enable the specified modes."
1101 "SetColor" 1041 "SetColor"
1102 "SetFont" 1042 "SetFont"
1103 "SetDialogTitle" 1043 "SetDialogTitle"
1104 "SetDisplayEffect" ; IS5 only 1044 "SetDisplayEffect" ; IS5 only
1105 "SetFileInfo" 1045 "SetFileInfo"
1106 "SetForegroundWindow" 1046 "SetForegroundWindow"
1107 "SetStatusWindow" 1047 "SetStatusWindow"
1108 "SetTitle" 1048 "SetTitle"
1109 "SetupType" 1049 "SetupType"
1110 "ShowProgramFolder" 1050 "ShowProgramFolder"
1111 "Split" ; IS3 only 1051 "Split" ; IS3 only
1112 "SprintfBox" 1052 "SprintfBox"
1113 "Sprintf" 1053 "Sprintf"
1114 "StatusUpdate" 1054 "StatusUpdate"
@@ -1129,8 +1069,7 @@ you must reload generic-x to enable the specified modes."
1129 "Welcome" 1069 "Welcome"
1130 "WriteLine" 1070 "WriteLine"
1131 "WriteProfString" 1071 "WriteProfString"
1132 "XCopyFile" 1072 "XCopyFile")
1133 )
1134 "System functions defined in InstallShield 3 and 5.") 1073 "System functions defined in InstallShield 3 and 5.")
1135 1074
1136(defvar installshield-system-variables-list 1075(defvar installshield-system-variables-list
@@ -1163,8 +1102,7 @@ you must reload generic-x to enable the specified modes."
1163 "WINDISK" 1102 "WINDISK"
1164 "WINMAJOR" 1103 "WINMAJOR"
1165 "WINSYSDIR" 1104 "WINSYSDIR"
1166 "WINSYSDISK" 1105 "WINSYSDISK")
1167 )
1168 "System variables used in InstallShield 3 and 5.") 1106 "System variables used in InstallShield 3 and 5.")
1169 1107
1170(defvar installshield-types-list 1108(defvar installshield-types-list
@@ -1186,8 +1124,7 @@ you must reload generic-x to enable the specified modes."
1186 "RGB" 1124 "RGB"
1187 "SHORT" 1125 "SHORT"
1188 "STRINGLIST" 1126 "STRINGLIST"
1189 "STRING" 1127 "STRING")
1190 )
1191 "Type keywords used in InstallShield 3 and 5.") 1128 "Type keywords used in InstallShield 3 and 5.")
1192 1129
1193;;; some might want to skip highlighting these to improve performance 1130;;; some might want to skip highlighting these to improve performance
@@ -1397,111 +1334,104 @@ you must reload generic-x to enable the specified modes."
1397 "WINMINOR" 1334 "WINMINOR"
1398 "WIN32SINSTALLED" 1335 "WIN32SINSTALLED"
1399 "WIN32SMAJOR" 1336 "WIN32SMAJOR"
1400 "WIN32SMINOR" 1337 "WIN32SMINOR")
1401 )
1402 "Function argument constants used in InstallShield 3 and 5.") 1338 "Function argument constants used in InstallShield 3 and 5.")
1403 1339
1404(progn 1340(defvar rul-generic-mode-syntax-table nil
1405 (defvar rul-generic-mode-syntax-table nil 1341 "Syntax table to use in rul-generic-mode buffers.")
1406 "Syntax table to use in rul-generic-mode buffers.") 1342
1407 1343(setq rul-generic-mode-syntax-table
1408 (setq rul-generic-mode-syntax-table 1344 (make-syntax-table c++-mode-syntax-table))
1409 (make-syntax-table c++-mode-syntax-table)) 1345
1410 1346(modify-syntax-entry ?\r "> b" rul-generic-mode-syntax-table)
1411 (modify-syntax-entry ?\r "> b" rul-generic-mode-syntax-table) 1347(modify-syntax-entry ?\n "> b" rul-generic-mode-syntax-table)
1412 (modify-syntax-entry ?\n "> b" rul-generic-mode-syntax-table) 1348
1413 1349(modify-syntax-entry ?/ ". 124b" rul-generic-mode-syntax-table)
1414 (modify-syntax-entry ?/ ". 124b" rul-generic-mode-syntax-table) 1350(modify-syntax-entry ?* ". 23" rul-generic-mode-syntax-table)
1415 (modify-syntax-entry ?* ". 23" rul-generic-mode-syntax-table) 1351
1416 1352;; here manually instead
1417 ;; here manually instead 1353(defun generic-rul-mode-setup-function ()
1418 (defun generic-rul-mode-setup-function () 1354 (make-local-variable 'parse-sexp-ignore-comments)
1419 (make-local-variable 'parse-sexp-ignore-comments) 1355 (make-local-variable 'comment-start)
1420 (make-local-variable 'comment-start) 1356 (make-local-variable 'comment-start-skip)
1421 (make-local-variable 'comment-start-skip) 1357 (make-local-variable 'comment-end)
1422 (make-local-variable 'comment-end) 1358 (setq imenu-generic-expression
1423 (setq imenu-generic-expression 1359 '((nil "^function\\s-+\\([A-Za-z0-9_]+\\)" 1))
1424 '((nil "^function\\s-+\\([A-Za-z0-9_]+\\)" 1)) 1360 parse-sexp-ignore-comments t
1425 parse-sexp-ignore-comments t 1361 comment-end "*/"
1426 comment-end "*/" 1362 comment-start "/*"
1427 comment-start "/*" 1363;;; comment-end ""
1428;; comment-end "" 1364;;; comment-start "//"
1429;; comment-start "//" 1365;;; comment-start-skip ""
1430;; comment-start-skip "" 1366 )
1431 ) 1367 ;; (set-syntax-table rul-generic-mode-syntax-table)
1432;; (set-syntax-table rul-generic-mode-syntax-table) 1368 (setq font-lock-syntax-table rul-generic-mode-syntax-table))
1433 (setq font-lock-syntax-table rul-generic-mode-syntax-table) 1369
1434 ) 1370;; moved mode-definition behind defun-definition to be warning-free - 15.11.02/RSan
1435 1371(define-generic-mode rul-generic-mode
1436 ;; moved mode-definition behind defun-definition to be warning-free - 15.11.02/RSan 1372 ;; Using "/*" and "*/" doesn't seem to be working right
1437 (define-generic-mode 'rul-generic-mode 1373 (list "//" '("/*" . "*/" ))
1438 ;; Using "/*" and "*/" doesn't seem to be working right 1374 installshield-statement-keyword-list
1439 (list "//" '("/*" . "*/" )) 1375 (list
1440 installshield-statement-keyword-list 1376 ;; preprocessor constructs
1441 (list 1377 '("#[ \t]*include[ \t]+\\(<[^>\"\n]+>\\)"
1442 ;; preprocessor constructs 1378 1 font-lock-string-face)
1443 '("#[ \t]*include[ \t]+\\(<[^>\"\n]+>\\)" 1379 '("#[ \t]*\\(\\sw+\\)\\>[ \t]*\\(\\sw+\\)?"
1444 1 font-lock-string-face) 1380 (1 font-lock-reference-face)
1445 '("#[ \t]*\\(\\sw+\\)\\>[ \t]*\\(\\sw+\\)?" 1381 (2 font-lock-variable-name-face nil t))
1446 (1 font-lock-reference-face) 1382 ;; indirect string constants
1447 (2 font-lock-variable-name-face nil t)) 1383 '("\\(@[A-Za-z][A-Za-z0-9_]+\\)" 1 font-lock-builtin-face)
1448 ;; indirect string constants 1384 ;; gotos
1449 '("\\(@[A-Za-z][A-Za-z0-9_]+\\)" 1 font-lock-builtin-face) 1385 '("[ \t]*\\(\\sw+:\\)" 1 font-lock-reference-face)
1450 ;; gotos 1386 '("\\<\\(goto\\)\\>[ \t]*\\(\\sw+\\)?"
1451 '("[ \t]*\\(\\sw+:\\)" 1 font-lock-reference-face) 1387 (1 font-lock-keyword-face)
1452 '("\\<\\(goto\\)\\>[ \t]*\\(\\sw+\\)?" 1388 (2 font-lock-reference-face nil t))
1453 (1 font-lock-keyword-face) 1389 ;; system variables
1454 (2 font-lock-reference-face nil t)) 1390 (generic-make-keywords-list
1455 ;; system variables 1391 installshield-system-variables-list
1456 (generic-make-keywords-list 1392 'font-lock-variable-name-face "[^_]" "[^_]")
1457 installshield-system-variables-list 1393 ;; system functions
1458 'font-lock-variable-name-face "[^_]" "[^_]") 1394 (generic-make-keywords-list
1459 ;; system functions 1395 installshield-system-functions-list
1460 (generic-make-keywords-list 1396 'font-lock-function-name-face "[^_]" "[^_]")
1461 installshield-system-functions-list 1397 ;; type keywords
1462 'font-lock-function-name-face "[^_]" "[^_]") 1398 (generic-make-keywords-list
1463 ;; type keywords 1399 installshield-types-list
1464 (generic-make-keywords-list 1400 'font-lock-type-face "[^_]" "[^_]")
1465 installshield-types-list 1401 ;; function argument constants
1466 'font-lock-type-face "[^_]" "[^_]") 1402 (generic-make-keywords-list
1467 ;; function argument constants 1403 installshield-funarg-constants-list
1468 (generic-make-keywords-list 1404 'font-lock-variable-name-face "[^_]" "[^_]")) ; is this face the best choice?
1469 installshield-funarg-constants-list 1405 (list "\\.[rR][uU][lL]$")
1470 'font-lock-variable-name-face "[^_]" "[^_]") ; is this face the best choice? 1406 (list 'generic-rul-mode-setup-function)
1471 ) 1407 "Generic mode for InstallShield RUL files.")
1472 (list "\\.[rR][uU][lL]$") 1408
1473 (list 'generic-rul-mode-setup-function)
1474 "Generic mode for InstallShield RUL files.")
1475)
1476(define-skeleton rul-if 1409(define-skeleton rul-if
1477 "Insert an if statement." 1410 "Insert an if statement."
1478 "condition: " 1411 "condition: "
1479 "if(" str ") then" \n 1412 "if(" str ") then" \n
1480 > _ \n 1413 > _ \n
1481 ( "other condition, %s: " 1414 ( "other condition, %s: "
1482 > "elseif(" str ") then" \n 1415 > "elseif(" str ") then" \n
1483 > \n) 1416 > \n)
1484 > "else" \n 1417 > "else" \n
1485 > \n 1418 > \n
1486 resume: 1419 resume:
1487 > "endif;" 1420 > "endif;")
1488 )
1489 1421
1490(define-skeleton rul-function 1422(define-skeleton rul-function
1491 "Insert a function statement." 1423 "Insert a function statement."
1492 "function: " 1424 "function: "
1493 "function " str " ()" \n 1425 "function " str " ()" \n
1494 ( "local variables, %s: " 1426 ( "local variables, %s: "
1495 > " " str ";" \n) 1427 > " " str ";" \n)
1496 > "begin" \n 1428 > "begin" \n
1497 > _ \n 1429 > _ \n
1498 resume: 1430 resume:
1499 > "end;") 1431 > "end;"))
1500
1501)
1502 1432
1503;; Additions by ACorreir@pervasive-sw.com (Alfred Correira) 1433;; Additions by ACorreir@pervasive-sw.com (Alfred Correira)
1504(define-generic-mode 'mailrc-generic-mode 1434(define-generic-mode mailrc-generic-mode
1505 (list ?#) 1435 (list ?#)
1506 (list 1436 (list
1507 "alias" 1437 "alias"
@@ -1512,8 +1442,7 @@ you must reload generic-x to enable the specified modes."
1512 "ignore" 1442 "ignore"
1513 "set" 1443 "set"
1514 "source" 1444 "source"
1515 "unset" 1445 "unset")
1516 )
1517 '(("^\\s-*\\(alias\\|group\\)\\s-+\\([-A-Za-z0-9_]+\\)\\s-+\\([^\n\r#]*\\)\\(#.*\\)?$" 1446 '(("^\\s-*\\(alias\\|group\\)\\s-+\\([-A-Za-z0-9_]+\\)\\s-+\\([^\n\r#]*\\)\\(#.*\\)?$"
1518 (2 font-lock-constant-face) (3 font-lock-variable-name-face)) 1447 (2 font-lock-constant-face) (3 font-lock-variable-name-face))
1519 ("^\\s-*\\(unset\\|set\\|ignore\\)\\s-+\\([-A-Za-z0-9_]+\\)=?\\([^\n\r#]*\\)\\(#.*\\)?$" 1448 ("^\\s-*\\(unset\\|set\\|ignore\\)\\s-+\\([-A-Za-z0-9_]+\\)=?\\([^\n\r#]*\\)\\(#.*\\)?$"
@@ -1525,10 +1454,9 @@ you must reload generic-x to enable the specified modes."
1525 "Mode for mailrc files.") 1454 "Mode for mailrc files.")
1526 1455
1527;; Inetd.conf 1456;; Inetd.conf
1528(and 1457(when (memq 'inetd-conf-generic-mode generic-extras-enable-list)
1529 (memq 'inetd-conf-generic-mode generic-extras-enable-list)
1530 1458
1531(define-generic-mode 'inetd-conf-generic-mode 1459(define-generic-mode inetd-conf-generic-mode
1532 (list ?#) 1460 (list ?#)
1533 (list 1461 (list
1534 "stream" 1462 "stream"
@@ -1537,142 +1465,139 @@ you must reload generic-x to enable the specified modes."
1537 "udp" 1465 "udp"
1538 "wait" 1466 "wait"
1539 "nowait" 1467 "nowait"
1540 "internal" 1468 "internal")
1541 ) 1469 '(("^\\([-A-Za-z0-9_]+\\)"
1542 '( 1470 1 'font-lock-type-face))
1543 ("^\\([-A-Za-z0-9_]+\\)"
1544 1 'font-lock-type-face)
1545 )
1546 '("/etc/inetd.conf\\'") 1471 '("/etc/inetd.conf\\'")
1547 (list 1472 (list
1548 (function 1473 (function
1549 (lambda () 1474 (lambda ()
1550 (setq imenu-generic-expression 1475 (setq imenu-generic-expression
1551 '((nil "^\\([-A-Za-z0-9_]+\\)" 1))) 1476 '((nil "^\\([-A-Za-z0-9_]+\\)" 1))))))))
1552 )))
1553 )
1554)
1555 1477
1556;; Services 1478;; Services
1557(and 1479(when (memq 'etc-services-generic-mode generic-extras-enable-list)
1558 (memq 'etc-services-generic-mode generic-extras-enable-list)
1559 1480
1560(define-generic-mode 'etc-services-generic-mode 1481(define-generic-mode etc-services-generic-mode
1561 (list ?#) 1482 (list ?#)
1562 (list 1483 (list
1563 "tcp" 1484 "tcp"
1564 "udp" 1485 "udp"
1565 "ddp" 1486 "ddp")
1566 ) 1487 '(("^\\([-A-Za-z0-9_]+\\)\\s-+\\([0-9]+\\)/"
1567 '(
1568 ("^\\([-A-Za-z0-9_]+\\)\\s-+\\([0-9]+\\)/"
1569 (1 'font-lock-type-face) 1488 (1 'font-lock-type-face)
1570 (2 'font-lock-variable-name-face) 1489 (2 'font-lock-variable-name-face)))
1571 )
1572 )
1573 '("/etc/services\\'") 1490 '("/etc/services\\'")
1574 (list 1491 (list
1575 (function 1492 (function
1576 (lambda () 1493 (lambda ()
1577 (setq imenu-generic-expression 1494 (setq imenu-generic-expression
1578 '((nil "^\\([-A-Za-z0-9_]+\\)" 1))) 1495 '((nil "^\\([-A-Za-z0-9_]+\\)" 1))))))))
1579 )))
1580 )
1581)
1582 1496
1583;; Password and Group files 1497;; Password and Group files
1584(and 1498(when (memq 'etc-passwd-generic-mode generic-extras-enable-list)
1585 (memq 'etc-passwd-generic-mode generic-extras-enable-list)
1586 1499
1587(define-generic-mode 'etc-passwd-generic-mode 1500(define-generic-mode etc-passwd-generic-mode
1588 nil ;; No comment characters 1501 nil ;; No comment characters
1589 (list "root") ;; Only one keyword 1502 (list "root") ;; Only one keyword
1590 (list 1503 (list
1591 (list 1504 (list
1592 (concat 1505 (concat
1593 "^" 1506 "^"
1594 ;; User name -- Never blank! 1507 ;; User name -- Never blank!
1595 "\\([^:]+\\)" 1508 "\\([^:]+\\)"
1596 ":" 1509 ":"
1597 ;; Password, UID and GID 1510 ;; Password, UID and GID
1598 (mapconcat 1511 (mapconcat
1599 'identity 1512 'identity
1600 (make-list 3 "\\([^:]+\\)") 1513 (make-list 3 "\\([^:]+\\)")
1601 ":" 1514 ":")
1602 ) 1515 ":"
1603 ":" 1516 ;; GECOS/Name -- might be blank
1604 ;; GECOS/Name -- might be blank 1517 "\\([^:]*\\)"
1605 "\\([^:]*\\)" 1518 ":"
1606 ":" 1519 ;; Home directory and shell
1607 ;; Home directory and shell 1520 "\\([^:]+\\)"
1608 "\\([^:]+\\)" 1521 ":?"
1609 ":?" 1522 "\\([^:]*\\)"
1610 "\\([^:]*\\)" 1523 "$")
1611 "$" 1524 '(1 'font-lock-type-face)
1612 ) 1525 '(5 'font-lock-variable-name-face)
1613 '(1 'font-lock-type-face) 1526 '(6 'font-lock-constant-face)
1614 '(5 'font-lock-variable-name-face) 1527 '(7 'font-lock-warning-face))
1615 '(6 'font-lock-constant-face) 1528 '("^\\([^:]+\\):\\([^:]*\\):\\([0-9]+\\):\\(.*\\)$"
1616 '(7 'font-lock-warning-face) 1529 (1 'font-lock-type-face)
1617 ) 1530 (4 'font-lock-variable-name-face)))
1618 '("^\\([^:]+\\):\\([^:]*\\):\\([0-9]+\\):\\(.*\\)$"
1619 (1 'font-lock-type-face)
1620 (4 'font-lock-variable-name-face)
1621 )
1622 )
1623 '("/etc/passwd\\'" "/etc/group\\'") 1531 '("/etc/passwd\\'" "/etc/group\\'")
1624 (list 1532 (list
1625 (function 1533 (function
1626 (lambda () 1534 (lambda ()
1627 (setq imenu-generic-expression 1535 (setq imenu-generic-expression
1628 '((nil "^\\([-A-Za-z0-9_]+\\):" 1))) 1536 '((nil "^\\([-A-Za-z0-9_]+\\):" 1))))))))
1629 )))
1630 )
1631)
1632 1537
1633;; Fstab 1538;; Fstab
1634(and 1539(when (memq 'etc-fstab-generic-mode generic-extras-enable-list)
1635 (memq 'etc-fstab-generic-mode generic-extras-enable-list)
1636 1540
1637(define-generic-mode 'etc-fstab-generic-mode 1541(define-generic-mode etc-fstab-generic-mode
1638 (list ?#) 1542 (list ?#)
1639 (list 1543 (list
1544 "adfs"
1545 "affs"
1546 "autofs"
1547 "coda"
1548 "coherent"
1549 "cramfs"
1550 "devpts"
1551 "efs"
1640 "ext2" 1552 "ext2"
1641 "fd" 1553 "ext3"
1554 "hfs"
1555 "hpfs"
1642 "iso9660" 1556 "iso9660"
1557 "jfs"
1558 "minix"
1559 "msdos"
1560 "ncpfs"
1643 "nfs" 1561 "nfs"
1562 "ntfs"
1644 "proc" 1563 "proc"
1645 "swap" 1564 "qnx4"
1565 "reiserfs"
1566 "romfs"
1567 "smbfs"
1568 "sysv"
1569 "tmpfs"
1570 "udf"
1646 "ufs" 1571 "ufs"
1647 ) 1572 "umsdos"
1648 '( 1573 "vfat"
1649 ("^\\([/-A-Za-z0-9_]+\\)\\s-+\\([/-A-Za-z0-9_]+\\)" 1574 "xenix"
1575 "xfs"
1576 "swap"
1577 "auto"
1578 "ignore")
1579 '(("^\\([/-A-Za-z0-9_]+\\)\\s-+\\([/-A-Za-z0-9_]+\\)"
1650 (1 'font-lock-type-face) 1580 (1 'font-lock-type-face)
1651 (2 'font-lock-variable-name-face) 1581 (2 'font-lock-variable-name-face)))
1652 )
1653 )
1654 '("/etc/[v]*fstab\\'") 1582 '("/etc/[v]*fstab\\'")
1655 (list 1583 (list
1656 (function 1584 (function
1657 (lambda () 1585 (lambda ()
1658 (setq imenu-generic-expression 1586 (setq imenu-generic-expression
1659 '((nil "^\\([/-A-Za-z0-9_]+\\)\\s-+" 1))) 1587 '((nil "^\\([/-A-Za-z0-9_]+\\)\\s-+" 1))))))))
1660 )))
1661 )
1662)
1663 1588
1664;; From Jacques Duthen <jacques.duthen@sncf.fr> 1589;; From Jacques Duthen <jacques.duthen@sncf.fr>
1665(defvar show-tabs-generic-mode-font-lock-defaults-1 1590(defvar show-tabs-generic-mode-font-lock-defaults-1
1666 '( ;; trailing spaces must come before... 1591 '( ;; trailing spaces must come before...
1667 ("[ \t]+$" . 'show-tabs-space-face) 1592 ("[ \t]+$" . 'show-tabs-space-face)
1668 ;; ...embedded tabs 1593 ;; ...embedded tabs
1669 ("[^\n\t]\\(\t+\\)" (1 'show-tabs-tab-face)))) 1594 ("[^\n\t]\\(\t+\\)" (1 'show-tabs-tab-face))))
1670 1595
1671(defvar show-tabs-generic-mode-font-lock-defaults-2 1596(defvar show-tabs-generic-mode-font-lock-defaults-2
1672 '( ;; trailing spaces must come before... 1597 '( ;; trailing spaces must come before...
1673 ("[ \t]+$" . 'show-tabs-space-face) 1598 ("[ \t]+$" . 'show-tabs-space-face)
1674 ;; ...tabs 1599 ;; ...tabs
1675 ("\t+" . 'show-tabs-tab-face))) 1600 ("\t+" . 'show-tabs-tab-face)))
1676 1601
1677(defface show-tabs-tab-face 1602(defface show-tabs-tab-face
1678 '((((class grayscale) (background light)) (:foreground "LightGray" :weight bold)) 1603 '((((class grayscale) (background light)) (:foreground "LightGray" :weight bold))
@@ -1692,10 +1617,10 @@ you must reload generic-x to enable the specified modes."
1692 "Font Lock mode face used to highlight spaces." 1617 "Font Lock mode face used to highlight spaces."
1693 :group 'show-tabs) 1618 :group 'show-tabs)
1694 1619
1695(define-generic-mode 'show-tabs-generic-mode 1620(define-generic-mode show-tabs-generic-mode
1696 () ;; no comment char 1621 () ;; no comment char
1697 () ;; no keywords 1622 () ;; no keywords
1698 show-tabs-generic-mode-font-lock-defaults-1 1623 show-tabs-generic-mode-font-lock-defaults-1
1699 () ;; no auto-mode-alist 1624 () ;; no auto-mode-alist
1700 ;; (list 'show-tabs-generic-mode-hook-fun) 1625 ;; (list 'show-tabs-generic-mode-hook-fun)
1701 nil 1626 nil
@@ -1705,41 +1630,37 @@ you must reload generic-x to enable the specified modes."
1705;; DNS modes 1630;; DNS modes
1706;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 1631;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1707 1632
1708(define-generic-mode 'named-boot-generic-mode 1633(define-generic-mode named-boot-generic-mode
1709 ;;List of comment characters 1634 ;; List of comment characters
1710 (list ?\;) 1635 (list ?\;)
1711 ;;List of keywords 1636 ;; List of keywords
1712 (list "cache" "primary" "secondary" "forwarders" "limit" "options" 1637 (list "cache" "primary" "secondary" "forwarders" "limit" "options"
1713 "directory" "check-names") 1638 "directory" "check-names")
1714 ;;List of additional font-lock-expressions 1639 ;; List of additional font-lock-expressions
1715 (list 1640 (list
1716 (list "\\([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+\\)" 1 'font-lock-constant-face) 1641 (list "\\([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+\\)" 1 'font-lock-constant-face)
1717 (list "^directory\\s-+\\(.*\\)" 1 'font-lock-variable-name-face) 1642 (list "^directory\\s-+\\(.*\\)" 1 'font-lock-variable-name-face)
1718 (list "^\\(primary\\|cache\\)\\s-+\\([.A-Za-z]+\\)\\s-+\\(.*\\)" 1643 (list "^\\(primary\\|cache\\)\\s-+\\([.A-Za-z]+\\)\\s-+\\(.*\\)"
1719 (list 2 'font-lock-variable-name-face) 1644 (list 2 'font-lock-variable-name-face)
1720 (list 3 'font-lock-constant-face)) 1645 (list 3 'font-lock-constant-face)))
1721 ) 1646 ;; List of additional automode-alist expressions
1722 ;;List of additional automode-alist expressions
1723 (list "/etc/named.boot\\'") 1647 (list "/etc/named.boot\\'")
1724 ;;List of set up functions to call 1648 ;; List of set up functions to call
1725 nil 1649 nil)
1726 )
1727 1650
1728(define-generic-mode 'named-database-generic-mode 1651(define-generic-mode named-database-generic-mode
1729 ;;List of comment characters 1652 ;; List of comment characters
1730 (list ?\;) 1653 (list ?\;)
1731 ;;List of keywords 1654 ;; List of keywords
1732 (list "IN" "NS" "CNAME" "SOA" "PTR" "MX" "A") 1655 (list "IN" "NS" "CNAME" "SOA" "PTR" "MX" "A")
1733 ;;List of additional font-lock-expressions 1656 ;; List of additional font-lock-expressions
1734 (list 1657 (list
1735 (list "\\([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+\\)" 1 'font-lock-constant-face) 1658 (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) 1659 (list "^\\([.A-Za-z0-9]+\\)" 1 'font-lock-variable-name-face))
1737 ) 1660 ;; List of additional automode-alist expressions
1738 ;;List of additional automode-alist expressions
1739 nil
1740 ;;List of set up functions to call
1741 nil 1661 nil
1742 ) 1662 ;; List of set up functions to call
1663 nil)
1743 1664
1744(defvar named-database-time-string "%Y%m%d%H" 1665(defvar named-database-time-string "%Y%m%d%H"
1745 "Timestring for named serial numbers.") 1666 "Timestring for named serial numbers.")
@@ -1747,27 +1668,25 @@ you must reload generic-x to enable the specified modes."
1747(defun named-database-print-serial () 1668(defun named-database-print-serial ()
1748 "Print a serial number based on the current date." 1669 "Print a serial number based on the current date."
1749 (interactive) 1670 (interactive)
1750 (insert (format-time-string named-database-time-string (current-time))) 1671 (insert (format-time-string named-database-time-string (current-time))))
1751 )
1752 1672
1753(define-generic-mode 'resolve-conf-generic-mode 1673(define-generic-mode resolve-conf-generic-mode
1754 ;;List of comment characters 1674 ;; List of comment characters
1755 (list ?#) 1675 (list ?#)
1756 ;;List of keywords 1676 ;; List of keywords
1757 (list "nameserver" "domain" "search" "sortlist" "options") 1677 (list "nameserver" "domain" "search" "sortlist" "options")
1758 ;;List of additional font-lock-expressions 1678 ;; List of additional font-lock-expressions
1759 nil 1679 nil
1760 ;;List of additional automode-alist expressions 1680 ;; List of additional automode-alist expressions
1761 (list "/etc/resolv[e]?.conf\\'") 1681 (list "/etc/resolv[e]?.conf\\'")
1762 ;;List of set up functions to call 1682 ;; List of set up functions to call
1763 nil 1683 nil)
1764 )
1765 1684
1766;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 1685;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1767;; Modes for spice and common electrical engineering circuit netlist formats 1686;; Modes for spice and common electrical engineering circuit netlist formats
1768;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 1687;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1769 1688
1770(define-generic-mode 'spice-generic-mode 1689(define-generic-mode spice-generic-mode
1771 nil 1690 nil
1772 (list 1691 (list
1773 "and" 1692 "and"
@@ -1784,8 +1703,7 @@ you must reload generic-x to enable the specified modes."
1784 "vccap" 1703 "vccap"
1785 "vccs" 1704 "vccs"
1786 "vcr" 1705 "vcr"
1787 "vcvs" 1706 "vcvs")
1788 )
1789 '( 1707 '(
1790 ("^\\s-*\\([*].*\\)" 1 'font-lock-comment-face) 1708 ("^\\s-*\\([*].*\\)" 1 'font-lock-comment-face)
1791 (" \\(\\$ .*\\)$" 1 'font-lock-comment-face) 1709 (" \\(\\$ .*\\)$" 1 'font-lock-comment-face)
@@ -1795,8 +1713,7 @@ you must reload generic-x to enable the specified modes."
1795 ("^\\s-*\\([.]\\w+\\>\\)" 1 'font-lock-keyword-face) 1713 ("^\\s-*\\([.]\\w+\\>\\)" 1 'font-lock-keyword-face)
1796 ("\\(\\([.]\\|_\\|\\w\\)+\\)\\s-*=" 1 'font-lock-variable-name-face) 1714 ("\\(\\([.]\\|_\\|\\w\\)+\\)\\s-*=" 1 'font-lock-variable-name-face)
1797 ("\\('[^']+'\\)" 1 'font-lock-string-face) 1715 ("\\('[^']+'\\)" 1 'font-lock-string-face)
1798 ("\\(\"[^\"]+\"\\)" 1 'font-lock-string-face) 1716 ("\\(\"[^\"]+\"\\)" 1 'font-lock-string-face))
1799 )
1800 (list "\\.[sS][pP]\\'" 1717 (list "\\.[sS][pP]\\'"
1801 "\\.[sS][pP][iI]\\'" 1718 "\\.[sS][pP][iI]\\'"
1802 "\\.[sS][pP][iI][cC][eE]\\'" 1719 "\\.[sS][pP][iI][cC][eE]\\'"
@@ -1806,24 +1723,20 @@ you must reload generic-x to enable the specified modes."
1806 ;; Make keywords case-insensitive 1723 ;; Make keywords case-insensitive
1807 (function 1724 (function
1808 (lambda() 1725 (lambda()
1809 (setq font-lock-defaults (list 'generic-font-lock-defaults nil t)))) 1726 (setq font-lock-defaults (list 'generic-font-lock-defaults nil t)))))
1810 ) 1727 "Generic mode for SPICE circuit netlist files.")
1811 "Generic mode for SPICE circuit netlist files."
1812 )
1813 1728
1814(define-generic-mode 'ibis-generic-mode 1729(define-generic-mode ibis-generic-mode
1815 (list ?|) 1730 (list ?|)
1816 nil 1731 nil
1817 '( 1732 '(
1818 ("[[]\\([^]]*\\)[]]" 1 'font-lock-keyword-face) 1733 ("[[]\\([^]]*\\)[]]" 1 'font-lock-keyword-face)
1819 ("\\(\\(_\\|\\w\\)+\\)\\s-*=" 1 'font-lock-variable-name-face) 1734 ("\\(\\(_\\|\\w\\)+\\)\\s-*=" 1 'font-lock-variable-name-face))
1820 )
1821 (list "\\.[iI][bB][sS]\\'") 1735 (list "\\.[iI][bB][sS]\\'")
1822 (list 'generic-bracket-support) 1736 (list 'generic-bracket-support)
1823 "Generic mode for IBIS circuit netlist files." 1737 "Generic mode for IBIS circuit netlist files.")
1824 )
1825 1738
1826(define-generic-mode 'astap-generic-mode 1739(define-generic-mode astap-generic-mode
1827 nil 1740 nil
1828 (list 1741 (list
1829 "analyze" 1742 "analyze"
@@ -1838,16 +1751,13 @@ you must reload generic-x to enable the specified modes."
1838 "print" 1751 "print"
1839 "run" 1752 "run"
1840 "controls" 1753 "controls"
1841 "table" 1754 "table")
1842 ) 1755 '(("^\\s-*\\([*].*\\)" 1 'font-lock-comment-face)
1843 '(
1844 ("^\\s-*\\([*].*\\)" 1 'font-lock-comment-face)
1845 (";\\s-*\\([*].*\\)" 1 'font-lock-comment-face) 1756 (";\\s-*\\([*].*\\)" 1 'font-lock-comment-face)
1846 ("^\\s-*\\([.]\\w+\\>\\)" 1 'font-lock-keyword-face) 1757 ("^\\s-*\\([.]\\w+\\>\\)" 1 'font-lock-keyword-face)
1847 ("\\('[^']+'\\)" 1 'font-lock-string-face) 1758 ("\\('[^']+'\\)" 1 'font-lock-string-face)
1848 ("\\(\"[^\"]+\"\\)" 1 'font-lock-string-face) 1759 ("\\(\"[^\"]+\"\\)" 1 'font-lock-string-face)
1849 ("[(,]\\s-*\\(\\([.]\\|_\\|\\w\\)+\\)\\s-*=" 1 'font-lock-variable-name-face) 1760 ("[(,]\\s-*\\(\\([.]\\|_\\|\\w\\)+\\)\\s-*=" 1 'font-lock-variable-name-face))
1850 )
1851 (list "\\.[aA][pP]\\'" 1761 (list "\\.[aA][pP]\\'"
1852 "\\.[aA][sS][xX]\\'" 1762 "\\.[aA][sS][xX]\\'"
1853 "\\.[aA][sS][tT][aA][pP]\\'" 1763 "\\.[aA][sS][tT][aA][pP]\\'"
@@ -1859,15 +1769,13 @@ you must reload generic-x to enable the specified modes."
1859 ;; Make keywords case-insensitive 1769 ;; Make keywords case-insensitive
1860 (function 1770 (function
1861 (lambda() 1771 (lambda()
1862 (setq font-lock-defaults (list 'generic-font-lock-defaults nil t)))) 1772 (setq font-lock-defaults (list 'generic-font-lock-defaults nil t)))))
1863 ) 1773 "Generic mode for ASTAP circuit netlist files.")
1864 "Generic mode for ASTAP circuit netlist files."
1865 )
1866 1774
1867(define-generic-mode 'etc-modules-conf-generic-mode 1775(define-generic-mode etc-modules-conf-generic-mode
1868 ;;List of comment characters 1776 ;; List of comment characters
1869 (list ?#) 1777 (list ?#)
1870 ;;List of keywords 1778 ;; List of keywords
1871 (list 1779 (list
1872 "above" 1780 "above"
1873 "alias" 1781 "alias"
@@ -1900,13 +1808,12 @@ you must reload generic-x to enable the specified modes."
1900 "pre-remove" 1808 "pre-remove"
1901 "remove" 1809 "remove"
1902 "persistdir") 1810 "persistdir")
1903 ;;List of additional font-lock-expressions 1811 ;; List of additional font-lock-expressions
1904 nil 1812 nil
1905 ;;List of additional automode-alist expressions 1813 ;; List of additional automode-alist expressions
1906 (list "/etc/modules.conf" "/etc/conf.modules") 1814 (list "/etc/modules.conf" "/etc/conf.modules")
1907 ;;List of set up functions to call 1815 ;; List of set up functions to call
1908 nil 1816 nil)
1909 )
1910 1817
1911(provide 'generic-x) 1818(provide 'generic-x)
1912 1819