1 ;;; autoconf-mode.el --- autoconf code editing commands for Emacs
3 ;; Author: Martin Buchholz (martin@xemacs.org)
4 ;; Maintainer: Martin Buchholz
5 ;; Keywords: languages, faces, m4, configure
7 ;; This file is part of XEmacs
9 ;; XEmacs is free software; you can redistribute it and/or modify it
10 ;; under the terms of the GNU General Public License as published by
11 ;; the Free Software Foundation; either version 2, or (at your option)
14 ;; XEmacs is distributed in the hope that it will be useful, but
15 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 ;; General Public License for more details.
19 ;; You should have received a copy of the GNU General Public License
20 ;; along with XEmacs; see the file COPYING. If not, write to the Free
21 ;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
24 ;;; Synched up with: not in FSF.
28 ;; A major mode for editing autoconf input (like configure.in).
29 ;; Derived from m4-mode.el by Andrew Csillag (drew@staff.prodigy.com)
33 ;;thank god for make-regexp.el!
34 (defvar autoconf-font-lock-keywords
35 `(("\\bdnl \\(.*\\)" 1 font-lock-comment-face t)
36 ("\\$[0-9*#@]" . font-lock-variable-name-face)
37 ("\\b\\(m4_\\)?\\(builtin\\|change\\(com\\|quote\\|word\\)\\|d\\(e\\(bug\\(file\\|mode\\)\\|cr\\|f\\(ine\\|n\\)\\)\\|iv\\(ert\\|num\\)\\|nl\\|umpdef\\)\\|e\\(rrprint\\|syscmd\\|val\\)\\|f\\(ile\\|ormat\\)\\|gnu\\|i\\(f\\(def\\|else\\)\\|n\\(c\\(lude\\|r\\)\\|d\\(ex\\|ir\\)\\)\\)\\|l\\(en\\|ine\\)\\|m\\(4\\(exit\\|wrap\\)\\|aketemp\\)\\|p\\(atsubst\\|opdef\\|ushdef\\)\\|regexp\\|s\\(hift\\|include\\|ubstr\\|ys\\(cmd\\|val\\)\\)\\|tra\\(ceo\\(ff\\|n\\)\\|nslit\\)\\|un\\(d\\(efine\\|ivert\\)\\|ix\\)\\)\\b" . font-lock-keyword-face)
38 ("^\\(\\(m4_\\)?define\\|A._DEFUN\\)(\\[?\\([A-Za-z0-9_]+\\)" 3 font-lock-function-name-face)
39 "default font-lock-keywords")
42 (defvar autoconf-mode-syntax-table nil
43 "syntax table used in autoconf mode")
44 (setq autoconf-mode-syntax-table (make-syntax-table))
45 (modify-syntax-entry ?\" "\"" autoconf-mode-syntax-table)
46 ;;(modify-syntax-entry ?\' "\"" autoconf-mode-syntax-table)
47 (modify-syntax-entry ?# "<\n" autoconf-mode-syntax-table)
48 (modify-syntax-entry ?\n ">#" autoconf-mode-syntax-table)
49 (modify-syntax-entry ?\( "()" autoconf-mode-syntax-table)
50 (modify-syntax-entry ?\) ")(" autoconf-mode-syntax-table)
51 (modify-syntax-entry ?\[ "(]" autoconf-mode-syntax-table)
52 (modify-syntax-entry ?\] ")[" autoconf-mode-syntax-table)
53 (modify-syntax-entry ?* "." autoconf-mode-syntax-table)
54 (modify-syntax-entry ?_ "_" autoconf-mode-syntax-table)
56 (defvar autoconf-mode-map
57 (let ((map (make-sparse-keymap)))
58 (define-key map "\C-c\C-c" 'comment-region)
62 (defun autoconf-mode ()
63 "A major-mode to edit autoconf input files like configure.in
67 (kill-all-local-variables)
68 (use-local-map autoconf-mode-map)
70 (make-local-variable 'comment-start)
71 (setq comment-start "dnl ")
72 (make-local-variable 'parse-sexp-ignore-comments)
73 (setq parse-sexp-ignore-comments t)
75 (make-local-variable 'font-lock-defaults)
76 (setq major-mode 'autoconf-mode)
77 (setq mode-name "Autoconf")
78 (setq font-lock-defaults `(autoconf-font-lock-keywords nil))
79 (set-syntax-table autoconf-mode-syntax-table)
80 (run-hooks 'autoconf-mode-hook))
82 ;;;###autoload(add-to-list 'auto-mode-alist '("\\.m4\\'" . autoconf-mode))
83 ;;;###autoload(add-to-list 'auto-mode-alist '("configure\\.\\(in\\|ac\\)\\'" . autoconf-mode))
85 (provide 'autoconf-mode)
87 ;;; autoconf-mode.el ends here