annotate lisp/modes/m4-mode.el @ 157:6b37e6ddd302 r20-3b5

Import from CVS: tag r20-3b5
author cvs
date Mon, 13 Aug 2007 09:40:41 +0200
parents 59463afc5666
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1 ;;; m4-mode.el --- m4 code editing commands for Emacs
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
2
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
3 ;; Author: Andrew Csillag (drew@staff.prodigy.com)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
4 ;; Maintainer: Andrew Csillag (drew@staff.prodigy.com)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
5 ;; Keywords: languages, faces
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
6
149
538048ae2ab8 Import from CVS: tag r20-3b1
cvs
parents: 82
diff changeset
7 ;; This file is part of GNU Emacs.
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
8
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
9 ;; GNU Emacs is free software; you can redistribute it and/or modify
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
10 ;; it under the terms of the GNU General Public License as published by
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
11 ;; the Free Software Foundation; either version 2, or (at your option)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
12 ;; any later version.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
13
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
14 ;; GNU Emacs is distributed in the hope that it will be useful,
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
17 ;; GNU General Public License for more details.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
18
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
19 ;; You should have received a copy of the GNU General Public License
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
20 ;; along with GNU Emacs; see the file COPYING. If not, write to the
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
21 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
22 ;; Boston, MA 02111-1307, USA.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
23
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
24 ;;; Commentary:
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
25
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
26 ;; A smart editing mode for m4 macro definitions. It seems to have most of the
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
27 ;; syntax right (sexp motion commands work, but function motion commands don't).
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
28 ;; It also sets the font-lock syntax stuff for colorization
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
29
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
30 ;; By Drew Csillag (drew@staff.prodigy.com)
151
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 149
diff changeset
31 ;; $Id: m4-mode.el,v 1.4 1997/05/23 01:36:24 steve Exp $
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
32
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
33 ;; History:
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
34
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
35 ;; Date Version Who Action
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
36 ;; -------- ------- --- ----
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
37 ;; 09/13/96 1.0 DC Created
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
38 ;; 09/26/96 1.1 DC added syntax table stuff so now matches `'s
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
39 ;; now can use C-c C-b to m4 on buffer,C-c C-r for region
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
40 ;; added m4-comment-region (C-c C-c)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
41 ;; 09/27/96 1.2 DC Redid header comment
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
42 ;; 1.3 DC more cosmetic fixes
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
43 ;; 1.4 DC removed m4-comment-region, using comment-region instead
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
44 ;; 10/03/96 DC added provide line
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
45 ;; 10/24/96 1.5 DC fixed keyword regexp
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
46 ;; 10/29/96 1.6 DC added m4_keywords for --prefix-builtins
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
47 ;; fixed syntax table so _define_ isn't keywordified
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
48 ;; 10/29/96 1.8 DC fixed a problem where comments go fontified incorrectly
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
49 ;; if they had quotes in them
149
538048ae2ab8 Import from CVS: tag r20-3b1
cvs
parents: 82
diff changeset
50 ;; 11/21/96 1.9 DC collapsed 4 regexps into 1 and removed a duplicate,
538048ae2ab8 Import from CVS: tag r20-3b1
cvs
parents: 82
diff changeset
51 ;; removed a duplicate backslash
538048ae2ab8 Import from CVS: tag r20-3b1
cvs
parents: 82
diff changeset
52 ;; 05/16/97 1.10 DC added contributed fixes and enhancements from
538048ae2ab8 Import from CVS: tag r20-3b1
cvs
parents: 82
diff changeset
53 ;; Martin Buchholz
538048ae2ab8 Import from CVS: tag r20-3b1
cvs
parents: 82
diff changeset
54 ;; Can now specify options to m4 via m4-program-options
538048ae2ab8 Import from CVS: tag r20-3b1
cvs
parents: 82
diff changeset
55 ;; Now terminates m4 processes when the buffer send
538048ae2ab8 Import from CVS: tag r20-3b1
cvs
parents: 82
diff changeset
56 is
538048ae2ab8 Import from CVS: tag r20-3b1
cvs
parents: 82
diff changeset
57 ;; done
538048ae2ab8 Import from CVS: tag r20-3b1
cvs
parents: 82
diff changeset
58 ;; dnl and m4_dnl recognized as comment starters
538048ae2ab8 Import from CVS: tag r20-3b1
cvs
parents: 82
diff changeset
59
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
60 ;; To Do's:
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
61
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
62 ;; * want to make m4-m4-(buffer|region) look sorta like M-x compile look&feel ?
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
63 ;; * sexp motion commands don't seem to work right
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
64
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
65 ;; to autoload m4 lisp code:
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
66 ;; (autoload 'm4-mode "m4-mode" nil t)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
67 ;;
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
68 ;; or can use (load "m4-mode") or (require 'm4-mode) to just load it
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
69 ;;
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
70 ;; to try to "auto-detect" m4 files:
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
71 ;; (setq auto-mode-alist
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
72 ;; (cons '(".*\\.m4$" . m4-mode)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
73 ;; auto-mode-alist))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
74
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
75 ;;; Thanks:
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
76 ;;; to Akim Demaille and Terry Jones for the bug reports
149
538048ae2ab8 Import from CVS: tag r20-3b1
cvs
parents: 82
diff changeset
77 ;;; to Simon Marshall for the regexp tip
538048ae2ab8 Import from CVS: tag r20-3b1
cvs
parents: 82
diff changeset
78 ;;; to Martin Buchholz for some general fixes
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
79
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
80 ;;; Code:
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
81
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
82 ;;path to the m4 program
149
538048ae2ab8 Import from CVS: tag r20-3b1
cvs
parents: 82
diff changeset
83 (defvar m4-program
538048ae2ab8 Import from CVS: tag r20-3b1
cvs
parents: 82
diff changeset
84 (cond
538048ae2ab8 Import from CVS: tag r20-3b1
cvs
parents: 82
diff changeset
85 ((file-exists-p "/usr/local/bin/m4") "/usr/local/bin/m4")
538048ae2ab8 Import from CVS: tag r20-3b1
cvs
parents: 82
diff changeset
86 ((file-exists-p "/usr/bin/m4") "/usr/bin/m4")
538048ae2ab8 Import from CVS: tag r20-3b1
cvs
parents: 82
diff changeset
87 ((file-exists-p "/bin/m4") "/bin/m4")
538048ae2ab8 Import from CVS: tag r20-3b1
cvs
parents: 82
diff changeset
88 ((file-exists-p "/usr/ccs/bin/m4") "/usr/ccs/bin/m4")
538048ae2ab8 Import from CVS: tag r20-3b1
cvs
parents: 82
diff changeset
89 )
538048ae2ab8 Import from CVS: tag r20-3b1
cvs
parents: 82
diff changeset
90 )
538048ae2ab8 Import from CVS: tag r20-3b1
cvs
parents: 82
diff changeset
91
538048ae2ab8 Import from CVS: tag r20-3b1
cvs
parents: 82
diff changeset
92 ;;options to m4
538048ae2ab8 Import from CVS: tag r20-3b1
cvs
parents: 82
diff changeset
93 (defconst m4-program-options nil)
538048ae2ab8 Import from CVS: tag r20-3b1
cvs
parents: 82
diff changeset
94 ;;to use --prefix-builtins, you can use
538048ae2ab8 Import from CVS: tag r20-3b1
cvs
parents: 82
diff changeset
95 ;;(defconst m4-program-options '("-P"))
538048ae2ab8 Import from CVS: tag r20-3b1
cvs
parents: 82
diff changeset
96 ;;or
538048ae2ab8 Import from CVS: tag r20-3b1
cvs
parents: 82
diff changeset
97 ;;(defconst m4-program-options '("--prefix-builtins"))
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
98
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
99 ;;thank god for make-regexp.el!
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
100 (defvar m4-font-lock-keywords
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
101 `(
149
538048ae2ab8 Import from CVS: tag r20-3b1
cvs
parents: 82
diff changeset
102 ("\\(\\bdnl\\b\\|\\bm4_dnl\\b\\|^\\#\\).*$" .
538048ae2ab8 Import from CVS: tag r20-3b1
cvs
parents: 82
diff changeset
103 font-lock-comment-face)
538048ae2ab8 Import from CVS: tag r20-3b1
cvs
parents: 82
diff changeset
104 ("\\$[*#@0-9]" . font-lock-variable-name-face)
538048ae2ab8 Import from CVS: tag r20-3b1
cvs
parents: 82
diff changeset
105
538048ae2ab8 Import from CVS: tag r20-3b1
cvs
parents: 82
diff changeset
106 ("\\b\\(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"
538048ae2ab8 Import from CVS: tag r20-3b1
cvs
parents: 82
diff changeset
107 . font-lock-keyword-face)
538048ae2ab8 Import from CVS: tag r20-3b1
cvs
parents: 82
diff changeset
108
538048ae2ab8 Import from CVS: tag r20-3b1
cvs
parents: 82
diff changeset
109 ("\\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\\)\\|i\\(f\\(def\\|else\\)\\|n\\(c\\(lude\\|r\\)\\|d\\(ex\\|ir\\)\\)\\)\\|l\\(en\\|ine\\)\\|m\\(4\\(_undefine\\|exit\\|wrap\\)\\|aketemp\\)\\|p\\(atsubst\\|opdef\\|ushdef\\)\\|regexp\\|s\\(hift\\|include\\|ubstr\\|ys\\(cmd\\|val\\)\\)\\|tra\\(ceo\\(ff\\|n\\)\\|nslit\\)\\|undivert\\)\\)\\b"
538048ae2ab8 Import from CVS: tag r20-3b1
cvs
parents: 82
diff changeset
110 . font-lock-keyword-face)
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
111 "default font-lock-keywords")
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
112 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
113
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
114 ;;this may still need some work
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
115 (defvar m4-mode-syntax-table nil
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
116 "syntax table used in m4 mode")
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
117 (setq m4-mode-syntax-table (make-syntax-table))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
118 (modify-syntax-entry ?` "('" m4-mode-syntax-table)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
119 (modify-syntax-entry ?' ")`" m4-mode-syntax-table)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
120 (modify-syntax-entry ?# "<\n" m4-mode-syntax-table)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
121 (modify-syntax-entry ?\n ">#" m4-mode-syntax-table)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
122 (modify-syntax-entry ?{ "_" m4-mode-syntax-table)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
123 (modify-syntax-entry ?} "_" m4-mode-syntax-table)
151
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 149
diff changeset
124 (modify-syntax-entry ?* "." m4-mode-syntax-table)
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 149
diff changeset
125 (modify-syntax-entry ?_ "_" m4-mode-syntax-table)
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 149
diff changeset
126 (modify-syntax-entry ?\" "w" m4-mode-syntax-table)
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
127
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
128 (defvar m4-mode-map
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
129 (let ((map (make-sparse-keymap)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
130 (define-key map "\C-c\C-b" 'm4-m4-buffer)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
131 (define-key map "\C-c\C-r" 'm4-m4-region)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
132 (define-key map "\C-c\C-c" 'comment-region)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
133 map))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
134
149
538048ae2ab8 Import from CVS: tag r20-3b1
cvs
parents: 82
diff changeset
135 (defun m4-end-m4 (process event)
538048ae2ab8 Import from CVS: tag r20-3b1
cvs
parents: 82
diff changeset
136 (cond ((equal event "kill\n") (princ "m4 process done"))
538048ae2ab8 Import from CVS: tag r20-3b1
cvs
parents: 82
diff changeset
137 (t (princ
538048ae2ab8 Import from CVS: tag r20-3b1
cvs
parents: 82
diff changeset
138 (format "Process: %s had the event `%s'" process event)))))
538048ae2ab8 Import from CVS: tag r20-3b1
cvs
parents: 82
diff changeset
139
538048ae2ab8 Import from CVS: tag r20-3b1
cvs
parents: 82
diff changeset
140 (defun m4-start-m4 ()
538048ae2ab8 Import from CVS: tag r20-3b1
cvs
parents: 82
diff changeset
141 (eval (append (append '(start-process "m4process" "*m4 output*"
538048ae2ab8 Import from CVS: tag r20-3b1
cvs
parents: 82
diff changeset
142 m4-program)
538048ae2ab8 Import from CVS: tag r20-3b1
cvs
parents: 82
diff changeset
143 m4-program-options) '("-e")))
538048ae2ab8 Import from CVS: tag r20-3b1
cvs
parents: 82
diff changeset
144 (set-process-sentinel (get-process "m4process") 'm4-end-m4)
538048ae2ab8 Import from CVS: tag r20-3b1
cvs
parents: 82
diff changeset
145 )
538048ae2ab8 Import from CVS: tag r20-3b1
cvs
parents: 82
diff changeset
146
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
147 (defun m4-m4-buffer ()
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
148 "send contents of the current buffer to m4"
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
149 (interactive)
149
538048ae2ab8 Import from CVS: tag r20-3b1
cvs
parents: 82
diff changeset
150 (m4-start-m4)
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
151 (process-send-region "m4process" (point-min) (point-max))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
152 (process-send-eof "m4process")
149
538048ae2ab8 Import from CVS: tag r20-3b1
cvs
parents: 82
diff changeset
153 (switch-to-buffer-other-window "*m4 output*")
538048ae2ab8 Import from CVS: tag r20-3b1
cvs
parents: 82
diff changeset
154 (delete-process "m4process")
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
155 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
156
149
538048ae2ab8 Import from CVS: tag r20-3b1
cvs
parents: 82
diff changeset
157
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
158 (defun m4-m4-region ()
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
159 "send contents of the current region to m4"
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
160 (interactive)
149
538048ae2ab8 Import from CVS: tag r20-3b1
cvs
parents: 82
diff changeset
161 (m4-start-m4)
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
162 (process-send-region "m4process" (point) (mark))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
163 (process-send-eof "m4process")
149
538048ae2ab8 Import from CVS: tag r20-3b1
cvs
parents: 82
diff changeset
164 (switch-to-buffer-other-window "*m4 output*")
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
165 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
166
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
167 (defun m4-mode ()
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
168 "A major-mode to edit m4 macro files
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
169 \\{m4-mode-map}
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
170 "
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
171 (interactive)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
172 (kill-all-local-variables)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
173 (use-local-map m4-mode-map)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
174
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
175 (make-local-variable 'comment-start)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
176 (setq comment-start "#")
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
177 (make-local-variable 'parse-sexp-ignore-comments)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
178 (setq parse-sexp-ignore-comments t)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
179
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
180
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
181 (make-local-variable 'font-lock-defaults)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
182 (setq major-mode 'm4-mode
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
183 mode-name "m4"
149
538048ae2ab8 Import from CVS: tag r20-3b1
cvs
parents: 82
diff changeset
184 font-lock-defaults '(m4-font-lock-keywords nil)
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
185 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
186 (set-syntax-table m4-mode-syntax-table)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
187 (run-hooks 'm4-mode-hook))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
188
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
189 (provide 'm4-mode)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
190 ;;stuff to play with for debugging
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
191 ;(char-to-string (char-syntax ?`))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
192
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
193 ;;;how I generate the nasty looking regexps at the top
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
194 ;;;(make-regexp '("builtin" "changecom" "changequote" "changeword" "debugfile"
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
195 ;;; "debugmode" "decr" "define" "defn" "divert" "divnum" "dnl"
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
196 ;;; "dumpdef" "errprint" "esyscmd" "eval" "file" "format" "gnu"
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
197 ;;; "ifdef" "ifelse" "include" "incr" "index" "indir" "len" "line"
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
198 ;;; "m4exit" "m4wrap" "maketemp" "patsubst" "popdef" "pushdef" "regexp"
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
199 ;;; "shift" "sinclude" "substr" "syscmd" "sysval" "traceoff" "traceon"
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
200 ;;; "translit" "undefine" "undivert" "unix"))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
201 ;;;(make-regexp '("m4_builtin" "m4_changecom" "m4_changequote" "m4_changeword"
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
202 ;;; "m4_debugfile" "m4_debugmode" "m4_decr" "m4_define" "m4_defn"
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
203 ;;; "m4_divert" "m4_divnum" "m4_dnl" "m4_dumpdef" "m4_errprint"
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
204 ;;; "m4_esyscmd" "m4_eval" "m4_file" "m4_format" "m4_ifdef" "m4_ifelse"
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
205 ;;; "m4_include" "m4_incr" "m4_index" "m4_indir" "m4_len" "m4_line"
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
206 ;;; "m4_m4exit" "m4_m4wrap" "m4_maketemp" "m4_patsubst" "m4_popdef"
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
207 ;;; "m4_pushdef" "m4_regexp" "m4_shift" "m4_sinclude" "m4_substr"
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
208 ;;; "m4_syscmd" "m4_sysval" "m4_traceoff" "m4_traceon" "m4_translit"
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
209 ;;; "m4_m4_undefine" "m4_undivert"))