Mercurial > emacs
annotate lisp/progmodes/cc-langs.el @ 27738:581c76c41ca4
(mark_object): Don't mark symbol names in pure space.
(gc_sweep): Don't unmark symbol names in pure space.
(toplevel): Include setjmp.h.
(PURE_POINTER_P): New define.
(enum mem_type) [GC_MARK_STACK]: New enumeration.
(Vdead) [GC_MARK_STACK]: New variable.
(lisp_malloc): Add parameter TYPE, call mem_insert if
GC_MARK_STACK is defined.
(allocate_buffer): New function.
(lisp_free) [GC_MARK_STACK]: Call mem_delete.
(free_float) [GC_MARK_STACK]: Set type to Vdead.
(free_cons) [GC_MARK_STACK]: Set car to Vdead.
(stack_base, mem_root, mem_z) [GC_MARK_STACK]: New variables.
(MEM_NIL) [GC_MARK_STACK]: New define.
(struct mem_node) [GC_MARK_STACK]: New structure.
(mem_init, mem_find, mem_insert, mem_delete, mem_insert_fixup)
(mem_delete_fixup, mem_rotate_left, mem_rotate_right)
(live_string_p, live_cons_p, live_symbol_p, live_float_p)
(live_misc_p, live_vector_p, live_buffer_p, mark_memory)
(mark_stack) [GC_MARK_STACK]: New functions.
(Fgarbage_collect) [GC_MARK_STACK]: Call mark_stack.
(clear_marks): Removed.
(gc_sweep): Set free conses' car, free floats' type, free
symbols' function to Vdead. Use lisp_free to free buffers.
(init_alloc_once): Initialize Vdead.
(survives_gc_p): Return non-zero for pure objects.
Add comments throughout the file.
author | Gerd Moellmann <gerd@gnu.org> |
---|---|
date | Thu, 17 Feb 2000 15:21:21 +0000 |
parents | 03befb219d03 |
children | cc4564c9cd55 |
rev | line source |
---|---|
18720 | 1 ;;; cc-langs.el --- specific language support for CC Mode |
2 | |
26817 | 3 ;; Copyright (C) 1985,1987,1992-1999 Free Software Foundation, Inc. |
18720 | 4 |
26817 | 5 ;; Authors: 1998-1999 Barry A. Warsaw and Martin Stjernholm |
24282 | 6 ;; 1992-1997 Barry A. Warsaw |
18720 | 7 ;; 1987 Dave Detlefs and Stewart Clamen |
8 ;; 1985 Richard M. Stallman | |
24282 | 9 ;; Maintainer: bug-cc-mode@gnu.org |
18720 | 10 ;; Created: 22-Apr-1997 (split from cc-mode.el) |
20141 | 11 ;; Version: See cc-mode.el |
18720 | 12 ;; Keywords: c languages oop |
13 | |
14 ;; This file is part of GNU Emacs. | |
15 | |
16 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
17 ;; it under the terms of the GNU General Public License as published by | |
18 ;; the Free Software Foundation; either version 2, or (at your option) | |
19 ;; any later version. | |
20 | |
21 ;; GNU Emacs is distributed in the hope that it will be useful, | |
22 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
23 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
24 ;; GNU General Public License for more details. | |
25 | |
26 ;; You should have received a copy of the GNU General Public License | |
27 ;; along with GNU Emacs; see the file COPYING. If not, write to the | |
28 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
29 ;; Boston, MA 02111-1307, USA. | |
30 | |
26817 | 31 (eval-when-compile |
32 (let ((load-path | |
33 (if (and (boundp 'byte-compile-current-file) | |
34 (stringp byte-compile-current-file)) | |
35 (cons (file-name-directory byte-compile-current-file) | |
36 load-path) | |
37 load-path))) | |
38 (load "cc-defs" nil t))) | |
39 (require 'cc-styles) | |
40 | |
41 ;; Pull in some other packages. | |
42 (eval-when-compile | |
43 (condition-case nil | |
44 ;; Not required and only needed during compilation to shut up | |
45 ;; the compiler. | |
46 (require 'outline) | |
47 (error nil))) | |
48 ;; menu support for both XEmacs and Emacs. If you don't have easymenu | |
49 ;; with your version of Emacs, you are incompatible! | |
50 (require 'easymenu) | |
18842
72c2475ece1c
Require 'cc-defs for the definition of c-emacs-features.
Richard M. Stallman <rms@gnu.org>
parents:
18772
diff
changeset
|
51 |
18720 | 52 |
26817 | 53 (defvar c-buffer-is-cc-mode nil |
54 "Non-nil for all buffers with a `major-mode' derived from CC Mode. | |
55 Otherwise, this variable is nil. I.e. this variable is non-nil for | |
56 `c-mode', `c++-mode', `objc-mode', `java-mode', `idl-mode', | |
57 `pike-mode', and any other non-CC Mode mode that calls | |
58 `c-initialize-cc-mode' (e.g. `awk-mode').") | |
59 (make-variable-buffer-local 'c-buffer-is-cc-mode) | |
60 (put 'c-buffer-is-cc-mode 'permanent-local t) | |
18772 | 61 |
26817 | 62 |
18720 | 63 ;; Regular expressions and other values which must be parameterized on |
64 ;; a per-language basis. | |
65 | |
66 ;; Keywords defining protection levels | |
67 (defconst c-protection-key "\\<\\(public\\|protected\\|private\\)\\>") | |
68 | |
18842
72c2475ece1c
Require 'cc-defs for the definition of c-emacs-features.
Richard M. Stallman <rms@gnu.org>
parents:
18772
diff
changeset
|
69 ;; Regex describing a `symbol' in all languages. We cannot use just |
18720 | 70 ;; `word' syntax class since `_' cannot be in word class. Putting |
71 ;; underscore in word class breaks forward word movement behavior that | |
18842
72c2475ece1c
Require 'cc-defs for the definition of c-emacs-features.
Richard M. Stallman <rms@gnu.org>
parents:
18772
diff
changeset
|
72 ;; users are familiar with. Besides, this runs counter to Emacs |
72c2475ece1c
Require 'cc-defs for the definition of c-emacs-features.
Richard M. Stallman <rms@gnu.org>
parents:
18772
diff
changeset
|
73 ;; convention. |
72c2475ece1c
Require 'cc-defs for the definition of c-emacs-features.
Richard M. Stallman <rms@gnu.org>
parents:
18772
diff
changeset
|
74 ;; |
72c2475ece1c
Require 'cc-defs for the definition of c-emacs-features.
Richard M. Stallman <rms@gnu.org>
parents:
18772
diff
changeset
|
75 ;; I suspect this definition isn't correct in light of Java's |
72c2475ece1c
Require 'cc-defs for the definition of c-emacs-features.
Richard M. Stallman <rms@gnu.org>
parents:
18772
diff
changeset
|
76 ;; definition of a symbol as being Unicode. I know so little about |
72c2475ece1c
Require 'cc-defs for the definition of c-emacs-features.
Richard M. Stallman <rms@gnu.org>
parents:
18772
diff
changeset
|
77 ;; I18N (except how to sound cool and say I18N :-) that I'm willing to |
72c2475ece1c
Require 'cc-defs for the definition of c-emacs-features.
Richard M. Stallman <rms@gnu.org>
parents:
18772
diff
changeset
|
78 ;; punt on this for now. |
72c2475ece1c
Require 'cc-defs for the definition of c-emacs-features.
Richard M. Stallman <rms@gnu.org>
parents:
18772
diff
changeset
|
79 |
72c2475ece1c
Require 'cc-defs for the definition of c-emacs-features.
Richard M. Stallman <rms@gnu.org>
parents:
18772
diff
changeset
|
80 (defconst c-symbol-key "[_a-zA-Z]\\(\\w\\|\\s_\\)*") |
18720 | 81 |
82 | |
83 ;; keywords introducing class definitions. language specific | |
84 (defconst c-C-class-key "\\(struct\\|union\\)") | |
85 (defconst c-C++-class-key "\\(class\\|struct\\|union\\)") | |
26817 | 86 (defconst c-IDL-class-key "\\(interface\\|struct\\|union\\|valuetype\\)") |
24282 | 87 (defconst c-C-extra-toplevel-key "\\(extern\\)") |
88 (defconst c-C++-extra-toplevel-key "\\(extern\\|namespace\\)") | |
89 (defconst c-IDL-extra-toplevel-key "\\(module\\)") | |
18720 | 90 |
91 (defconst c-ObjC-class-key | |
92 (concat | |
93 "@\\(interface\\|implementation\\)\\s +" | |
94 c-symbol-key ;name of the class | |
95 "\\(\\s *:\\s *" c-symbol-key "\\)?" ;maybe followed by the superclass | |
96 "\\(\\s *<[^>]+>\\)?" ;and maybe the adopted protocols list | |
97 )) | |
98 | |
99 (defconst c-Java-class-key | |
100 (concat | |
101 "\\(" c-protection-key "\\s +\\)?" | |
102 "\\(interface\\|class\\)\\s +" | |
103 c-symbol-key ;name of the class | |
24282 | 104 "\\(\\s *extends\\s *" c-symbol-key "\\)?" ;maybe followed by superclass |
18720 | 105 ;;"\\(\\s *implements *[^{]+{\\)?" ;maybe the adopted protocols list |
106 )) | |
107 | |
24282 | 108 (defconst c-Pike-class-key "class") |
109 | |
18720 | 110 (defvar c-class-key c-C-class-key) |
111 (make-variable-buffer-local 'c-class-key) | |
112 | |
20915
c746c93c9c95
(c-postprocess-file-styles): If a file style or file offsets are set,
Richard M. Stallman <rms@gnu.org>
parents:
20141
diff
changeset
|
113 (defvar c-extra-toplevel-key c-C-extra-toplevel-key) |
c746c93c9c95
(c-postprocess-file-styles): If a file style or file offsets are set,
Richard M. Stallman <rms@gnu.org>
parents:
20141
diff
changeset
|
114 (make-variable-buffer-local 'c-extra-toplevel-key) |
c746c93c9c95
(c-postprocess-file-styles): If a file style or file offsets are set,
Richard M. Stallman <rms@gnu.org>
parents:
20141
diff
changeset
|
115 |
26817 | 116 ;; Keywords that can introduce bitfields in the languages that supports that. |
117 (defconst c-C-bitfield-key "\\(char\\|int\\|long\\|signed\\|unsigned\\)") | |
118 | |
119 (defvar c-bitfield-key nil) | |
120 (make-variable-buffer-local 'c-bitfield-key) | |
121 | |
18720 | 122 |
123 ;; regexp describing access protection clauses. language specific | |
124 (defvar c-access-key nil) | |
125 (make-variable-buffer-local 'c-access-key) | |
126 (defconst c-C++-access-key (concat c-protection-key "[ \t]*:")) | |
26817 | 127 (defconst c-IDL-access-key nil) |
18720 | 128 (defconst c-ObjC-access-key (concat "@" c-protection-key)) |
129 (defconst c-Java-access-key nil) | |
24282 | 130 (defconst c-Pike-access-key nil) |
18720 | 131 |
132 | |
133 ;; keywords introducing conditional blocks | |
134 (defconst c-C-conditional-key nil) | |
135 (defconst c-C++-conditional-key nil) | |
26817 | 136 (defconst c-IDL-conditional-key nil) |
137 (defconst c-ObjC-conditional-key nil) | |
18720 | 138 (defconst c-Java-conditional-key nil) |
24282 | 139 (defconst c-Pike-conditional-key nil) |
18720 | 140 |
141 (let ((all-kws "for\\|if\\|do\\|else\\|while\\|switch") | |
142 (exc-kws "\\|try\\|catch") | |
143 (thr-kws "\\|finally\\|synchronized") | |
144 (front "\\b\\(") | |
145 (back "\\)\\b[^_]")) | |
146 (setq c-C-conditional-key (concat front all-kws back) | |
147 c-C++-conditional-key (concat front all-kws exc-kws back) | |
26817 | 148 ;; c-IDL-conditional-key is nil. |
149 c-ObjC-conditional-key c-C-conditional-key | |
24282 | 150 c-Java-conditional-key (concat front all-kws exc-kws thr-kws back) |
151 c-Pike-conditional-key (concat front all-kws "\\|foreach" back))) | |
18720 | 152 |
153 (defvar c-conditional-key c-C-conditional-key) | |
154 (make-variable-buffer-local 'c-conditional-key) | |
155 | |
156 | |
157 ;; keywords describing method definition introductions | |
158 (defvar c-method-key nil) | |
159 (make-variable-buffer-local 'c-method-key) | |
160 | |
161 (defconst c-ObjC-method-key | |
162 (concat | |
163 "^\\s *[+-]\\s *" | |
164 "\\(([^)]*)\\)?" ; return type | |
165 ;; \\s- in objc syntax table does not include \n | |
166 ;; since it is considered the end of //-comments. | |
167 "[ \t\n]*" c-symbol-key)) | |
168 | |
169 | |
170 | |
171 ;; comment starter definitions for various languages. language specific | |
172 (defconst c-C++-comment-start-regexp "/[/*]") | |
26817 | 173 (defconst c-C-comment-start-regexp c-C++-comment-start-regexp) |
174 (defconst c-IDL-comment-start-regexp c-C++-comment-start-regexp) | |
175 (defconst c-ObjC-comment-start-regexp c-C++-comment-start-regexp) | |
176 (defconst c-Pike-comment-start-regexp c-C++-comment-start-regexp) | |
18720 | 177 ;; We need to match all 3 Java style comments |
178 ;; 1) Traditional C block; 2) javadoc /** ...; 3) C++ style | |
179 (defconst c-Java-comment-start-regexp "/\\(/\\|[*][*]?\\)") | |
19300
b07fa43938cc
(c-mode-base-map, c++-mode-map):
Richard M. Stallman <rms@gnu.org>
parents:
19250
diff
changeset
|
180 (defvar c-comment-start-regexp c-C++-comment-start-regexp) |
18720 | 181 (make-variable-buffer-local 'c-comment-start-regexp) |
182 | |
183 | |
184 | |
185 ;; Regexp describing a switch's case or default label for all languages | |
186 (defconst c-switch-label-key "\\(\\(case[( \t]+\\S .*\\)\\|default[ \t]*\\):") | |
187 ;; Regexp describing any label. | |
188 (defconst c-label-key (concat c-symbol-key ":\\([^:]\\|$\\)")) | |
189 | |
190 ;; Regexp describing class inheritance declarations. TBD: this should | |
191 ;; be language specific, and only makes sense for C++ | |
192 (defconst c-inher-key | |
193 (concat "\\(\\<static\\>\\s +\\)?" | |
194 c-C++-class-key "[ \t]+" c-symbol-key | |
195 "\\([ \t]*:[ \t]*\\)\\s *[^;]")) | |
196 | |
197 ;; Regexp describing C++ base classes in a derived class definition. | |
198 ;; TBD: this should be language specific, and only makes sense for C++ | |
199 (defvar c-baseclass-key | |
200 (concat | |
201 ":?[ \t]*\\(virtual[ \t]+\\)?\\(" | |
202 c-protection-key "[ \t]+\\)" c-symbol-key)) | |
203 (make-variable-buffer-local 'c-baseclass-key) | |
204 | |
205 ;; Regexp describing friend declarations in C++ classes. | |
206 (defconst c-C++-friend-key | |
207 "friend[ \t]+\\|template[ \t]*<.+>[ \t]*friend[ \t]+") | |
208 | |
209 ;; Regexp describing Java inheritance and throws clauses. | |
210 (defconst c-Java-special-key "\\(implements\\|extends\\|throws\\)[^_]") | |
211 | |
212 ;; Regexp describing the beginning of a Java top-level definition. | |
213 (defconst c-Java-defun-prompt-regexp | |
214 "^[ \t]*\\(\\(\\(public\\|protected\\|private\\|const\\|abstract\\|synchronized\\|final\\|static\\|threadsafe\\|transient\\|native\\|volatile\\)\\s-+\\)*\\(\\(\\([[a-zA-Z][][_$.a-zA-Z0-9]*[][_$.a-zA-Z0-9]+\\|[[a-zA-Z]\\)\\s-*\\)\\s-+\\)\\)?\\(\\([[a-zA-Z][][_$.a-zA-Z0-9]*\\s-+\\)\\s-*\\)?\\([_a-zA-Z][^][ \t:;.,{}()=]*\\|\\([_$a-zA-Z][_$.a-zA-Z0-9]*\\)\\)\\s-*\\(([^);{}]*)\\)?\\([] \t]*\\)\\(\\s-*\\<throws\\>\\s-*\\(\\([_$a-zA-Z][_$.a-zA-Z0-9]*\\)[, \t\n\r\f]*\\)+\\)?\\s-*") | |
215 | |
21108
e3c68a6888f9
(c-Java-javadoc-paragraph-start): New variable for use in c-fill-paragraph.
Richard M. Stallman <rms@gnu.org>
parents:
20915
diff
changeset
|
216 ;; Regexp describing Javadoc markup that always starts paragraphs. |
e3c68a6888f9
(c-Java-javadoc-paragraph-start): New variable for use in c-fill-paragraph.
Richard M. Stallman <rms@gnu.org>
parents:
20915
diff
changeset
|
217 (defconst c-Java-javadoc-paragraph-start |
26817 | 218 "@\\(author\\|exception\\|param\\|return\\|see\\|throws\\|version\\)") |
21108
e3c68a6888f9
(c-Java-javadoc-paragraph-start): New variable for use in c-fill-paragraph.
Richard M. Stallman <rms@gnu.org>
parents:
20915
diff
changeset
|
219 |
24282 | 220 ;; Regexp that starts lambda constructs. |
221 (defvar c-lambda-key nil) | |
222 (make-variable-buffer-local 'c-lambda-key) | |
223 (defconst c-Pike-lambda-key "\\<lambda\\>") | |
224 | |
225 ;; Regexp that are followed by a statement block in expressions. | |
226 (defvar c-inexpr-block-key nil) | |
227 (make-variable-buffer-local 'c-inexpr-block-key) | |
228 (defconst c-Pike-inexpr-block-key "\\<\\(catch\\|gauge\\)\\>") | |
229 | |
230 ;; Regexp that may be followed by an anonymous class in expressions. | |
231 (defvar c-inexpr-class-key nil) | |
232 (make-variable-buffer-local 'c-inexpr-class-key) | |
233 (defconst c-Java-inexpr-class-key "\\<new\\>") | |
234 | |
235 ;; List of open- and close-chars that makes up a pike-style brace | |
236 ;; list, ie for a `([ ])' list there should be a cons (?\[ . ?\]) in | |
237 ;; this list. | |
238 (defvar c-special-brace-lists nil) | |
239 (make-variable-buffer-local 'c-special-brace-lists) | |
240 (defconst c-Pike-special-brace-lists '((?{ . ?}) | |
241 (?\[ . ?\]) | |
242 (?< . ?>))) | |
243 | |
18720 | 244 |
245 | |
246 ;; internal state variables | |
247 | |
248 ;; Internal state of hungry delete key feature | |
249 (defvar c-hungry-delete-key nil) | |
250 (make-variable-buffer-local 'c-hungry-delete-key) | |
251 | |
252 ;; Internal state of auto newline feature. | |
253 (defvar c-auto-newline nil) | |
254 (make-variable-buffer-local 'c-auto-newline) | |
255 | |
256 ;; Internal auto-newline/hungry-delete designation string for mode line. | |
257 (defvar c-auto-hungry-string nil) | |
258 (make-variable-buffer-local 'c-auto-hungry-string) | |
259 | |
260 ;; Non-nil means K&R style argument declarations are valid. | |
261 (defvar c-recognize-knr-p t) | |
262 (make-variable-buffer-local 'c-recognize-knr-p) | |
263 | |
264 | |
265 | |
266 (defun c-common-init () | |
267 ;; Common initializations for all modes. | |
268 ;; these variables should always be buffer local; they do not affect | |
269 ;; indentation style. | |
270 (make-local-variable 'require-final-newline) | |
271 (make-local-variable 'parse-sexp-ignore-comments) | |
272 (make-local-variable 'indent-line-function) | |
273 (make-local-variable 'indent-region-function) | |
26817 | 274 (make-local-variable 'outline-regexp) |
275 (make-local-variable 'outline-level) | |
276 (make-local-variable 'normal-auto-fill-function) | |
18720 | 277 (make-local-variable 'comment-start) |
278 (make-local-variable 'comment-end) | |
279 (make-local-variable 'comment-column) | |
280 (make-local-variable 'comment-start-skip) | |
281 (make-local-variable 'comment-multi-line) | |
26817 | 282 (make-local-variable 'paragraph-start) |
283 (make-local-variable 'paragraph-separate) | |
284 (make-local-variable 'paragraph-ignore-fill-prefix) | |
285 (make-local-variable 'adaptive-fill-mode) | |
18720 | 286 (make-local-variable 'adaptive-fill-regexp) |
287 (make-local-variable 'imenu-generic-expression) ;set in the mode functions | |
19300
b07fa43938cc
(c-mode-base-map, c++-mode-map):
Richard M. Stallman <rms@gnu.org>
parents:
19250
diff
changeset
|
288 ;; X/Emacs 20 only |
b07fa43938cc
(c-mode-base-map, c++-mode-map):
Richard M. Stallman <rms@gnu.org>
parents:
19250
diff
changeset
|
289 (and (boundp 'comment-line-break-function) |
26817 | 290 (progn |
291 (make-local-variable 'comment-line-break-function) | |
292 (setq comment-line-break-function | |
293 'c-indent-new-comment-line))) | |
18720 | 294 ;; now set their values |
26817 | 295 (setq require-final-newline t |
18720 | 296 parse-sexp-ignore-comments t |
297 indent-line-function 'c-indent-line | |
298 indent-region-function 'c-indent-region | |
299 outline-regexp "[^#\n\^M]" | |
300 outline-level 'c-outline-level | |
26817 | 301 normal-auto-fill-function 'c-do-auto-fill |
18720 | 302 comment-column 32 |
26817 | 303 comment-start-skip "/\\*+ *\\|//+ *" |
304 comment-multi-line t) | |
305 ;; now set the mode style based on c-default-style | |
306 (let ((style (if (stringp c-default-style) | |
307 (if (c-major-mode-is 'java-mode) | |
308 "java" | |
309 c-default-style) | |
310 (or (cdr (assq major-mode c-default-style)) | |
311 (cdr (assq 'other c-default-style)) | |
312 "gnu")))) | |
313 ;; Override style variables if `c-old-style-variable-behavior' is | |
314 ;; set. Also override if we are using global style variables, | |
315 ;; have already initialized a style once, and are switching to a | |
316 ;; different style. (It's doubtful whether this is desirable, but | |
317 ;; the whole situation with nonlocal style variables is a bit | |
318 ;; awkward. It's at least the most compatible way with the old | |
319 ;; style init procedure.) | |
320 (c-set-style style (not (or c-old-style-variable-behavior | |
321 (and (not c-style-variables-are-local-p) | |
322 c-indentation-style | |
323 (not (string-equal c-indentation-style | |
324 style))))))) | |
325 ;; Fix things up for paragraph recognition and filling inside | |
326 ;; comments by using c-comment-prefix-regexp in the relevant places. | |
327 ;; We use adaptive filling for this to make it possible to use | |
328 ;; filladapt or some other fancy package. | |
329 (let ((comment-line-prefix | |
330 (concat "[ \t]*\\(" c-comment-prefix-regexp "\\)?[ \t]*"))) | |
331 (setq paragraph-start (concat comment-line-prefix "$\\|" | |
332 page-delimiter) | |
333 paragraph-separate paragraph-start | |
334 paragraph-ignore-fill-prefix t | |
335 adaptive-fill-mode t | |
336 adaptive-fill-regexp | |
337 (concat comment-line-prefix | |
338 (if adaptive-fill-regexp | |
339 (concat "\\(" adaptive-fill-regexp "\\)") | |
340 ""))) | |
341 (when (boundp 'adaptive-fill-first-line-regexp) | |
342 ;; XEmacs (20.x) adaptive fill mode doesn't have this. | |
343 (make-local-variable 'adaptive-fill-first-line-regexp) | |
344 (setq adaptive-fill-first-line-regexp | |
345 (concat "\\`" comment-line-prefix | |
346 ;; Maybe we should incorporate the old value here, | |
347 ;; but then we have to do all sorts of kludges to | |
348 ;; deal with the \` and \' it probably contains. | |
349 "\\'")))) | |
18720 | 350 ;; we have to do something special for c-offsets-alist so that the |
351 ;; buffer local value has its own alist structure. | |
352 (setq c-offsets-alist (copy-alist c-offsets-alist)) | |
353 ;; setup the comment indent variable in a Emacs version portable way | |
354 ;; ignore any byte compiler warnings you might get here | |
355 (make-local-variable 'comment-indent-function) | |
356 (setq comment-indent-function 'c-comment-indent) | |
357 ;; add menus to menubar | |
358 (easy-menu-add (c-mode-menu mode-name)) | |
359 ;; put auto-hungry designators onto minor-mode-alist, but only once | |
360 (or (assq 'c-auto-hungry-string minor-mode-alist) | |
361 (setq minor-mode-alist | |
362 (cons '(c-auto-hungry-string c-auto-hungry-string) | |
24282 | 363 minor-mode-alist))) |
364 ) | |
365 | |
18720 | 366 |
367 (defun c-postprocess-file-styles () | |
368 "Function that post processes relevant file local variables. | |
369 Currently, this function simply applies any style and offset settings | |
370 found in the file's Local Variable list. It first applies any style | |
371 setting found in `c-file-style', then it applies any offset settings | |
20915
c746c93c9c95
(c-postprocess-file-styles): If a file style or file offsets are set,
Richard M. Stallman <rms@gnu.org>
parents:
20141
diff
changeset
|
372 it finds in `c-file-offsets'. |
c746c93c9c95
(c-postprocess-file-styles): If a file style or file offsets are set,
Richard M. Stallman <rms@gnu.org>
parents:
20141
diff
changeset
|
373 |
c746c93c9c95
(c-postprocess-file-styles): If a file style or file offsets are set,
Richard M. Stallman <rms@gnu.org>
parents:
20141
diff
changeset
|
374 Note that the style variables are always made local to the buffer." |
18720 | 375 ;; apply file styles and offsets |
20915
c746c93c9c95
(c-postprocess-file-styles): If a file style or file offsets are set,
Richard M. Stallman <rms@gnu.org>
parents:
20141
diff
changeset
|
376 (if (or c-file-style c-file-offsets) |
c746c93c9c95
(c-postprocess-file-styles): If a file style or file offsets are set,
Richard M. Stallman <rms@gnu.org>
parents:
20141
diff
changeset
|
377 (c-make-styles-buffer-local t)) |
18720 | 378 (and c-file-style |
379 (c-set-style c-file-style)) | |
380 (and c-file-offsets | |
381 (mapcar | |
382 (function | |
383 (lambda (langentry) | |
384 (let ((langelem (car langentry)) | |
385 (offset (cdr langentry))) | |
386 (c-set-offset langelem offset) | |
387 ))) | |
388 c-file-offsets))) | |
389 | |
390 (add-hook 'hack-local-variables-hook 'c-postprocess-file-styles) | |
391 | |
392 | |
24282 | 393 (defvar c-mode-base-map () |
394 "Keymap shared by all CC Mode related modes.") | |
395 | |
18720 | 396 ;; Common routines |
18842
72c2475ece1c
Require 'cc-defs for the definition of c-emacs-features.
Richard M. Stallman <rms@gnu.org>
parents:
18772
diff
changeset
|
397 (defun c-make-inherited-keymap () |
18720 | 398 (let ((map (make-sparse-keymap))) |
399 (cond | |
400 ;; XEmacs 19 & 20 | |
401 ((fboundp 'set-keymap-parents) | |
402 (set-keymap-parents map c-mode-base-map)) | |
403 ;; Emacs 19 | |
404 ((fboundp 'set-keymap-parent) | |
405 (set-keymap-parent map c-mode-base-map)) | |
406 ;; incompatible | |
407 (t (error "CC Mode is incompatible with this version of Emacs"))) | |
408 map)) | |
409 | |
410 (defun c-populate-syntax-table (table) | |
411 ;; Populate the syntax TABLE | |
412 ;; DO NOT TRY TO SET _ (UNDERSCORE) TO WORD CLASS! | |
413 (modify-syntax-entry ?_ "_" table) | |
414 (modify-syntax-entry ?\\ "\\" table) | |
415 (modify-syntax-entry ?+ "." table) | |
416 (modify-syntax-entry ?- "." table) | |
417 (modify-syntax-entry ?= "." table) | |
418 (modify-syntax-entry ?% "." table) | |
419 (modify-syntax-entry ?< "." table) | |
420 (modify-syntax-entry ?> "." table) | |
421 (modify-syntax-entry ?& "." table) | |
422 (modify-syntax-entry ?| "." table) | |
19300
b07fa43938cc
(c-mode-base-map, c++-mode-map):
Richard M. Stallman <rms@gnu.org>
parents:
19250
diff
changeset
|
423 (modify-syntax-entry ?\' "\"" table) |
b07fa43938cc
(c-mode-base-map, c++-mode-map):
Richard M. Stallman <rms@gnu.org>
parents:
19250
diff
changeset
|
424 ;; Set up block and line oriented comments. The new C standard |
b07fa43938cc
(c-mode-base-map, c++-mode-map):
Richard M. Stallman <rms@gnu.org>
parents:
19250
diff
changeset
|
425 ;; mandates both comment styles even in C, so since all languages |
b07fa43938cc
(c-mode-base-map, c++-mode-map):
Richard M. Stallman <rms@gnu.org>
parents:
19250
diff
changeset
|
426 ;; now require dual comments, we make this the default. |
18720 | 427 (cond |
428 ;; XEmacs 19 & 20 | |
429 ((memq '8-bit c-emacs-features) | |
430 (modify-syntax-entry ?/ ". 1456" table) | |
19300
b07fa43938cc
(c-mode-base-map, c++-mode-map):
Richard M. Stallman <rms@gnu.org>
parents:
19250
diff
changeset
|
431 (modify-syntax-entry ?* ". 23" table)) |
b07fa43938cc
(c-mode-base-map, c++-mode-map):
Richard M. Stallman <rms@gnu.org>
parents:
19250
diff
changeset
|
432 ;; Emacs 19 & 20 |
18720 | 433 ((memq '1-bit c-emacs-features) |
434 (modify-syntax-entry ?/ ". 124b" table) | |
19300
b07fa43938cc
(c-mode-base-map, c++-mode-map):
Richard M. Stallman <rms@gnu.org>
parents:
19250
diff
changeset
|
435 (modify-syntax-entry ?* ". 23" table)) |
18720 | 436 ;; incompatible |
437 (t (error "CC Mode is incompatible with this version of Emacs")) | |
19300
b07fa43938cc
(c-mode-base-map, c++-mode-map):
Richard M. Stallman <rms@gnu.org>
parents:
19250
diff
changeset
|
438 ) |
b07fa43938cc
(c-mode-base-map, c++-mode-map):
Richard M. Stallman <rms@gnu.org>
parents:
19250
diff
changeset
|
439 (modify-syntax-entry ?\n "> b" table) |
b07fa43938cc
(c-mode-base-map, c++-mode-map):
Richard M. Stallman <rms@gnu.org>
parents:
19250
diff
changeset
|
440 ;; Give CR the same syntax as newline, for selective-display |
b07fa43938cc
(c-mode-base-map, c++-mode-map):
Richard M. Stallman <rms@gnu.org>
parents:
19250
diff
changeset
|
441 (modify-syntax-entry ?\^m "> b" table)) |
b07fa43938cc
(c-mode-base-map, c++-mode-map):
Richard M. Stallman <rms@gnu.org>
parents:
19250
diff
changeset
|
442 |
18720 | 443 |
444 (if c-mode-base-map | |
445 nil | |
446 ;; TBD: should we even worry about naming this keymap. My vote: no, | |
447 ;; because Emacs and XEmacs do it differently. | |
448 (setq c-mode-base-map (make-sparse-keymap)) | |
449 ;; put standard keybindings into MAP | |
450 ;; the following mappings correspond more or less directly to BOCM | |
451 (define-key c-mode-base-map "{" 'c-electric-brace) | |
452 (define-key c-mode-base-map "}" 'c-electric-brace) | |
453 (define-key c-mode-base-map ";" 'c-electric-semi&comma) | |
454 (define-key c-mode-base-map "#" 'c-electric-pound) | |
455 (define-key c-mode-base-map ":" 'c-electric-colon) | |
24282 | 456 (define-key c-mode-base-map "(" 'c-electric-paren) |
457 (define-key c-mode-base-map ")" 'c-electric-paren) | |
20915
c746c93c9c95
(c-postprocess-file-styles): If a file style or file offsets are set,
Richard M. Stallman <rms@gnu.org>
parents:
20141
diff
changeset
|
458 ;; Separate M-BS from C-M-h. The former should remain |
c746c93c9c95
(c-postprocess-file-styles): If a file style or file offsets are set,
Richard M. Stallman <rms@gnu.org>
parents:
20141
diff
changeset
|
459 ;; backward-kill-word. |
c746c93c9c95
(c-postprocess-file-styles): If a file style or file offsets are set,
Richard M. Stallman <rms@gnu.org>
parents:
20141
diff
changeset
|
460 (define-key c-mode-base-map [(control meta h)] 'c-mark-function) |
18720 | 461 (define-key c-mode-base-map "\e\C-q" 'c-indent-exp) |
26817 | 462 (substitute-key-definition 'backward-sentence |
463 'c-beginning-of-statement | |
464 c-mode-base-map global-map) | |
465 (substitute-key-definition 'forward-sentence | |
466 'c-end-of-statement | |
467 c-mode-base-map global-map) | |
468 (substitute-key-definition 'indent-new-comment-line | |
469 'c-indent-new-comment-line | |
470 c-mode-base-map global-map) | |
20915
c746c93c9c95
(c-postprocess-file-styles): If a file style or file offsets are set,
Richard M. Stallman <rms@gnu.org>
parents:
20141
diff
changeset
|
471 ;; RMS says don't make these the default. |
c746c93c9c95
(c-postprocess-file-styles): If a file style or file offsets are set,
Richard M. Stallman <rms@gnu.org>
parents:
20141
diff
changeset
|
472 ;; (define-key c-mode-base-map "\e\C-a" 'c-beginning-of-defun) |
c746c93c9c95
(c-postprocess-file-styles): If a file style or file offsets are set,
Richard M. Stallman <rms@gnu.org>
parents:
20141
diff
changeset
|
473 ;; (define-key c-mode-base-map "\e\C-e" 'c-end-of-defun) |
18720 | 474 (define-key c-mode-base-map "\C-c\C-n" 'c-forward-conditional) |
475 (define-key c-mode-base-map "\C-c\C-p" 'c-backward-conditional) | |
476 (define-key c-mode-base-map "\C-c\C-u" 'c-up-conditional) | |
26817 | 477 (substitute-key-definition 'indent-for-tab-command |
478 'c-indent-command | |
479 c-mode-base-map global-map) | |
480 ;; It doesn't suffice to put c-fill-paragraph on | |
481 ;; fill-paragraph-function due to the way it works. | |
482 (substitute-key-definition 'fill-paragraph 'c-fill-paragraph | |
483 c-mode-base-map global-map) | |
484 ;; In XEmacs the default fill function is called | |
485 ;; fill-paragraph-or-region. | |
486 (substitute-key-definition 'fill-paragraph-or-region 'c-fill-paragraph | |
487 c-mode-base-map global-map) | |
18720 | 488 ;; Caution! Enter here at your own risk. We are trying to support |
489 ;; several behaviors and it gets disgusting. :-( | |
490 ;; | |
26817 | 491 (if (boundp 'delete-key-deletes-forward) |
492 (progn | |
493 ;; In XEmacs 20 it is possible to sanely define both backward | |
494 ;; and forward deletion behavior under X separately (TTYs are | |
495 ;; forever beyond hope, but who cares? XEmacs 20 does the | |
496 ;; right thing with these too). | |
497 (define-key c-mode-base-map [delete] 'c-electric-delete) | |
498 (define-key c-mode-base-map [backspace] 'c-electric-backspace)) | |
499 ;; In XEmacs 19, Emacs 19, and Emacs 20, we use this to bind | |
500 ;; backwards deletion behavior to DEL, which both Delete and | |
501 ;; Backspace get translated to. There's no way to separate this | |
502 ;; behavior in a clean way, so deal with it! Besides, it's been | |
503 ;; this way since the dawn of BOCM. | |
504 (define-key c-mode-base-map "\177" 'c-electric-backspace)) | |
18720 | 505 ;; these are new keybindings, with no counterpart to BOCM |
506 (define-key c-mode-base-map "," 'c-electric-semi&comma) | |
507 (define-key c-mode-base-map "*" 'c-electric-star) | |
19300
b07fa43938cc
(c-mode-base-map, c++-mode-map):
Richard M. Stallman <rms@gnu.org>
parents:
19250
diff
changeset
|
508 (define-key c-mode-base-map "/" 'c-electric-slash) |
18720 | 509 (define-key c-mode-base-map "\C-c\C-q" 'c-indent-defun) |
510 (define-key c-mode-base-map "\C-c\C-\\" 'c-backslash-region) | |
511 ;; TBD: where if anywhere, to put c-backward|forward-into-nomenclature | |
512 (define-key c-mode-base-map "\C-c\C-a" 'c-toggle-auto-state) | |
513 (define-key c-mode-base-map "\C-c\C-b" 'c-submit-bug-report) | |
514 (define-key c-mode-base-map "\C-c\C-c" 'comment-region) | |
515 (define-key c-mode-base-map "\C-c\C-d" 'c-toggle-hungry-state) | |
516 (define-key c-mode-base-map "\C-c\C-o" 'c-set-offset) | |
517 (define-key c-mode-base-map "\C-c\C-s" 'c-show-syntactic-information) | |
518 (define-key c-mode-base-map "\C-c\C-t" 'c-toggle-auto-hungry-state) | |
519 (define-key c-mode-base-map "\C-c." 'c-set-style) | |
520 ;; conflicts with OOBR | |
521 ;;(define-key c-mode-base-map "\C-c\C-v" 'c-version) | |
522 ) | |
523 | |
524 (defvar c-c-menu nil) | |
525 (defvar c-c++-menu nil) | |
526 (defvar c-objc-menu nil) | |
527 (defvar c-java-menu nil) | |
24282 | 528 (defvar c-pike-menu nil) |
18720 | 529 |
530 (defun c-mode-menu (modestr) | |
531 (let ((m | |
24282 | 532 '(["Comment Out Region" comment-region (c-region-is-active-p)] |
18842
72c2475ece1c
Require 'cc-defs for the definition of c-emacs-features.
Richard M. Stallman <rms@gnu.org>
parents:
18772
diff
changeset
|
533 ["Uncomment Region" |
72c2475ece1c
Require 'cc-defs for the definition of c-emacs-features.
Richard M. Stallman <rms@gnu.org>
parents:
18772
diff
changeset
|
534 (comment-region (region-beginning) (region-end) '(4)) |
24282 | 535 (c-region-is-active-p)] |
18842
72c2475ece1c
Require 'cc-defs for the definition of c-emacs-features.
Richard M. Stallman <rms@gnu.org>
parents:
18772
diff
changeset
|
536 ["Fill Comment Paragraph" c-fill-paragraph t] |
72c2475ece1c
Require 'cc-defs for the definition of c-emacs-features.
Richard M. Stallman <rms@gnu.org>
parents:
18772
diff
changeset
|
537 "---" |
18720 | 538 ["Indent Expression" c-indent-exp |
539 (memq (char-after) '(?\( ?\[ ?\{))] | |
24282 | 540 ["Indent Line or Region" c-indent-line-or-region t] |
18720 | 541 ["Up Conditional" c-up-conditional t] |
542 ["Backward Conditional" c-backward-conditional t] | |
543 ["Forward Conditional" c-forward-conditional t] | |
544 ["Backward Statement" c-beginning-of-statement t] | |
545 ["Forward Statement" c-end-of-statement t] | |
18842
72c2475ece1c
Require 'cc-defs for the definition of c-emacs-features.
Richard M. Stallman <rms@gnu.org>
parents:
18772
diff
changeset
|
546 "---" |
24282 | 547 ["Macro Expand Region" c-macro-expand (c-region-is-active-p)] |
548 ["Backslashify" c-backslash-region (c-region-is-active-p)] | |
18720 | 549 ))) |
550 (cons modestr m))) | |
551 | |
552 | |
553 | |
554 ;; Support for C | |
555 | |
556 (defvar c-mode-abbrev-table nil | |
19250 | 557 "Abbreviation table used in c-mode buffers.") |
18720 | 558 (define-abbrev-table 'c-mode-abbrev-table ()) |
559 | |
560 (defvar c-mode-map () | |
561 "Keymap used in c-mode buffers.") | |
562 (if c-mode-map | |
563 nil | |
564 (setq c-mode-map (c-make-inherited-keymap)) | |
565 ;; add bindings which are only useful for C | |
19805
e804ac04eec1
(c-mode-base-map): Don't define C-c C-e here.
Richard M. Stallman <rms@gnu.org>
parents:
19381
diff
changeset
|
566 (define-key c-mode-map "\C-c\C-e" 'c-macro-expand) |
18720 | 567 ) |
568 | |
569 ;;;###autoload | |
570 (defvar c-mode-syntax-table nil | |
571 "Syntax table used in c-mode buffers.") | |
572 (if c-mode-syntax-table | |
573 () | |
574 (setq c-mode-syntax-table (make-syntax-table)) | |
19300
b07fa43938cc
(c-mode-base-map, c++-mode-map):
Richard M. Stallman <rms@gnu.org>
parents:
19250
diff
changeset
|
575 (c-populate-syntax-table c-mode-syntax-table)) |
18720 | 576 |
577 (easy-menu-define c-c-menu c-mode-map "C Mode Commands" | |
578 (c-mode-menu "C")) | |
579 | |
580 | |
581 ;; Support for C++ | |
582 | |
583 (defvar c++-mode-abbrev-table nil | |
19250 | 584 "Abbreviation table used in c++-mode buffers.") |
18720 | 585 (define-abbrev-table 'c++-mode-abbrev-table ()) |
586 | |
587 (defvar c++-mode-map () | |
588 "Keymap used in c++-mode buffers.") | |
589 (if c++-mode-map | |
590 nil | |
591 (setq c++-mode-map (c-make-inherited-keymap)) | |
592 ;; add bindings which are only useful for C++ | |
19805
e804ac04eec1
(c-mode-base-map): Don't define C-c C-e here.
Richard M. Stallman <rms@gnu.org>
parents:
19381
diff
changeset
|
593 (define-key c++-mode-map "\C-c\C-e" 'c-macro-expand) |
e804ac04eec1
(c-mode-base-map): Don't define C-c C-e here.
Richard M. Stallman <rms@gnu.org>
parents:
19381
diff
changeset
|
594 (define-key c++-mode-map "\C-c:" 'c-scope-operator) |
e804ac04eec1
(c-mode-base-map): Don't define C-c C-e here.
Richard M. Stallman <rms@gnu.org>
parents:
19381
diff
changeset
|
595 (define-key c++-mode-map "<" 'c-electric-lt-gt) |
e804ac04eec1
(c-mode-base-map): Don't define C-c C-e here.
Richard M. Stallman <rms@gnu.org>
parents:
19381
diff
changeset
|
596 (define-key c++-mode-map ">" 'c-electric-lt-gt)) |
18720 | 597 |
19300
b07fa43938cc
(c-mode-base-map, c++-mode-map):
Richard M. Stallman <rms@gnu.org>
parents:
19250
diff
changeset
|
598 ;;;###autoload |
18720 | 599 (defvar c++-mode-syntax-table nil |
600 "Syntax table used in c++-mode buffers.") | |
601 (if c++-mode-syntax-table | |
602 () | |
603 (setq c++-mode-syntax-table (make-syntax-table)) | |
604 (c-populate-syntax-table c++-mode-syntax-table) | |
605 ;; TBD: does it make sense for colon to be symbol class in C++? | |
606 ;; I'm not so sure, since c-label-key is busted on lines like: | |
607 ;; Foo::bar( i ); | |
608 ;; maybe c-label-key should be fixed instead of commenting this out, | |
609 ;; but it also bothers me that this only seems appropriate for C++ | |
610 ;; and not C. | |
611 ;;(modify-syntax-entry ?: "_" c++-mode-syntax-table) | |
612 ) | |
613 | |
26817 | 614 (defvar c++-template-syntax-table nil |
615 "A variant of `c++-mode-syntax-table' that defines `<' and `>' as | |
616 parenthesis characters. Used temporarily when template argument lists | |
617 are parsed.") | |
618 (if c++-template-syntax-table | |
619 () | |
620 (setq c++-template-syntax-table | |
621 (copy-syntax-table c++-mode-syntax-table)) | |
622 (modify-syntax-entry ?< "(>" c++-template-syntax-table) | |
623 (modify-syntax-entry ?> ")<" c++-template-syntax-table)) | |
624 | |
18720 | 625 (easy-menu-define c-c++-menu c++-mode-map "C++ Mode Commands" |
626 (c-mode-menu "C++")) | |
627 | |
628 | |
629 ;; Support for Objective-C | |
630 | |
631 (defvar objc-mode-abbrev-table nil | |
19250 | 632 "Abbreviation table used in objc-mode buffers.") |
18720 | 633 (define-abbrev-table 'objc-mode-abbrev-table ()) |
634 | |
635 (defvar objc-mode-map () | |
636 "Keymap used in objc-mode buffers.") | |
637 (if objc-mode-map | |
638 nil | |
639 (setq objc-mode-map (c-make-inherited-keymap)) | |
640 ;; add bindings which are only useful for Objective-C | |
19805
e804ac04eec1
(c-mode-base-map): Don't define C-c C-e here.
Richard M. Stallman <rms@gnu.org>
parents:
19381
diff
changeset
|
641 (define-key objc-mode-map "\C-c\C-e" 'c-macro-expand)) |
18720 | 642 |
19300
b07fa43938cc
(c-mode-base-map, c++-mode-map):
Richard M. Stallman <rms@gnu.org>
parents:
19250
diff
changeset
|
643 ;;;###autoload |
18720 | 644 (defvar objc-mode-syntax-table nil |
645 "Syntax table used in objc-mode buffers.") | |
646 (if objc-mode-syntax-table | |
647 () | |
648 (setq objc-mode-syntax-table (make-syntax-table)) | |
649 (c-populate-syntax-table objc-mode-syntax-table) | |
19300
b07fa43938cc
(c-mode-base-map, c++-mode-map):
Richard M. Stallman <rms@gnu.org>
parents:
19250
diff
changeset
|
650 ;; add extra Objective-C only syntax |
b07fa43938cc
(c-mode-base-map, c++-mode-map):
Richard M. Stallman <rms@gnu.org>
parents:
19250
diff
changeset
|
651 (modify-syntax-entry ?@ "_" objc-mode-syntax-table)) |
18720 | 652 |
653 (easy-menu-define c-objc-menu objc-mode-map "ObjC Mode Commands" | |
654 (c-mode-menu "ObjC")) | |
655 | |
656 | |
657 ;; Support for Java | |
658 | |
659 (defvar java-mode-abbrev-table nil | |
19250 | 660 "Abbreviation table used in java-mode buffers.") |
18720 | 661 (define-abbrev-table 'java-mode-abbrev-table ()) |
662 | |
663 (defvar java-mode-map () | |
664 "Keymap used in java-mode buffers.") | |
665 (if java-mode-map | |
666 nil | |
667 (setq java-mode-map (c-make-inherited-keymap)) | |
668 ;; add bindings which are only useful for Java | |
19805
e804ac04eec1
(c-mode-base-map): Don't define C-c C-e here.
Richard M. Stallman <rms@gnu.org>
parents:
19381
diff
changeset
|
669 ) |
18720 | 670 |
19300
b07fa43938cc
(c-mode-base-map, c++-mode-map):
Richard M. Stallman <rms@gnu.org>
parents:
19250
diff
changeset
|
671 ;;;###autoload |
18720 | 672 (defvar java-mode-syntax-table nil |
673 "Syntax table used in java-mode buffers.") | |
674 (if java-mode-syntax-table | |
675 () | |
676 (setq java-mode-syntax-table (make-syntax-table)) | |
19300
b07fa43938cc
(c-mode-base-map, c++-mode-map):
Richard M. Stallman <rms@gnu.org>
parents:
19250
diff
changeset
|
677 (c-populate-syntax-table java-mode-syntax-table)) |
18720 | 678 |
679 (easy-menu-define c-java-menu java-mode-map "Java Mode Commands" | |
680 (c-mode-menu "Java")) | |
681 | |
682 | |
19250 | 683 ;; Support for CORBA's IDL language |
684 | |
685 (defvar idl-mode-abbrev-table nil | |
686 "Abbreviation table used in idl-mode buffers.") | |
687 (define-abbrev-table 'idl-mode-abbrev-table ()) | |
688 | |
689 (defvar idl-mode-map () | |
690 "Keymap used in idl-mode buffers.") | |
691 (if idl-mode-map | |
692 nil | |
693 (setq idl-mode-map (c-make-inherited-keymap)) | |
19805
e804ac04eec1
(c-mode-base-map): Don't define C-c C-e here.
Richard M. Stallman <rms@gnu.org>
parents:
19381
diff
changeset
|
694 ;; add bindings which are only useful for IDL |
e804ac04eec1
(c-mode-base-map): Don't define C-c C-e here.
Richard M. Stallman <rms@gnu.org>
parents:
19381
diff
changeset
|
695 ) |
19250 | 696 |
19300
b07fa43938cc
(c-mode-base-map, c++-mode-map):
Richard M. Stallman <rms@gnu.org>
parents:
19250
diff
changeset
|
697 ;;;###autoload |
19250 | 698 (defvar idl-mode-syntax-table nil |
699 "Syntax table used in idl-mode buffers.") | |
700 (if idl-mode-syntax-table | |
701 nil | |
702 (setq idl-mode-syntax-table (make-syntax-table)) | |
19300
b07fa43938cc
(c-mode-base-map, c++-mode-map):
Richard M. Stallman <rms@gnu.org>
parents:
19250
diff
changeset
|
703 (c-populate-syntax-table idl-mode-syntax-table)) |
19250 | 704 |
705 (easy-menu-define c-idl-menu idl-mode-map "IDL Mode Commands" | |
706 (c-mode-menu "IDL")) | |
707 | |
24282 | 708 |
709 ;; Support for Pike | |
710 | |
711 (defvar pike-mode-abbrev-table nil | |
712 "Abbreviation table used in pike-mode buffers.") | |
713 (define-abbrev-table 'pike-mode-abbrev-table ()) | |
714 | |
715 (defvar pike-mode-map () | |
716 "Keymap used in pike-mode buffers.") | |
717 (if pike-mode-map | |
718 nil | |
719 (setq pike-mode-map (c-make-inherited-keymap)) | |
720 ;; additional bindings | |
721 (define-key pike-mode-map "\C-c\C-e" 'c-macro-expand)) | |
722 | |
723 ;;;###autoload | |
724 (defvar pike-mode-syntax-table nil | |
725 "Syntax table used in pike-mode buffers.") | |
726 (if pike-mode-syntax-table | |
727 () | |
728 (setq pike-mode-syntax-table (make-syntax-table)) | |
729 (c-populate-syntax-table pike-mode-syntax-table) | |
730 (modify-syntax-entry ?@ "." pike-mode-syntax-table)) | |
731 | |
732 (easy-menu-define c-pike-menu pike-mode-map "Pike Mode Commands" | |
733 (c-mode-menu "Pike")) | |
734 | |
19250 | 735 |
736 | |
18720 | 737 (provide 'cc-langs) |
738 ;;; cc-langs.el ends here |