-;;; generic-x.el --- Extra Modes for generic-mode
+;;; generic-x.el --- Extra Modes for generic-mode -*- no-byte-compile: t -*-
-;; Copyright (C) 1997, 1998 Free Software Foundation, Inc.
+;; Copyright (C) 1997, 1998, 2003 Free Software Foundation, Inc.
;; Author: Peter Breton <pbreton@cs.umb.edu>
;; Created: Tue Oct 08 1996
(define-generic-mode 'apache-conf-generic-mode
(list ?#)
nil
- '(("^\\(<.*>\\)" 1 'font-lock-constant-face)
- ("^\\(\\sw+\\)\\s-" 1 'font-lock-variable-name-face))
+ '(("^\\s-*\\(<.*>\\)" 1 'font-lock-constant-face)
+ ("^\\s-*\\(\\sw+\\)\\s-" 1 'font-lock-variable-name-face))
(list "srm\\.conf\\'" "httpd\\.conf\\'" "access\\.conf\\'")
(list
(function
(defvar bat-generic-mode-syntax-table nil
"Syntax table in use in bat-generic-mode buffers.")
+ (defvar bat-generic-mode-keymap (make-sparse-keymap)
+ "Keymap for bet-generic-mode.")
+
+ (defun bat-generic-mode-compile ()
+ "Run the current BAT file in a compilation buffer."
+ (interactive)
+ (let ((compilation-buffer-name-function
+ (function
+ (lambda(ign)
+ (concat "*" (buffer-file-name) "*")))
+ )
+ )
+ (compile
+ (concat (w32-shell-name) " -c " (buffer-file-name)))))
+
+ (defun bat-generic-mode-run-as-comint ()
+ "Run the current BAT file in a comint buffer."
+ (interactive)
+ (require 'comint)
+ (let* ((file (buffer-file-name))
+ (buf-name (concat "*" file "*")))
+ (save-excursion
+ (set-buffer
+ (get-buffer-create buf-name))
+ (erase-buffer)
+ (comint-mode)
+ (comint-exec
+ buf-name
+ file
+ (w32-shell-name)
+ nil
+ (list
+ "-c"
+ file
+ )
+ )
+ (display-buffer buf-name))))
+
+ (define-key bat-generic-mode-keymap "\C-c\C-c" 'bat-generic-mode-compile)
+
;; Make underscores count as words
(if bat-generic-mode-syntax-table
nil
(set-syntax-table bat-generic-mode-syntax-table)
;; Make keywords case-insensitive
(setq font-lock-defaults (list 'generic-font-lock-defaults nil t))
+ (use-local-map bat-generic-mode-keymap)
)
)
;; Javascript mode
;; Includes extra keywords from Armando Singer [asinger@MAIL.COLGATE.EDU]
(define-generic-mode 'javascript-generic-mode
- (list "//")
+ (list "//" '("/*" . "*/"))
(list
"break"
"case"
;; as is the choice of which value tokens are included, as
;; the choice of face for each token group
(list
- (generic-make-keywords-list
- (list
- "FILEFLAGSMASK"
- "FILEFLAGS"
- "FILEOS"
- "FILESUBTYPE"
- "FILETYPE"
- "FILEVERSION"
- "PRODUCTVERSION"
- ) 'font-lock-type-face)
- (generic-make-keywords-list
- (list
- "BEGIN"
- "BLOCK"
- "END"
- "VALUE"
- ) 'font-lock-function-name-face)
- '("^#[ \t]*include[ \t]+\\(<[^>\"\n]+>\\)" 1 font-lock-string-face)
- '("^#[ \t]*define[ \t]+\\(\\sw+\\)(" 1 font-lock-function-name-face)
- '("^#[ \t]*\\(elif\\|if\\)\\>"
- ("\\<\\(defined\\)\\>[ \t]*(?\\(\\sw+\\)?" nil nil
+ (eval-when-compile
+ (generic-make-keywords-list
+ (list
+ "FILEFLAGSMASK"
+ "FILEFLAGS"
+ "FILEOS"
+ "FILESUBTYPE"
+ "FILETYPE"
+ "FILEVERSION"
+ "PRODUCTVERSION"
+ ) 'font-lock-type-face))
+ (eval-when-compile
+ (generic-make-keywords-list
+ (list
+ "BEGIN"
+ "BLOCK"
+ "END"
+ "VALUE"
+ ) 'font-lock-function-name-face))
+ '("^#[ \t]*include[ \t]+\\(<[^>\"\n]+>\\)" 1 font-lock-string-face)
+ '("^#[ \t]*define[ \t]+\\(\\sw+\\)(" 1 font-lock-function-name-face)
+ '("^#[ \t]*\\(elif\\|if\\)\\>"
+ ("\\<\\(defined\\)\\>[ \t]*(?\\(\\sw+\\)?" nil nil
+ (1 font-lock-constant-face) (2 font-lock-variable-name-face nil t)))
+ '("^#[ \t]*\\(\\sw+\\)\\>[ \t]*\\(\\sw+\\)?"
(1 font-lock-constant-face) (2 font-lock-variable-name-face nil t)))
- '("^#[ \t]*\\(\\sw+\\)\\>[ \t]*\\(\\sw+\\)?"
- (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
+;; Bugfixes by "Rolf Sandau" <Rolf.Sandau@marconi.com>
(and
(memq 'rul-generic-mode generic-extras-enable-list)
;;; build the regexp strings using regexp-opt
)
"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-constant-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-constant-face)
- '("\\<\\(goto\\)\\>[ \t]*\\(\\sw+\\)?"
- (1 font-lock-keyword-face)
- (2 font-lock-constant-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
- (function
- (lambda ()
- (setq imenu-generic-expression
- '((nil "^function\\s-+\\([A-Za-z0-9_]+\\)" 1)))
- )))
- "Generic mode for InstallShield RUL files.")
+(progn
+ (defvar rul-generic-mode-syntax-table nil
+ "Syntax table to use in rul-generic-mode buffers.")
+
+ (setq rul-generic-mode-syntax-table
+ (make-syntax-table c++-mode-syntax-table))
+
+ (modify-syntax-entry ?\r "> b" rul-generic-mode-syntax-table)
+ (modify-syntax-entry ?\n "> b" rul-generic-mode-syntax-table)
+
+ (modify-syntax-entry ?/ ". 124b" rul-generic-mode-syntax-table)
+ (modify-syntax-entry ?* ". 23" rul-generic-mode-syntax-table)
+
+ ;; here manually instead
+ (defun generic-rul-mode-setup-function ()
+ (make-local-variable 'parse-sexp-ignore-comments)
+ (make-local-variable 'comment-start)
+ (make-local-variable 'comment-start-skip)
+ (make-local-variable 'comment-end)
+ (setq imenu-generic-expression
+ '((nil "^function\\s-+\\([A-Za-z0-9_]+\\)" 1))
+ parse-sexp-ignore-comments t
+ comment-end "*/"
+ comment-start "/*"
+;; comment-end ""
+;; comment-start "//"
+;; comment-start-skip ""
+ )
+;; (set-syntax-table rul-generic-mode-syntax-table)
+ (setq font-lock-syntax-table rul-generic-mode-syntax-table)
+ )
+ ;; moved mode-definition behind defun-definition to be warning-free - 15.11.02/RSan
+ (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 'generic-rul-mode-setup-function)
+ "Generic mode for InstallShield RUL files.")
+)
(define-skeleton rul-if
"Insert an if statement."
"condition: "
"if"
"ignore"
"set"
+ "source"
"unset"
)
'(("^\\s-*\\(alias\\|group\\)\\s-+\\([-A-Za-z0-9_]+\\)\\s-+\\([^\n\r#]*\\)\\(#.*\\)?$"
(2 font-lock-constant-face) (3 font-lock-variable-name-face))
("^\\s-*\\(unset\\|set\\|ignore\\)\\s-+\\([-A-Za-z0-9_]+\\)=?\\([^\n\r#]*\\)\\(#.*\\)?$"
- (2 font-lock-constant-face) (3 font-lock-variable-name-face)))
+ (2 font-lock-constant-face) (3 font-lock-variable-name-face))
+ ("^\\s-*\\(source\\)\\s-+\\([^\n\r#]*\\)\\(#.*\\)?$"
+ (2 font-lock-variable-name-face)))
(list "\\.mailrc\\'")
nil
"Mode for mailrc files.")
)
)
+;; Fstab
+(and
+ (memq 'etc-fstab-generic-mode generic-extras-enable-list)
+
+(define-generic-mode 'etc-fstab-generic-mode
+ (list ?#)
+ (list
+ "ext2"
+ "fd"
+ "iso9660"
+ "nfs"
+ "proc"
+ "swap"
+ "ufs"
+ )
+ '(
+ ("^\\([/-A-Za-z0-9_]+\\)\\s-+\\([/-A-Za-z0-9_]+\\)"
+ (1 'font-lock-type-face)
+ (2 'font-lock-variable-name-face)
+ )
+ )
+ '("/etc/[v]*fstab\\'")
+ (list
+ (function
+ (lambda ()
+ (setq imenu-generic-expression
+ '((nil "^\\([/-A-Za-z0-9_]+\\)\\s-+" 1)))
+ )))
+ )
+)
;; From Jacques Duthen <jacques.duthen@sncf.fr>
(defvar show-tabs-generic-mode-font-lock-defaults-1
("\t+" . 'show-tabs-tab-face)))
(defface show-tabs-tab-face
- '((((class grayscale) (background light)) (:foreground "LightGray" :bold t))
- (((class grayscale) (background dark)) (:foreground "DimGray" :bold t))
+ '((((class grayscale) (background light)) (:foreground "LightGray" :weight bold))
+ (((class grayscale) (background dark)) (:foreground "DimGray" :weight bold))
(((class color) (background light)) (:foreground "red"))
(((class color) (background dark)) (:foreground "red"))
- (t (:bold t)))
+ (t (:weight bold)))
"Font Lock mode face used to highlight TABs."
:group 'show-tabs)
(defface show-tabs-space-face
- '((((class grayscale) (background light)) (:foreground "LightGray" :bold t))
- (((class grayscale) (background dark)) (:foreground "DimGray" :bold t))
+ '((((class grayscale) (background light)) (:foreground "LightGray" :weight bold))
+ (((class grayscale) (background dark)) (:foreground "DimGray" :weight bold))
(((class color) (background light)) (:foreground "yellow"))
(((class color) (background dark)) (:foreground "yellow"))
- (t (:bold t)))
+ (t (:weight bold)))
"Font Lock mode face used to highlight spaces."
:group 'show-tabs)
"Generic mode for ASTAP circuit netlist files."
)
+(define-generic-mode 'etc-modules-conf-generic-mode
+ ;;List of comment characters
+ (list ?#)
+ ;;List of keywords
+ (list
+ "above"
+ "alias"
+ "below"
+ "define"
+ "depfile"
+ "else"
+ "elseif"
+ "endif"
+ "if"
+ "include"
+ "insmod_opt"
+ "install"
+ "keep"
+ "options"
+ "path"
+ "generic_stringfile"
+ "pcimapfile"
+ "isapnpmapfile"
+ "usbmapfile"
+ "parportmapfile"
+ "ieee1394mapfile"
+ "pnpbiosmapfile"
+ "probe"
+ "probeall"
+ "prune"
+ "post-install"
+ "post-remove"
+ "pre-install"
+ "pre-remove"
+ "remove"
+ "persistdir")
+ ;;List of additional font-lock-expressions
+ nil
+ ;;List of additional automode-alist expressions
+ (list "/etc/modules.conf" "/etc/conf.modules")
+ ;;List of set up functions to call
+ nil
+ )
(provide 'generic-x)
+;;; arch-tag: cde692a5-9ff6-4506-9999-c67999c2bdb5
;;; generic-x.el ends here