Commit ffe0c7ef authored by Peter Breton's avatar Peter Breton
Browse files

Added new InstallShield keywords.

Change font-lock-reference-face to font-lock-constant-face throughout.

(resolve-conf-generic-mode): Added this mode.
(named-database-generic-mode): Added this mode.
(named-boot-generic-mode): Added this mode.
(apache-conf-generic-mode): Added Directories and Locations to imenu-generic-expression.
(generic-define-mswindows-modes): Added apache-conf-generic-mode and apache-log-generic-mode.
(generic-define-unix-modes): Added apache-conf-generic-mode and apache-log-generic-mode.
(apache-conf-generic-mode): This new mode replaces apache-generic-mode.
(apache-log-generic-mode): Added this generic-mode
parent 83346ee8
......@@ -26,7 +26,7 @@
;;; Commentary:
;;
;; This file contains some pre-defined generic-modes.
;;
;;
;; INSTALLATION:
;;
;; Add this line to your .emacs file:
......@@ -37,7 +37,7 @@
;; `generic-extras-enable-list'. Some platform-specific modes are
;; affected by the variables `generic-define-mswindows-modes' and
;; `generic-define-unix-modes' (which see).
;;
;;
;; You can also send in new modes; if the file types a reasonably common,
;; we would like to install them.
;;
......@@ -48,17 +48,17 @@
;; Love]
;;
;; From Anders Lindgren <andersl@csd.uu.se>
;;
;;
;; Problem summary: Wayne Adams has found a problem when using folding
;; mode in conjuction with font-lock for a mode defined in
;; `generic-x.el'.
;;
;; The problem, as Wayne described it, was that error messages of the
;; following form appeared when both font-lock and folding are used:
;;
;;
;; > - various msgs including "Fontifying region...(error Stack
;; > overflow in regexp matcher)" appear
;;
;;
;; I have just tracked down the cause of the problem. The regexp:s in
;; `generic-x.el' does not take into account the way that folding
;; hides sections of the buffer. The technique is known as
......@@ -66,26 +66,26 @@
;; started using it back in the good old' Emacs 18 days). Basically, a
;; section is hidden by creating one very long line were the newline
;; character (C-j) is replaced by a linefeed (C-m) character.
;;
;;
;; Many other hiding packages, besides folding, use the same technique,
;; the problem should occur when using them as well.
;;
;;
;; The erroronous lines in `generic-extras' look like the following (this
;; example is from the `ini' section):
;;
;; '(("^\\(\\[.*\\]\\)" 1 'font-lock-reference-face)
;;
;; '(("^\\(\\[.*\\]\\)" 1 'font-lock-constant-face)
;; ("^\\(.*\\)=" 1 'font-lock-variable-name-face)
;;
;;
;; The intention of these lines is to highlight lines of the following
;; form:
;;
;;
;; [foo]
;; bar = xxx
;;
;;
;; However, since the `.' regexp symbol match the linefeed character the
;; entire folded section is searched, resulting in a regexp stack
;; overflow.
;;
;;
;; Solution suggestion 2: Instead of using ".", use the sequence
;; "[^\n\r]". This will make the rules behave just as before, but they
;; will work together with selective-display.
......@@ -106,13 +106,13 @@
Each entry in the list should be a symbol.
The variables `generic-define-mswindows-modes' and `generic-define-unix-modes'
also affect which generic modes are defined.
Please note that if you set this variable after generic-x is loaded,
Please note that if you set this variable after generic-x is loaded,
you must reload generic-x to enable the specified modes."
:group 'generic-x
:type '(repeat sexp)
:type '(repeat sexp)
)
(defcustom generic-define-mswindows-modes
(defcustom generic-define-mswindows-modes
(memq system-type (list 'windows-nt 'ms-dos))
"*If non-nil, some MS-Windows specific generic modes will be defined."
:group 'generic-x
......@@ -128,21 +128,27 @@ you must reload generic-x to enable the specified modes."
(and generic-define-mswindows-modes
(setq generic-extras-enable-list
(append (list 'bat-generic-mode 'ini-generic-mode
'inf-generic-mode 'rc-generic-mode
(append (list 'bat-generic-mode 'ini-generic-mode
'inf-generic-mode 'rc-generic-mode
'reg-generic-mode 'rul-generic-mode
'hosts-generic-mode 'apache-generic-mode)
'hosts-generic-mode
'apache-conf-generic-mode
'apache-log-generic-mode
)
generic-extras-enable-list)))
(and generic-define-unix-modes
(setq generic-extras-enable-list
(append (list 'apache-generic-mode 'samba-generic-mode
'hosts-generic-mode 'fvwm-generic-mode
'x-resource-generic-mode
(append (list 'apache-conf-generic-mode
'apache-log-generic-mode
'samba-generic-mode
'hosts-generic-mode 'fvwm-generic-mode
'x-resource-generic-mode
'alias-generic-mode
'inetd-conf-generic-mode
'etc-services-generic-mode
'etc-passwd-generic-mode
'etc-fstab-generic-mode
)
generic-extras-enable-list)))
......@@ -151,32 +157,50 @@ you must reload generic-x to enable the specified modes."
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Apache
(and
(memq 'apache-generic-mode generic-extras-enable-list)
(define-generic-mode 'apache-generic-mode
(list ?#)
nil
'(("^\\(<.*>\\)" 1 'font-lock-reference-face)
("^\\(\\sw+\\)\\s-" 1 'font-lock-variable-name-face))
(and
(memq 'apache-conf-generic-mode generic-extras-enable-list)
(define-generic-mode 'apache-conf-generic-mode
(list ?#)
nil
'(("^\\(<.*>\\)" 1 'font-lock-constant-face)
("^\\(\\sw+\\)\\s-" 1 'font-lock-variable-name-face))
(list "srm\\.conf\\'" "httpd\\.conf\\'" "access\\.conf\\'")
(list
(list
(function
(lambda ()
(setq imenu-generic-expression
'((nil "^\\([-A-Za-z0-9_]+\\)" 1)))
(setq imenu-generic-expression
'((nil "^\\([-A-Za-z0-9_]+\\)" 1)
("*Directories*" "^\\s-*<Directory\\s-*\\([^>]+\\)>" 1)
("*Locations*" "^\\s-*<Location\\s-*\\([^>]+\\)>" 1)
))
)))
"Generic mode for Apache or HTTPD configuration files."))
(and
(memq 'apache-log-generic-mode generic-extras-enable-list)
(define-generic-mode 'apache-log-generic-mode
nil
nil
;; Hostname ? user date request return-code number-of-bytes
'(("^\\([-a-zA-z0-9.]+\\) - [-A-Za-z]+ \\(\\[.*\\]\\)"
(1 font-lock-constant-face)
(2 font-lock-variable-name-face))
)
(list "access_log\\'")
nil
"Mode for Apache log files"))
;;; Samba
(and
(and
(memq 'samba-generic-mode generic-extras-enable-list)
(define-generic-mode 'samba-generic-mode
(list ?\; ?#)
nil
'(
("^\\(\\[.*\\]\\)" 1 'font-lock-reference-face)
("^\\(\\[.*\\]\\)" 1 'font-lock-constant-face)
("^\\s-*\\(.+\\)=\\([^\r\n]*\\)"
(1 'font-lock-variable-name-face)
(2 'font-lock-type-face))
......@@ -188,25 +212,25 @@ you must reload generic-x to enable the specified modes."
;;; Fvwm
;; This is pretty basic. Also, modes for other window managers could
;; be defined as well.
(and
(and
(memq 'fvwm-generic-mode generic-extras-enable-list)
(define-generic-mode 'fvwm-generic-mode
(list ?#)
(list
(list
"AddToMenu"
"AddToFunc"
"ButtonStyle"
"EndFunction"
"EndFunction"
"EndPopup"
"Function"
"Function"
"IconPath"
"Key"
"ModulePath"
"Mouse"
"PixmapPath"
"Popup"
"Style"
"Popup"
"Style"
)
nil
(list "\\.fvwmrc\\'" "\\.fvwm2rc\\'")
......@@ -216,58 +240,58 @@ you must reload generic-x to enable the specified modes."
;;; X Resource
;; I'm pretty sure I've seen an actual mode to do this, but I don't
;; think it's standard with Emacs
(and
(and
(memq 'x-resource-generic-mode generic-extras-enable-list)
(define-generic-mode 'x-resource-generic-mode
(list ?!)
nil
'(("^\\([^:\n]+:\\)" 1 'font-lock-variable-name-face))
(list "\\.Xdefaults\\'" "\\.Xresources\\'")
(list "\\.Xdefaults\\'" "\\.Xresources\\'" "\\.Xenvironment\\'" "\\.ad\\'")
nil
"Generic mode for X Resource configuration files."))
;;; Hosts
(and
(and
(memq 'hosts-generic-mode generic-extras-enable-list)
(define-generic-mode 'hosts-generic-mode
(list ?#)
(list "localhost")
'(("\\([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+\\)" 1 'font-lock-reference-face))
'(("\\([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+\\)" 1 'font-lock-constant-face))
(list "[hH][oO][sS][tT][sS]\\'")
nil
"Generic mode for HOSTS files."))
;;; Windows INF files
(and
(and
(memq 'inf-generic-mode generic-extras-enable-list)
(define-generic-mode 'inf-generic-mode
(list ?\;)
nil
'(("^\\(\\[.*\\]\\)" 1 'font-lock-reference-face))
nil
'(("^\\(\\[.*\\]\\)" 1 'font-lock-constant-face))
(list "\\.[iI][nN][fF]\\'")
(list 'generic-bracket-support)
"Generic mode for MS-Windows INF files."))
;;; Windows INI files
;; Should define escape character as well!
(and
(and
(memq 'ini-generic-mode generic-extras-enable-list)
(define-generic-mode 'ini-generic-mode
(list ?\;)
nil
'(("^\\(\\[.*\\]\\)" 1 'font-lock-reference-face)
'(("^\\(\\[.*\\]\\)" 1 'font-lock-constant-face)
("^\\([^=\n\r]*\\)=\\([^\n\r]*\\)$"
(1 font-lock-function-name-face)
(2 font-lock-variable-name-face)))
(list "\\.[iI][nN][iI]\\'")
(list
(list
(function
(lambda ()
(setq imenu-generic-expression
(setq imenu-generic-expression
'((nil "^\\[\\(.*\\)\\]" 1)
("*Variables*" "^\\s-*\\([^=]+\\)\\s-*=" 1)))
)))
......@@ -275,19 +299,19 @@ you must reload generic-x to enable the specified modes."
;;; Windows REG files
;;; Unfortunately, Windows 95 and Windows NT have different REG file syntax!
(and
(and
(memq 'reg-generic-mode generic-extras-enable-list)
(define-generic-mode 'reg-generic-mode
'(?\;)
'("key" "classes_root" "REGEDIT" "REGEDIT4")
'(("\\(\\[.*]\\)" 1 'font-lock-reference-face)
'(("\\(\\[.*]\\)" 1 'font-lock-constant-face)
("^\\([^\n\r]*\\)\\s-*=" 1 'font-lock-variable-name-face))
'("\\.[rR][eE][gG]\\'")
(list
(list
(function
(lambda ()
(setq imenu-generic-expression
(setq imenu-generic-expression
'((nil "^\\s-*\\(.*\\)\\s-*=" 1))))))
"Generic mode for MS-Windows Registry files."))
......@@ -358,13 +382,13 @@ you must reload generic-x to enable the specified modes."
(list "\\(%[0-9]\\)" 1 'font-lock-variable-name-face t)
(list "\\(/[^/ \"\t\n]+\\)" 1 'font-lock-type-face)
(list "[\t ]+\\([+-][^\t\n\" ]+\\)" 1 'font-lock-type-face)
(list "[ \t\n|]\\<\\([gG][oO][tT][oO]\\)\\>[ \t]*\\(\\sw+\\)?"
(list "[ \t\n|]\\<\\([gG][oO][tT][oO]\\)\\>[ \t]*\\(\\sw+\\)?"
'(1 font-lock-keyword-face)
'(2 font-lock-function-name-face nil t))
(list "[ \t\n|]\\<\\([sS][eE][tT]\\)\\>[ \t]*\\(\\sw+\\)?[ \t]*=?"
'(1 font-lock-builtin-face)
'(2 font-lock-variable-name-face t t))
)
(list
"\\.[bB][aA][tT]\\'"
......@@ -375,13 +399,13 @@ you must reload generic-x to enable the specified modes."
(defvar bat-generic-mode-syntax-table nil
"Syntax table in use in bat-generic-mode buffers.")
;; Make underscores count as words
(if bat-generic-mode-syntax-table
nil
(setq bat-generic-mode-syntax-table (make-syntax-table))
(modify-syntax-entry ?_ "w" bat-generic-mode-syntax-table))
;; bat-generic-mode doesn't use the comment functionality of generic-mode
;; because it has a three-letter comment-string, so we do it
;; here manually instead
......@@ -405,26 +429,26 @@ you must reload generic-x to enable the specified modes."
;;; Mailagent
;; Mailagent is a Unix mail filtering program. Anyone wanna do a generic mode
;; for procmail?
(and
(and
(memq 'mailagent-rules-generic-mode generic-extras-enable-list)
(define-generic-mode 'mailagent-rules-generic-mode
(list ?#)
(list ?#)
(list "SAVE" "DELETE" "PIPE" "ANNOTATE" "REJECT")
'(("^\\(\\sw+\\)\\s-*=" 1 'font-lock-variable-name-face)
("\\s-/\\([^/]+\\)/[i, \t\n]" 1 'font-lock-reference-face))
("\\s-/\\([^/]+\\)/[i, \t\n]" 1 'font-lock-constant-face))
(list "\\.rules\\'")
(list 'mailagent-rules-setup-function)
"Mode for Mailagent rules files.")
(defun mailagent-rules-setup-function ()
(defun mailagent-rules-setup-function ()
(make-local-variable 'imenu-generic-expression)
(setq imenu-generic-expression
(setq imenu-generic-expression
'((nil "\\s-/\\([^/]+\\)/[i, \t\n]" 1))))
)
;; Solaris/Sys V prototype files
(and
(and
(memq 'prototype-generic-mode generic-extras-enable-list)
(define-generic-mode 'prototype-generic-mode
......@@ -432,10 +456,10 @@ you must reload generic-x to enable the specified modes."
nil
'(
("^\\([0-9]\\)?\\s-*\\([a-z]\\)\\s-+\\([A-Za-z_]+\\)\\s-+\\([^\n\r]*\\)$"
(2 font-lock-reference-face)
(2 font-lock-constant-face)
(3 font-lock-keyword-face))
("^\\([a-z]\\) \\([A-Za-z_]+\\)=\\([^\n\r]*\\)$"
(1 font-lock-reference-face)
(1 font-lock-constant-face)
(2 font-lock-keyword-face)
(3 font-lock-variable-name-face))
("^\\(!\\s-*\\(search\\|include\\|default\\)\\)\\s-*\\([^\n\r]*\\)$"
......@@ -450,7 +474,7 @@ you must reload generic-x to enable the specified modes."
"Mode for Sys V prototype files."))
;; Solaris/Sys V pkginfo files
(and
(and
(memq 'pkginfo-generic-mode generic-extras-enable-list)
(define-generic-mode 'pkginfo-generic-mode
......@@ -466,29 +490,85 @@ you must reload generic-x to enable the specified modes."
"Mode for Sys V pkginfo files."))
;; Javascript mode
;; Includes extra keywords from Armando Singer [asinger@MAIL.COLGATE.EDU]
(define-generic-mode 'javascript-generic-mode
(list "//")
(list
"document"
"break"
"case"
"continue"
"default"
"delete"
"do"
"else"
"function"
"export"
"for"
"function"
"if"
"then"
"import"
"in"
"new"
"return"
"switch"
"this"
"typeof"
"var"
"void"
"while"
"with"
;; words reserved for ECMA extensions below
"catch"
"class"
"const"
"debugger"
"enum"
"extends"
"finally"
"super"
"throw"
"try"
;; Java Keywords reserved by JavaScript
"abstract"
"boolean"
"byte"
"char"
"double"
"false"
"final"
"float"
"goto"
"implements"
"instanceof"
"int"
"interface"
"long"
"native"
"null"
"package"
"private"
"protected"
"public"
"short"
"static"
"synchronized"
"throws"
"transient"
"true"
)
(list
(list "^\\s-*function\\s-+\\([A-Za-z0-9]+\\)"
'(1 font-lock-function-name-face))
(list "^\\s-*var\\s-+\\([A-Za-z0-9]+\\)"
'(1 font-lock-variable-name-face))
)
(list "^\\s-*function\\s-+\\([A-Za-z0-9_]+\\)"
'(1 font-lock-function-name-face))
(list "^\\s-*var\\s-+\\([A-Za-z0-9_]+\\)"
'(1 font-lock-variable-name-face))
)
(list "\\.js\\'")
(list
(function
(function
(lambda ()
(setq imenu-generic-expression
'((nil "^function\\s-+\\([A-Za-z0-9_]+\\)" 1)))
(setq imenu-generic-expression
'((nil "^function\\s-+\\([A-Za-z0-9_]+\\)" 1)
("*Variables*" "^var\\s-+\\([A-Za-z0-9_]+\\)" 1)
))
)))
"Mode for JavaScript files.")
......@@ -527,23 +607,23 @@ you must reload generic-x to enable the specified modes."
)
(list
(list "USE\\s-+\\([-A-Za-z0-9_]+\\)"
'(1 font-lock-reference-face))
'(1 font-lock-constant-face))
(list "DEF\\s-+\\([-A-Za-z0-9_]+\\)\\s-+\\([A-Za-z0-9]+\\)\\s-*{"
'(1 font-lock-type-face)
'(2 font-lock-reference-face))
'(2 font-lock-constant-face))
(list "^\\s-*\\([-A-Za-z0-9_]+\\)\\s-*{"
'(1 font-lock-function-name-face))
(list
(list
"^\\s-*\\(geometry\\|appearance\\|material\\)\\s-+\\([-A-Za-z0-9_]+\\)"
'(2 font-lock-variable-name-face))
)
(list "\\.wrl\\'")
(list
(function
(function
(lambda ()
(setq imenu-generic-expression
(setq imenu-generic-expression
'((nil "^\\([A-Za-z0-9_]+\\)\\s-*{" 1)
("*Definitions*"
("*Definitions*"
"DEF\\s-+\\([-A-Za-z0-9_]+\\)\\s-+\\([A-Za-z0-9]+\\)\\s-*{"
1)))
)))
......@@ -552,11 +632,11 @@ you must reload generic-x to enable the specified modes."
;; Java Manifests
(define-generic-mode 'java-manifest-generic-mode
(list ?#)
(list
"Name"
"Digest-Algorithms"
"Manifest-Version"
"Required-Version"
(list
"Name"
"Digest-Algorithms"
"Manifest-Version"
"Required-Version"
"Signature-Version"
"Magic"
"Java-Bean"
......@@ -565,9 +645,9 @@ you must reload generic-x to enable the specified modes."
'(("^Name:\\s-+\\([^\n\r]*\\)$"
(1 font-lock-variable-name-face))
("^\\(Manifest\\|Required\\|Signature\\)-Version:\\s-+\\([^\n\r]*\\)$"
(2 font-lock-reference-face))
(2 font-lock-constant-face))
)
(list "manifest\\.mf\\'")
(list "[mM][aA][nN][iI][fF][eE][sS][tT]\\.[mM][fF]\\'")
nil
"Mode for Java Manifest files")
......@@ -575,9 +655,9 @@ you must reload generic-x to enable the specified modes."
(define-generic-mode 'java-properties-generic-mode
(list ?! ?#)
nil
(let ((java-properties-key
(let ((java-properties-key
"\\(\\([-A-Za-z0-9_\\./]\\|\\(\\\\[ =:]\\)\\)+\\)")
(java-properties-value
(java-properties-value
"\\([^\r\n]*\\)")
)
;; Property and value can be separated in a number of different ways:
......@@ -585,28 +665,28 @@ you must reload generic-x to enable the specified modes."
;; * an equal sign
;; * a colon
(mapcar
(function
(function
(lambda (elt)
(list
(list
(concat "^" java-properties-key elt java-properties-value "$")
'(1 font-lock-reference-face)
'(1 font-lock-constant-face)
'(4 font-lock-variable-name-face)
)))
;; These are the separators
(list ":\\s-+" "\\s-+" "\\s-*=\\s-*")
(list ":\\s-*" "\\s-+" "\\s-*=\\s-*")
)
)
nil
(list
(function
(lambda ()
(setq imenu-generic-expression
(setq imenu-generic-expression
'((nil "^\\([^#! \t\n\r=:]+\\)" 1)))
)))
)))
"Mode for Java properties files.")
;; C shell alias definitions
(and
(and
(memq 'alias-generic-mode generic-extras-enable-list)
(define-generic-mode 'alias-generic-mode
......@@ -621,7 +701,7 @@ you must reload generic-x to enable the specified modes."
(list
(function
(lambda ()
(setq imenu-generic-expression
(setq imenu-generic-expression
'((nil "^\\(alias\\|unalias\\)\\s-+\\([-a-zA-Z0-9_]+\\)" 2)))
)))
"Mode for C Shell alias files.")
......@@ -629,7 +709,7 @@ you must reload generic-x to enable the specified modes."
;;; Windows RC files
;; Contributed by ACorreir@pervasive-sw.com (Alfred Correira)
(and
(and
(memq 'rc-generic-mode generic-extras-enable-list)
(define-generic-mode 'rc-generic-mode
......@@ -664,8 +744,8 @@ you must reload generic-x to enable the specified modes."
"LEFTMARGIN"
"LISTBOX"
"LTEXT"
"MENUITEM SEPARATOR"
"MENUITEM"
"MENUITEM SEPARATOR"
"MENUITEM"
"MENU"
"MOVEABLE"
"POPUP"
......@@ -713,16 +793,16 @@ you must reload generic-x to enable the specified modes."
'("^#[ \t]*define[ \t]+\\(\\sw+\\)(" 1 font-lock-function-name-face)
'("^#[ \t]*\\(elif\\|if\\)\\>"
("\\<\\(defined\\)\\>[ \t]*(?\\(\\sw+\\)?" nil nil
(1 font-lock-reference-face) (2 font-lock-variable-name-face nil t)))
(1 font-lock-constant-face) (2 font-lock-variable-name-face nil t)))
'("^#[ \t]*\\(\\sw+\\)\\>[ \t]*\\(\\sw+\\)?"
(1 font-lock-reference-face) (2 font-lock-variable-name-face nil t)))
(1 font-lock-constant-face) (2 font-lock-variable-name-face nil t)))
(list "\\.[rR][cC]$")
nil
"Generic mode for MS-Windows Resource files."))
;; InstallShield RUL files
;; Contributed by Alfred.Correira@Pervasive.Com
(and
(and
(memq 'rul-generic-mode generic-extras-enable-list)
;;; build the regexp strings using regexp-opt
(defvar installshield-statement-keyword-list
......@@ -780,6 +860,7 @@ you must reload generic-x to enable the specified modes."
"BatchGetFileName"
"BatchMoveEx"
"BatchSetFileName"
"ChangeDirectory"
"CloseFile"
"CmdGetHwndDlg"