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