Commit ef1c5063 authored by Richard M. Stallman's avatar Richard M. Stallman
Browse files

(generic-x): Added defgroup declaration.

(generic-bat-mode-setup-function): Fixed comment-start variable.

(generic-define-mswindows-modes): Enable
hosts-generic-mode and apache-generic-mode.
(generic-define-unix-modes): Enable alias-generic-mode.
(java-properties-generic-mode): Changed regexp to allow property
and value to be separated by whitespace or an equal sign.
(alias-generic-mode): Check generic-extras-enable-list before
defining this mode.

(installshield-statement-keyword-list): New variable.
(installshield-system-functions-list): Likewise.
(installshield-system-variables-list): Likewise.
(installshield-types-list): Likewise.
(installshield-funarg-constants-list): Likewise.
(rul-generic-mode): Uses the variables listed above instead of
hard-coding the lists of keywords.
parent 5bbc1cf7
......@@ -91,6 +91,11 @@
(require 'generic)
(require 'font-lock)
(defgroup generic-x nil
"Extra modes for generic mode."
:prefix "generic-"
:group 'generic)
(defcustom generic-extras-enable-list nil
"*List of generic modes to enable by default.
Each entry in the list should be a symbol.
......@@ -120,7 +125,8 @@ you must reload generic-x to enable the specified modes."
(setq generic-extras-enable-list
(append (list 'bat-generic-mode 'ini-generic-mode
'inf-generic-mode 'rc-generic-mode
'reg-generic-mode 'rul-generic-mode)
'reg-generic-mode 'rul-generic-mode
'hosts-generic-mode 'apache-generic-mode)
generic-extras-enable-list)))
(and generic-define-unix-modes
......@@ -128,6 +134,7 @@ you must reload generic-x to enable the specified modes."
(append (list 'apache-generic-mode 'samba-generic-mode
'hosts-generic-mode 'fvwm-generic-mode
'x-resource-generic-mode
'alias-generic-mode
)
generic-extras-enable-list)))
......@@ -333,7 +340,7 @@ you must reload generic-x to enable the specified modes."
(setq imenu-generic-expression '((nil "^:\\(\\sw+\\)" 1))
parse-sexp-ignore-comments t
comment-end ""
comment-start "[Rr][Ee][Mm] "
comment-start "REM "
comment-start-skip "[Rr][Ee][Mm] *"
)
(set-syntax-table bat-generic-mode-syntax-table)
......@@ -514,13 +521,16 @@ you must reload generic-x to enable the specified modes."
(list ?#)
nil
;; Property and value can be separated with whitespace or an equal sign
'(("^\\([A-Za-z0-9_]+\\)\\(\\s-+\\|\\s-*=\\s-*\\)\\([^\r\n]*\\)\\'"
(1 font-lock-reference-face) (3 font-lock-variable-name-face)))
'(("^\\([\\.A-Za-z0-9_]+\\)\\(\\s-+\\|\\(\\s-*=\\s-*\\)\\)\\([^\r\n]*\\)$"
(1 font-lock-reference-face) (4 font-lock-variable-name-face)))
nil
nil
"Mode for Java properties files.")
;; C shell alias definitions
(and
(memq 'alias-generic-mode generic-extras-enable-list)
(define-generic-mode 'alias-generic-mode
(list ?#)
(list "alias" "unalias")
......@@ -537,6 +547,7 @@ you must reload generic-x to enable the specified modes."
'((nil "^\\(alias\\|unalias\\)\\s-+\\([-a-zA-Z0-9_]+\\)" 2)))
)))
"Mode for C Shell alias files.")
)
;;; Windows RC files
;; Contributed by ACorreir@pervasive-sw.com (Alfred Correira)
......@@ -631,15 +642,14 @@ you must reload generic-x to enable the specified modes."
nil
"Generic mode for MS-Windows Resource files."))
;;; InstallShield RUL files
;; InstallShield RUL files
;; Contributed by Alfred.Correira@Pervasive.Com
(and
(memq 'rul-generic-mode generic-extras-enable-list)
(define-generic-mode 'rul-generic-mode
;; Using "/*" and "*/" doesn't seem to be working right
(list "//")
'("abort"
;;; build the regexp strings using regexp-opt
(defvar installshield-statement-keyword-list
(list
"abort"
"begin"
"call"
"case"
......@@ -670,44 +680,11 @@ you must reload generic-x to enable the specified modes."
"typedef"
"until"
"void"
"while")
(list
;; preprocessor constructs
'("#[ \t]*include[ \t]+\\(<[^>\"\n]+>\\)"
1 font-lock-string-face)
'("#[ \t]*\\(\\sw+\\)\\>[ \t]*\\(\\sw+\\)?"
(1 font-lock-reference-face)
(2 font-lock-variable-name-face nil t))
;; indirect string constants
'("\\(@[A-Za-z][A-Za-z0-9_]+\\)" 1 font-lock-builtin-face)
;; gotos
'("[ \t]*\\(\\sw+:\\)" 1 font-lock-reference-face)
'("\\<\\(goto\\)\\>[ \t]*\\(\\sw+\\)?"
(1 font-lock-keyword-face)
(2 font-lock-reference-face nil t))
;; system variables
(generic-make-keywords-list
(list
"CMDLINE"
"ERRORFILENAME"
"INFOFILENAME"
"ISRES"
"ISUSER"
"ISVERSION"
"SRCDIR"
"SRCDISK"
"SUPPORTDIR"
"TARGETDIR"
"TARGETDISK"
"WINDIR"
"WINDISK"
"WINMAJOR"
"WINSYSDIR"
"WINSYSDISK"
"while"
)
'font-lock-variable-name-face)
;; system functions
(generic-make-keywords-list
"Statement keywords used in InstallShield 3 and 5.")
(defvar installshield-system-functions-list
(list
"AddFolderIcon"
"AddProfString"
......@@ -809,11 +786,22 @@ you must reload generic-x to enable the specified modes."
"InstallationInfo"
"Is"
"LaunchApp"
"ListAddItem"
"ListAddString"
"ListCount"
"ListCreate"
"ListDestroy"
"ListFindItem"
"ListFindString"
"ListGetFirstItem"
"ListGetFirstString"
"ListGetNextItem"
"ListGetNextString"
"ListReadFromFile"
"ListSetNextItem"
"ListSetNextString"
"ListSetIndex"
"ListWriteToFile"
"LongPathToQuote"
"LongPathToShortPath"
"MessageBox"
......@@ -833,6 +821,7 @@ you must reload generic-x to enable the specified modes."
"PlayMMedia" ; IS5 only
"ProgDefGroupType"
"RegDBCreateKeyEx"
"RegDbDeleteValue"
"RegDBGetItem"
"RegDBKeyExist"
"RegDBSetItem"
......@@ -935,30 +924,9 @@ you must reload generic-x to enable the specified modes."
"WriteProfString"
"XCopyFile"
)
'font-lock-function-name-face)
;; type keywords
(generic-make-keywords-list
(list
"BOOL"
"BYREF"
"CHAR"
"HIWORD"
"HWND"
"INT"
"LIST"
"LONG"
"LOWORD"
"NUMBER"
"POINTER"
"QUAD"
"RGB"
"SHORT"
"STRINGLIST"
"STRING"
)
'font-lock-type-face)
;;; system variables
(generic-make-keywords-list
"System functions defined in InstallShield 3 and 5.")
(defvar installshield-system-variables-list
(list
"CMDLINE"
"CORECOMPONENTHANDLING"
......@@ -975,13 +943,35 @@ you must reload generic-x to enable the specified modes."
"TARGETDISK"
"WINDIR"
"WINDISK"
"WINMAJOR"
"WINSYSDIR"
"WINSYSDISK"
)
;; pre-defined constants (not exhaustive -- just my favorites)
'font-lock-variable-name-face)
"System variables used in InstallShield 3 and 5.")
(generic-make-keywords-list
(defvar installshield-types-list
(list
"BOOL"
"BYREF"
"CHAR"
"HIWORD"
"HWND"
"INT"
"LIST"
"LONG"
"LOWORD"
"NUMBER"
"POINTER"
"QUAD"
"RGB"
"SHORT"
"STRINGLIST"
"STRING"
)
"Type keywords used in InstallShield 3 and 5.")
;;; some might want to skip highlighting these to improve performance
(defvar installshield-funarg-constants-list
(list
"AFTER"
"APPEND"
......@@ -1020,6 +1010,7 @@ you must reload generic-x to enable the specified modes."
"DATE"
"DEFWINDOWMODE"
"DIR_WRITEABLE"
"DIRECTORY"
"DISABLE"
"DISK_TOTALSPACE"
"DISK"
......@@ -1182,7 +1173,42 @@ you must reload generic-x to enable the specified modes."
"WIN32SMAJOR"
"WIN32SMINOR"
)
'font-lock-variable-name-face) ; is this face the best choice?
"Function argument constants used in InstallShield 3 and 5.")
(define-generic-mode 'rul-generic-mode
;; Using "/*" and "*/" doesn't seem to be working right
(list "//")
installshield-statement-keyword-list
(list
;; preprocessor constructs
'("#[ \t]*include[ \t]+\\(<[^>\"\n]+>\\)"
1 font-lock-string-face)
'("#[ \t]*\\(\\sw+\\)\\>[ \t]*\\(\\sw+\\)?"
(1 font-lock-reference-face)
(2 font-lock-variable-name-face nil t))
;; indirect string constants
'("\\(@[A-Za-z][A-Za-z0-9_]+\\)" 1 font-lock-builtin-face)
;; gotos
'("[ \t]*\\(\\sw+:\\)" 1 font-lock-reference-face)
'("\\<\\(goto\\)\\>[ \t]*\\(\\sw+\\)?"
(1 font-lock-keyword-face)
(2 font-lock-reference-face nil t))
;; system variables
(generic-make-keywords-list
installshield-system-variables-list
'font-lock-variable-name-face "[^_]" "[^_]")
;; system functions
(generic-make-keywords-list
installshield-system-functions-list
'font-lock-function-name-face "[^_]" "[^_]")
;; type keywords
(generic-make-keywords-list
installshield-types-list
'font-lock-type-face "[^_]" "[^_]")
;; function argument constants
(generic-make-keywords-list
installshield-funarg-constants-list
'font-lock-variable-name-face "[^_]" "[^_]") ; is this face the best choice?
)
(list "\\.[rR][uU][lL]$")
(list
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment