+;; Inetd.conf
+(and
+ (memq 'inetd-conf-generic-mode generic-extras-enable-list)
+
+(define-generic-mode 'inetd-conf-generic-mode
+ (list ?#)
+ (list
+ "stream"
+ "dgram"
+ "tcp"
+ "udp"
+ "wait"
+ "nowait"
+ "internal"
+ )
+ '(
+ ("^\\([-A-Za-z0-9_]+\\)"
+ 1 'font-lock-type-face)
+ )
+ '("/etc/inetd.conf\\'")
+ (list
+ (function
+ (lambda ()
+ (setq imenu-generic-expression
+ '((nil "^\\([-A-Za-z0-9_]+\\)" 1)))
+ )))
+ )
+)
+
+;; Services
+(and
+ (memq 'etc-services-generic-mode generic-extras-enable-list)
+
+(define-generic-mode 'etc-services-generic-mode
+ (list ?#)
+ (list
+ "tcp"
+ "udp"
+ "ddp"
+ )
+ '(
+ ("^\\([-A-Za-z0-9_]+\\)\\s-+\\([0-9]+\\)/"
+ (1 'font-lock-type-face)
+ (2 'font-lock-variable-name-face)
+ )
+ )
+ '("/etc/services\\'")
+ (list
+ (function
+ (lambda ()
+ (setq imenu-generic-expression
+ '((nil "^\\([-A-Za-z0-9_]+\\)" 1)))
+ )))
+ )
+)
+
+;; Password and Group files
+(and
+ (memq 'etc-passwd-generic-mode generic-extras-enable-list)
+
+(define-generic-mode 'etc-passwd-generic-mode
+ nil ;; No comment characters
+ (list "root") ;; Only one keyword
+ (list
+ (list
+ (concat
+ "^"
+ ;; User name -- Never blank!
+ "\\([^:]+\\)"
+ ":"
+ ;; Password, UID and GID
+ (mapconcat
+ 'identity
+ (make-list 3 "\\([^:]+\\)")
+ ":"
+ )
+ ":"
+ ;; GECOS/Name -- might be blank
+ "\\([^:]*\\)"
+ ":"
+ ;; Home directory and shell
+ "\\([^:]+\\)"
+ ":?"
+ "\\([^:]*\\)"
+ "$"
+ )
+ '(1 'font-lock-type-face)
+ '(5 'font-lock-variable-name-face)
+ '(6 'font-lock-constant-face)
+ '(7 'font-lock-warning-face)
+ )
+ '("^\\([^:]+\\):\\([^:]*\\):\\([0-9]+\\):\\(.*\\)$"
+ (1 'font-lock-type-face)
+ (4 'font-lock-variable-name-face)
+ )
+ )
+ '("/etc/passwd\\'" "/etc/group\\'")
+ (list
+ (function
+ (lambda ()
+ (setq imenu-generic-expression
+ '((nil "^\\([-A-Za-z0-9_]+\\):" 1)))
+ )))
+ )
+)
+
+
+;; From Jacques Duthen <jacques.duthen@sncf.fr>
+(defvar show-tabs-generic-mode-font-lock-defaults-1
+ '( ;; trailing spaces must come before...
+ ("[ \t]+$" . 'show-tabs-space-face)
+ ;; ...embedded tabs
+ ("[^\n\t]\\(\t+\\)" (1 'show-tabs-tab-face))))
+
+(defvar show-tabs-generic-mode-font-lock-defaults-2
+ '( ;; trailing spaces must come before...
+ ("[ \t]+$" . 'show-tabs-space-face)
+ ;; ...tabs
+ ("\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 color) (background light)) (:foreground "red"))
+ (((class color) (background dark)) (:foreground "red"))
+ (t (:bold t)))
+ "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 color) (background light)) (:foreground "yellow"))
+ (((class color) (background dark)) (:foreground "yellow"))
+ (t (:bold t)))
+ "Font Lock mode face used to highlight spaces."
+ :group 'show-tabs)
+
+(define-generic-mode 'show-tabs-generic-mode
+ () ;; no comment char
+ () ;; no keywords
+ show-tabs-generic-mode-font-lock-defaults-1
+ () ;; no auto-mode-alist
+ ;; (list 'show-tabs-generic-mode-hook-fun)
+ nil
+ "Generic mode to show tabs and trailing spaces")
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; DNS modes
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(define-generic-mode 'named-boot-generic-mode
+ ;;List of comment characters
+ (list ?\;)
+ ;;List of keywords
+ (list "cache" "primary" "secondary" "forwarders" "limit" "options"
+ "directory" "check-names")
+ ;;List of additional font-lock-expressions
+ (list
+ (list "\\([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+\\)" 1 'font-lock-constant-face)
+ (list "^directory\\s-+\\(.*\\)" 1 'font-lock-variable-name-face)
+ (list "^\\(primary\\|cache\\)\\s-+\\([.A-Za-z]+\\)\\s-+\\(.*\\)"
+ (list 2 'font-lock-variable-name-face)
+ (list 3 'font-lock-constant-face))
+ )
+ ;;List of additional automode-alist expressions
+ (list "/etc/named.boot\\'")
+ ;;List of set up functions to call
+ nil
+ )
+
+(define-generic-mode 'named-database-generic-mode
+ ;;List of comment characters
+ (list ?\;)
+ ;;List of keywords
+ (list "IN" "NS" "CNAME" "SOA" "PTR" "MX" "A")
+ ;;List of additional font-lock-expressions
+ (list
+ (list "\\([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+\\)" 1 'font-lock-constant-face)
+ (list "^\\([.A-Za-z0-9]+\\)" 1 'font-lock-variable-name-face)
+ )
+ ;;List of additional automode-alist expressions
+ nil
+ ;;List of set up functions to call
+ nil
+ )
+
+(defvar named-database-time-string "%Y%m%d%H"
+ "Timestring for named serial numbers.")
+
+(defun named-database-print-serial ()
+ "Print a serial number based on the current date."
+ (interactive)
+ (insert (format-time-string named-database-time-string (current-time)))
+ )
+
+(define-generic-mode 'resolve-conf-generic-mode
+ ;;List of comment characters
+ (list ?#)
+ ;;List of keywords
+ (list "nameserver" "domain" "search" "sortlist" "options")
+ ;;List of additional font-lock-expressions
+ nil
+ ;;List of additional automode-alist expressions
+ (list "/etc/resolv[e]?.conf\\'")
+ ;;List of set up functions to call
+ nil
+ )
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; Modes for spice and common electrical engineering circuit netlist formats
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(define-generic-mode 'spice-generic-mode
+ nil
+ (list
+ "and"
+ "cccs"
+ "ccvs"
+ "delay"
+ "nand"
+ "nor"
+ "npwl"
+ "or"
+ "par"
+ "ppwl"
+ "pwl"
+ "vccap"
+ "vccs"
+ "vcr"
+ "vcvs"
+ )
+ '(
+ ("^\\s-*\\([*].*\\)" 1 'font-lock-comment-face)
+ (" \\(\\$ .*\\)$" 1 'font-lock-comment-face)
+ ("^\\(\\$ .*\\)$" 1 'font-lock-comment-face)
+ ("\\([*].*\\)" 1 'font-lock-comment-face)
+ ("^\\([+]\\)" 1 'font-lock-string-face)
+ ("^\\s-*\\([.]\\w+\\>\\)" 1 'font-lock-keyword-face)
+ ("\\(\\([.]\\|_\\|\\w\\)+\\)\\s-*=" 1 'font-lock-variable-name-face)
+ ("\\('[^']+'\\)" 1 'font-lock-string-face)
+ ("\\(\"[^\"]+\"\\)" 1 'font-lock-string-face)
+ )
+ (list "\\.[sS][pP]\\'"
+ "\\.[sS][pP][iI]\\'"
+ "\\.[sS][pP][iI][cC][eE]\\'"
+ "\\.[iI][nN][cC]\\'")
+ (list
+ 'generic-bracket-support
+ ;; Make keywords case-insensitive
+ (function
+ (lambda()
+ (setq font-lock-defaults (list 'generic-font-lock-defaults nil t))))
+ )
+ "Generic mode for SPICE circuit netlist files."
+ )
+
+(define-generic-mode 'ibis-generic-mode
+ (list ?|)
+ nil
+ '(
+ ("[[]\\([^]]*\\)[]]" 1 'font-lock-keyword-face)
+ ("\\(\\(_\\|\\w\\)+\\)\\s-*=" 1 'font-lock-variable-name-face)
+ )
+ (list "\\.[iI][bB][sS]\\'")
+ (list 'generic-bracket-support)
+ "Generic mode for IBIS circuit netlist files."
+ )
+
+(define-generic-mode 'astap-generic-mode
+ nil
+ (list
+ "analyze"
+ "description"
+ "elements"
+ "execution"
+ "features"
+ "functions"
+ "ground"
+ "model"
+ "outputs"
+ "print"
+ "run"
+ "controls"
+ "table"
+ )
+ '(
+ ("^\\s-*\\([*].*\\)" 1 'font-lock-comment-face)
+ (";\\s-*\\([*].*\\)" 1 'font-lock-comment-face)
+ ("^\\s-*\\([.]\\w+\\>\\)" 1 'font-lock-keyword-face)
+ ("\\('[^']+'\\)" 1 'font-lock-string-face)
+ ("\\(\"[^\"]+\"\\)" 1 'font-lock-string-face)
+ ("[(,]\\s-*\\(\\([.]\\|_\\|\\w\\)+\\)\\s-*=" 1 'font-lock-variable-name-face)
+ )
+ (list "\\.[aA][pP]\\'"
+ "\\.[aA][sS][xX]\\'"
+ "\\.[aA][sS][tT][aA][pP]\\'"
+ "\\.[pP][sS][pP]\\'"
+ "\\.[dD][eE][cC][kK]\\'"
+ "\\.[gG][oO][dD][aA][tT][aA]")
+ (list
+ 'generic-bracket-support
+ ;; Make keywords case-insensitive
+ (function
+ (lambda()
+ (setq font-lock-defaults (list 'generic-font-lock-defaults nil t))))
+ )
+ "Generic mode for ASTAP circuit netlist files."
+ )
+
+