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