generic-x.el 53 KB

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