Mercurial > emacs
annotate lisp/progmodes/cc-mode.el @ 26659:98c01a50be97
(speedbar-xemacs20p): Remove compatibility code for
Emacs versions without custom.el.
author | Gerd Moellmann <gerd@gnu.org> |
---|---|
date | Tue, 30 Nov 1999 14:09:13 +0000 |
parents | 5b0864259a4b |
children | 03befb219d03 |
rev | line source |
---|---|
18720 | 1 ;;; cc-mode.el --- major mode for editing C, C++, Objective-C, and Java code |
2 | |
20917
c6e2c4d9a305
(c-mode, c++-mode, objc-mode, java-mode): Set
Richard M. Stallman <rms@gnu.org>
parents:
20459
diff
changeset
|
3 ;; Copyright (C) 1985,87,92,93,94,95,96,97,98 Free Software Foundation, Inc. |
18720 | 4 |
24282 | 5 ;; Authors: 1998 Barry A. Warsaw and Martin Stjernholm |
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: a long, long, time ago. adapted from the original c-mode.el |
11 ;; Keywords: c languages oop | |
12 | |
24282 | 13 (defconst c-version "5.25" |
20146 | 14 "CC Mode version number.") |
15 | |
18720 | 16 ;; NOTE: Read the commentary below for the right way to submit bug reports! |
17 ;; NOTE: See the accompanying texinfo manual for details on using this mode! | |
18 | |
19 ;; This file is part of GNU Emacs. | |
20 | |
21 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
22 ;; it under the terms of the GNU General Public License as published by | |
23 ;; the Free Software Foundation; either version 2, or (at your option) | |
24 ;; any later version. | |
25 | |
26 ;; GNU Emacs is distributed in the hope that it will be useful, | |
27 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
28 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
29 ;; GNU General Public License for more details. | |
30 | |
31 ;; You should have received a copy of the GNU General Public License | |
32 ;; along with GNU Emacs; see the file COPYING. If not, write to the | |
33 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
34 ;; Boston, MA 02111-1307, USA. | |
35 | |
36 ;;; Commentary: | |
37 | |
38 ;; This package provides GNU Emacs major modes for editing C, C++, | |
24282 | 39 ;; Objective-C, Java, IDL and Pike code. As of the latest Emacs and |
40 ;; XEmacs releases, it is the default package for editing these | |
41 ;; languages. This package is called "CC Mode", and should be spelled | |
42 ;; exactly this way. | |
43 | |
44 ;; CC Mode supports K&R and ANSI C, ANSI C++, Objective-C, Java, | |
45 ;; CORBA's IDL, and Pike with a consistent indentation model across | |
46 ;; all modes. This indentation model is intuitive and very flexible, | |
47 ;; so that almost any desired style of indentation can be supported. | |
19253
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
48 ;; Installation, usage, and programming details are contained in an |
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
49 ;; accompanying texinfo manual. |
18720 | 50 |
51 ;; CC Mode's immediate ancestors were, c++-mode.el, cplus-md.el, and | |
52 ;; cplus-md1.el.. | |
53 | |
54 ;; NOTE: This mode does not perform font-locking (a.k.a syntactic | |
55 ;; coloring, keyword highlighting, etc.) for any of the supported | |
56 ;; modes. Typically this is done by a package called font-lock.el | |
24282 | 57 ;; which we do *not* maintain. You should contact the Emacs or XEmacs |
18720 | 58 ;; maintainers for questions about coloring or highlighting in any |
59 ;; language mode. | |
60 | |
61 ;; To submit bug reports, type "C-c C-b". These will be sent to | |
24282 | 62 ;; bug-gnu-emacs@gnu.org (mirrored as the Usenet newsgroup |
63 ;; gnu.emacs.bug) as well as bug-cc-mode@gnu.org, which directly | |
64 ;; contacts the CC Mode maintainers. Questions can sent to | |
65 ;; help-gnu-emacs@gnu.org (mirrored as gnu.emacs.help) and/or | |
66 ;; bug-cc-mode@gnu.org. The old CC Mode contact address, | |
67 ;; cc-mode-help@python.org is currently still active, but its use is | |
68 ;; discouraged. Please use bug-cc-mode@gnu.org instead. Please do | |
69 ;; not send bugs or questions to our personal accounts; we reserve the | |
70 ;; right to ignore such email! | |
18720 | 71 |
72 ;; Many, many thanks go out to all the folks on the beta test list. | |
73 ;; Without their patience, testing, insight, code contributions, and | |
74 ;; encouragement CC Mode would be a far inferior package. | |
75 | |
76 ;; You can get the latest version of CC Mode, including PostScript | |
77 ;; documentation and separate individual files from: | |
78 ;; | |
24282 | 79 ;; http://www.python.org/emacs/cc-mode/ |
18720 | 80 ;; |
24282 | 81 ;; You can join a moderated CC Mode announcement-only mailing list by |
82 ;; visiting | |
83 ;; | |
84 ;; http://www.python.org/mailman/listinfo/cc-mode-announce | |
18720 | 85 |
86 ;;; Code: | |
87 | |
21109
a0eda86dd0be
(c-initialize-cc-mode): Moved require's to top level.
Richard M. Stallman <rms@gnu.org>
parents:
20917
diff
changeset
|
88 |
24282 | 89 (defvar c-buffer-is-cc-mode nil |
90 "Non-nil for all buffers with a `major-mode' derived from CC Mode. | |
91 Otherwise, this variable is nil. I.e. this variable is non-nil for | |
92 `c-mode', `c++-mode', `objc-mode', `java-mode', `idl-mode', | |
93 `pike-mode', and any other non-CC Mode mode that calls | |
94 `c-initialize-cc-mode' (e.g. `awk-mode').") | |
95 (make-variable-buffer-local 'c-buffer-is-cc-mode) | |
96 (put 'c-buffer-is-cc-mode 'permanent-local t) | |
21109
a0eda86dd0be
(c-initialize-cc-mode): Moved require's to top level.
Richard M. Stallman <rms@gnu.org>
parents:
20917
diff
changeset
|
97 |
24282 | 98 (eval-and-compile |
99 (require 'cc-defs)) | |
21109
a0eda86dd0be
(c-initialize-cc-mode): Moved require's to top level.
Richard M. Stallman <rms@gnu.org>
parents:
20917
diff
changeset
|
100 (require 'cc-menus) |
a0eda86dd0be
(c-initialize-cc-mode): Moved require's to top level.
Richard M. Stallman <rms@gnu.org>
parents:
20917
diff
changeset
|
101 (require 'cc-vars) |
a0eda86dd0be
(c-initialize-cc-mode): Moved require's to top level.
Richard M. Stallman <rms@gnu.org>
parents:
20917
diff
changeset
|
102 (require 'cc-engine) |
a0eda86dd0be
(c-initialize-cc-mode): Moved require's to top level.
Richard M. Stallman <rms@gnu.org>
parents:
20917
diff
changeset
|
103 (require 'cc-langs) |
a0eda86dd0be
(c-initialize-cc-mode): Moved require's to top level.
Richard M. Stallman <rms@gnu.org>
parents:
20917
diff
changeset
|
104 (require 'cc-align) |
a0eda86dd0be
(c-initialize-cc-mode): Moved require's to top level.
Richard M. Stallman <rms@gnu.org>
parents:
20917
diff
changeset
|
105 (require 'cc-styles) |
a0eda86dd0be
(c-initialize-cc-mode): Moved require's to top level.
Richard M. Stallman <rms@gnu.org>
parents:
20917
diff
changeset
|
106 (require 'cc-cmds) |
18720 | 107 |
20917
c6e2c4d9a305
(c-mode, c++-mode, objc-mode, java-mode): Set
Richard M. Stallman <rms@gnu.org>
parents:
20459
diff
changeset
|
108 |
18720 | 109 |
18847
dd7615d21a97
(c-initialize-cc-mode): New function.
Richard M. Stallman <rms@gnu.org>
parents:
18720
diff
changeset
|
110 ;; Other modes and packages which depend on CC Mode should do the |
dd7615d21a97
(c-initialize-cc-mode): New function.
Richard M. Stallman <rms@gnu.org>
parents:
18720
diff
changeset
|
111 ;; following to make sure everything is loaded and available for their |
dd7615d21a97
(c-initialize-cc-mode): New function.
Richard M. Stallman <rms@gnu.org>
parents:
18720
diff
changeset
|
112 ;; use: |
dd7615d21a97
(c-initialize-cc-mode): New function.
Richard M. Stallman <rms@gnu.org>
parents:
18720
diff
changeset
|
113 ;; |
dd7615d21a97
(c-initialize-cc-mode): New function.
Richard M. Stallman <rms@gnu.org>
parents:
18720
diff
changeset
|
114 ;; (require 'cc-mode) |
dd7615d21a97
(c-initialize-cc-mode): New function.
Richard M. Stallman <rms@gnu.org>
parents:
18720
diff
changeset
|
115 ;; (c-initialize-cc-mode) |
dd7615d21a97
(c-initialize-cc-mode): New function.
Richard M. Stallman <rms@gnu.org>
parents:
18720
diff
changeset
|
116 |
19253
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
117 ;;;###autoload |
24282 | 118 (defun c-initialize-cc-mode () |
19299
7cd7373cc021
(c-initialize-cc-mode): Set c-buffer-is-cc-mode to t.
Richard M. Stallman <rms@gnu.org>
parents:
19253
diff
changeset
|
119 (setq c-buffer-is-cc-mode t) |
24282 | 120 (let ((initprop 'cc-mode-is-initialized) |
121 c-initialization-ok) | |
122 (unless (get 'c-initialize-cc-mode initprop) | |
123 (put 'c-initialize-cc-mode initprop t) | |
124 (c-initialize-builtin-style) | |
125 (unwind-protect | |
126 (progn | |
127 (run-hooks 'c-initialization-hook) | |
128 (setq c-initialization-ok t)) | |
129 ;; Will try initialization hooks again if they failed. | |
130 (unless c-initialization-ok | |
131 (put 'c-initialize-cc-mode initprop nil)))) | |
19253
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
132 )) |
18847
dd7615d21a97
(c-initialize-cc-mode): New function.
Richard M. Stallman <rms@gnu.org>
parents:
18720
diff
changeset
|
133 |
dd7615d21a97
(c-initialize-cc-mode): New function.
Richard M. Stallman <rms@gnu.org>
parents:
18720
diff
changeset
|
134 |
18720 | 135 ;;;###autoload |
136 (defun c-mode () | |
137 "Major mode for editing K&R and ANSI C code. | |
138 To submit a problem report, enter `\\[c-submit-bug-report]' from a | |
139 c-mode buffer. This automatically sets up a mail buffer with version | |
140 information already added. You just need to add a description of the | |
141 problem, including a reproducible test case and send the message. | |
142 | |
143 To see what version of CC Mode you are running, enter `\\[c-version]'. | |
144 | |
145 The hook variable `c-mode-hook' is run with no args, if that value is | |
146 bound and has a non-nil value. Also the hook `c-mode-common-hook' is | |
147 run first. | |
148 | |
149 Key bindings: | |
150 \\{c-mode-map}" | |
151 (interactive) | |
18847
dd7615d21a97
(c-initialize-cc-mode): New function.
Richard M. Stallman <rms@gnu.org>
parents:
18720
diff
changeset
|
152 (c-initialize-cc-mode) |
18720 | 153 (kill-all-local-variables) |
154 (set-syntax-table c-mode-syntax-table) | |
155 (setq major-mode 'c-mode | |
156 mode-name "C" | |
157 local-abbrev-table c-mode-abbrev-table) | |
158 (use-local-map c-mode-map) | |
159 (c-common-init) | |
160 (setq comment-start "/* " | |
161 comment-end " */" | |
162 c-conditional-key c-C-conditional-key | |
163 c-class-key c-C-class-key | |
164 c-baseclass-key nil | |
19299
7cd7373cc021
(c-initialize-cc-mode): Set c-buffer-is-cc-mode to t.
Richard M. Stallman <rms@gnu.org>
parents:
19253
diff
changeset
|
165 c-comment-start-regexp c-C++-comment-start-regexp |
20459 | 166 imenu-generic-expression cc-imenu-c-generic-expression |
24282 | 167 imenu-case-fold-search nil |
168 ) | |
18720 | 169 (run-hooks 'c-mode-common-hook) |
170 (run-hooks 'c-mode-hook) | |
171 (c-update-modeline)) | |
172 | |
173 | |
174 ;;;###autoload | |
175 (defun c++-mode () | |
176 "Major mode for editing C++ code. | |
177 To submit a problem report, enter `\\[c-submit-bug-report]' from a | |
178 c++-mode buffer. This automatically sets up a mail buffer with | |
179 version information already added. You just need to add a description | |
180 of the problem, including a reproducible test case, and send the | |
181 message. | |
182 | |
183 To see what version of CC Mode you are running, enter `\\[c-version]'. | |
184 | |
185 The hook variable `c++-mode-hook' is run with no args, if that | |
186 variable is bound and has a non-nil value. Also the hook | |
187 `c-mode-common-hook' is run first. | |
188 | |
189 Key bindings: | |
190 \\{c++-mode-map}" | |
191 (interactive) | |
18847
dd7615d21a97
(c-initialize-cc-mode): New function.
Richard M. Stallman <rms@gnu.org>
parents:
18720
diff
changeset
|
192 (c-initialize-cc-mode) |
18720 | 193 (kill-all-local-variables) |
194 (set-syntax-table c++-mode-syntax-table) | |
195 (setq major-mode 'c++-mode | |
196 mode-name "C++" | |
197 local-abbrev-table c++-mode-abbrev-table) | |
198 (use-local-map c++-mode-map) | |
199 (c-common-init) | |
200 (setq comment-start "// " | |
201 comment-end "" | |
202 c-conditional-key c-C++-conditional-key | |
203 c-comment-start-regexp c-C++-comment-start-regexp | |
204 c-class-key c-C++-class-key | |
24282 | 205 c-extra-toplevel-key c-C++-extra-toplevel-key |
18720 | 206 c-access-key c-C++-access-key |
207 c-recognize-knr-p nil | |
20459 | 208 imenu-generic-expression cc-imenu-c++-generic-expression |
24282 | 209 imenu-case-fold-search nil |
210 ) | |
18720 | 211 (run-hooks 'c-mode-common-hook) |
212 (run-hooks 'c++-mode-hook) | |
213 (c-update-modeline)) | |
214 | |
215 | |
216 ;;;###autoload | |
217 (defun objc-mode () | |
218 "Major mode for editing Objective C code. | |
219 To submit a problem report, enter `\\[c-submit-bug-report]' from an | |
220 objc-mode buffer. This automatically sets up a mail buffer with | |
221 version information already added. You just need to add a description | |
222 of the problem, including a reproducible test case, and send the | |
223 message. | |
224 | |
225 To see what version of CC Mode you are running, enter `\\[c-version]'. | |
226 | |
227 The hook variable `objc-mode-hook' is run with no args, if that value | |
228 is bound and has a non-nil value. Also the hook `c-mode-common-hook' | |
229 is run first. | |
230 | |
231 Key bindings: | |
232 \\{objc-mode-map}" | |
233 (interactive) | |
18847
dd7615d21a97
(c-initialize-cc-mode): New function.
Richard M. Stallman <rms@gnu.org>
parents:
18720
diff
changeset
|
234 (c-initialize-cc-mode) |
18720 | 235 (kill-all-local-variables) |
236 (set-syntax-table objc-mode-syntax-table) | |
237 (setq major-mode 'objc-mode | |
238 mode-name "ObjC" | |
239 local-abbrev-table objc-mode-abbrev-table) | |
240 (use-local-map objc-mode-map) | |
241 (c-common-init) | |
242 (setq comment-start "// " | |
243 comment-end "" | |
244 c-conditional-key c-C-conditional-key | |
245 c-comment-start-regexp c-C++-comment-start-regexp | |
246 c-class-key c-ObjC-class-key | |
247 c-baseclass-key nil | |
248 c-access-key c-ObjC-access-key | |
20135
ecb78a6ccd8d
(objc-mode): Bind imenu-create-index-function
Karl Heuer <kwzh@gnu.org>
parents:
19808
diff
changeset
|
249 c-method-key c-ObjC-method-key |
20917
c6e2c4d9a305
(c-mode, c++-mode, objc-mode, java-mode): Set
Richard M. Stallman <rms@gnu.org>
parents:
20459
diff
changeset
|
250 imenu-create-index-function 'cc-imenu-objc-function |
c6e2c4d9a305
(c-mode, c++-mode, objc-mode, java-mode): Set
Richard M. Stallman <rms@gnu.org>
parents:
20459
diff
changeset
|
251 imenu-case-fold-search nil |
c6e2c4d9a305
(c-mode, c++-mode, objc-mode, java-mode): Set
Richard M. Stallman <rms@gnu.org>
parents:
20459
diff
changeset
|
252 ) |
18720 | 253 (run-hooks 'c-mode-common-hook) |
254 (run-hooks 'objc-mode-hook) | |
255 (c-update-modeline)) | |
256 | |
257 | |
258 ;;;###autoload | |
259 (defun java-mode () | |
260 "Major mode for editing Java code. | |
20135
ecb78a6ccd8d
(objc-mode): Bind imenu-create-index-function
Karl Heuer <kwzh@gnu.org>
parents:
19808
diff
changeset
|
261 To submit a problem report, enter `\\[c-submit-bug-report]' from a |
18720 | 262 java-mode buffer. This automatically sets up a mail buffer with |
263 version information already added. You just need to add a description | |
264 of the problem, including a reproducible test case and send the | |
265 message. | |
266 | |
267 To see what version of CC Mode you are running, enter `\\[c-version]'. | |
268 | |
269 The hook variable `java-mode-hook' is run with no args, if that value | |
270 is bound and has a non-nil value. Also the common hook | |
271 `c-mode-common-hook' is run first. Note that this mode automatically | |
272 sets the \"java\" style before calling any hooks so be careful if you | |
273 set styles in `c-mode-common-hook'. | |
274 | |
275 Key bindings: | |
276 \\{java-mode-map}" | |
277 (interactive) | |
18847
dd7615d21a97
(c-initialize-cc-mode): New function.
Richard M. Stallman <rms@gnu.org>
parents:
18720
diff
changeset
|
278 (c-initialize-cc-mode) |
18720 | 279 (kill-all-local-variables) |
280 (set-syntax-table java-mode-syntax-table) | |
281 (setq major-mode 'java-mode | |
282 mode-name "Java" | |
283 local-abbrev-table java-mode-abbrev-table) | |
284 (use-local-map java-mode-map) | |
285 (c-common-init) | |
286 (setq comment-start "// " | |
287 comment-end "" | |
288 c-conditional-key c-Java-conditional-key | |
289 c-comment-start-regexp c-Java-comment-start-regexp | |
290 c-class-key c-Java-class-key | |
20917
c6e2c4d9a305
(c-mode, c++-mode, objc-mode, java-mode): Set
Richard M. Stallman <rms@gnu.org>
parents:
20459
diff
changeset
|
291 c-method-key nil |
18720 | 292 c-baseclass-key nil |
293 c-recognize-knr-p nil | |
294 c-access-key c-Java-access-key | |
24282 | 295 c-inexpr-class-key c-Java-inexpr-class-key |
18720 | 296 ;defun-prompt-regexp c-Java-defun-prompt-regexp |
297 imenu-generic-expression cc-imenu-java-generic-expression | |
24282 | 298 imenu-case-fold-search nil |
18720 | 299 ) |
300 (run-hooks 'c-mode-common-hook) | |
301 (run-hooks 'java-mode-hook) | |
302 (c-update-modeline)) | |
303 | |
304 | |
19253
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
305 ;;;###autoload |
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
306 (defun idl-mode () |
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
307 "Major mode for editing CORBA's IDL code. |
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
308 To submit a problem report, enter `\\[c-submit-bug-report]' from an |
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
309 idl-mode buffer. This automatically sets up a mail buffer with |
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
310 version information already added. You just need to add a description |
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
311 of the problem, including a reproducible test case, and send the |
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
312 message. |
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
313 |
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
314 To see what version of CC Mode you are running, enter `\\[c-version]'. |
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
315 |
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
316 The hook variable `idl-mode-hook' is run with no args, if that |
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
317 variable is bound and has a non-nil value. Also the hook |
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
318 `c-mode-common-hook' is run first. |
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
319 |
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
320 Key bindings: |
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
321 \\{idl-mode-map}" |
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
322 (interactive) |
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
323 (c-initialize-cc-mode) |
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
324 (kill-all-local-variables) |
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
325 (set-syntax-table idl-mode-syntax-table) |
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
326 (setq major-mode 'idl-mode |
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
327 mode-name "IDL" |
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
328 local-abbrev-table idl-mode-abbrev-table) |
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
329 (use-local-map idl-mode-map) |
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
330 (c-common-init) |
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
331 (setq comment-start "// " |
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
332 comment-end "" |
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
333 c-conditional-key c-C++-conditional-key |
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
334 c-comment-start-regexp c-C++-comment-start-regexp |
24282 | 335 c-class-key c-IDL-class-key |
336 c-extra-toplevel-key c-IDL-extra-toplevel-key | |
19253
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
337 c-access-key c-C++-access-key |
20917
c6e2c4d9a305
(c-mode, c++-mode, objc-mode, java-mode): Set
Richard M. Stallman <rms@gnu.org>
parents:
20459
diff
changeset
|
338 c-recognize-knr-p nil |
c6e2c4d9a305
(c-mode, c++-mode, objc-mode, java-mode): Set
Richard M. Stallman <rms@gnu.org>
parents:
20459
diff
changeset
|
339 ;; imenu-generic-expression cc-imenu-c++-generic-expression |
c6e2c4d9a305
(c-mode, c++-mode, objc-mode, java-mode): Set
Richard M. Stallman <rms@gnu.org>
parents:
20459
diff
changeset
|
340 ;; imenu-case-fold-search nil |
c6e2c4d9a305
(c-mode, c++-mode, objc-mode, java-mode): Set
Richard M. Stallman <rms@gnu.org>
parents:
20459
diff
changeset
|
341 ) |
19253
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
342 (run-hooks 'c-mode-common-hook) |
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
343 (run-hooks 'idl-mode-hook) |
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
344 (c-update-modeline)) |
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
345 |
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
346 |
24282 | 347 ;;;###autoload |
348 (defun pike-mode () | |
349 "Major mode for editing Pike code. | |
350 To submit a problem report, enter `\\[c-submit-bug-report]' from an | |
351 idl-mode buffer. This automatically sets up a mail buffer with | |
352 version information already added. You just need to add a description | |
353 of the problem, including a reproducible test case, and send the | |
354 message. | |
355 | |
356 To see what version of CC Mode you are running, enter `\\[c-version]'. | |
357 | |
358 The hook variable `pike-mode-hook' is run with no args, if that value | |
359 is bound and has a non-nil value. Also the common hook | |
360 `c-mode-common-hook' is run first. | |
361 | |
362 Key bindings: | |
363 \\{pike-mode-map}" | |
364 (interactive) | |
365 (c-initialize-cc-mode) | |
366 (kill-all-local-variables) | |
367 (set-syntax-table pike-mode-syntax-table) | |
368 (setq major-mode 'pike-mode | |
369 mode-name "Pike" | |
370 local-abbrev-table pike-mode-abbrev-table) | |
371 (use-local-map pike-mode-map) | |
372 (c-common-init) | |
373 (setq comment-start "// " | |
374 comment-end "" | |
375 c-conditional-key c-Pike-conditional-key | |
376 c-class-key c-Pike-class-key | |
377 c-method-key nil | |
378 c-baseclass-key nil | |
379 c-recognize-knr-p nil | |
380 c-access-key c-Pike-access-key | |
381 c-lambda-key c-Pike-lambda-key | |
382 c-inexpr-block-key c-Pike-inexpr-block-key | |
383 c-special-brace-lists c-Pike-special-brace-lists | |
384 ;imenu-generic-expression cc-imenu-java-generic-expression ;FIXME | |
385 ;imenu-case-fold-search nil ;FIXME | |
386 ) | |
387 (run-hooks 'c-mode-common-hook) | |
388 (run-hooks 'pike-mode-hook) | |
389 (c-update-modeline)) | |
390 | |
391 | |
20146 | 392 ;; bug reporting |
18720 | 393 |
394 (defconst c-mode-help-address | |
24282 | 395 "bug-gnu-emacs@gnu.org, bug-cc-mode@gnu.org" |
396 "Addresses for CC Mode bug reports.") | |
18720 | 397 |
398 (defun c-version () | |
399 "Echo the current version of CC Mode in the minibuffer." | |
400 (interactive) | |
401 (message "Using CC Mode version %s" c-version) | |
402 (c-keep-region-active)) | |
403 | |
404 (defun c-submit-bug-report () | |
405 "Submit via mail a bug report on CC Mode." | |
406 (interactive) | |
20917
c6e2c4d9a305
(c-mode, c++-mode, objc-mode, java-mode): Set
Richard M. Stallman <rms@gnu.org>
parents:
20459
diff
changeset
|
407 (require 'reporter) |
18720 | 408 (require 'cc-vars) |
409 ;; load in reporter | |
410 (let ((reporter-prompt-for-summary-p t) | |
411 (reporter-dont-compact-list '(c-offsets-alist)) | |
412 (style c-indentation-style) | |
413 (hook c-special-indent-hook) | |
414 (c-features c-emacs-features)) | |
415 (and | |
416 (if (y-or-n-p "Do you want to submit a report on CC Mode? ") | |
417 t (message "") nil) | |
418 (require 'reporter) | |
419 (reporter-submit-bug-report | |
420 c-mode-help-address | |
421 (concat "CC Mode " c-version " (" | |
422 (cond ((eq major-mode 'c++-mode) "C++") | |
423 ((eq major-mode 'c-mode) "C") | |
424 ((eq major-mode 'objc-mode) "ObjC") | |
425 ((eq major-mode 'java-mode) "Java") | |
24282 | 426 ((eq major-mode 'pike-mode) "Pike") |
18720 | 427 ) |
428 ")") | |
429 (let ((vars (list | |
430 ;; report only the vars that affect indentation | |
431 'c-basic-offset | |
432 'c-offsets-alist | |
433 'c-cleanup-list | |
434 'c-comment-only-line-offset | |
435 'c-backslash-column | |
436 'c-delete-function | |
437 'c-electric-pound-behavior | |
438 'c-hanging-braces-alist | |
439 'c-hanging-colons-alist | |
440 'c-hanging-comment-starter-p | |
441 'c-hanging-comment-ender-p | |
442 'c-indent-comments-syntactically-p | |
443 'c-tab-always-indent | |
20146 | 444 'c-comment-continuation-stars |
18720 | 445 'c-label-minimum-indentation |
446 'defun-prompt-regexp | |
447 'tab-width | |
24282 | 448 'comment-column |
449 ;; A brain-damaged XEmacs only variable that, if | |
450 ;; set to nil can cause all kinds of chaos. | |
451 'signal-error-on-buffer-boundary | |
18720 | 452 ))) |
453 (if (not (boundp 'defun-prompt-regexp)) | |
454 (delq 'defun-prompt-regexp vars) | |
455 vars)) | |
456 (function | |
457 (lambda () | |
458 (insert | |
459 "Buffer Style: " style "\n\n" | |
24282 | 460 (if (and hook |
461 (or (/= (length hook) 1) | |
462 (not (eq (car hook) 'c-gnu-impose-minimum)) | |
463 )) | |
18720 | 464 (concat "\n@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n" |
465 "c-special-indent-hook is set to '" | |
466 (format "%s" hook) | |
467 ".\nPerhaps this is your problem?\n" | |
468 "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n\n") | |
469 "\n") | |
470 (format "c-emacs-features: %s\n" c-features) | |
471 ))) | |
472 nil | |
21109
a0eda86dd0be
(c-initialize-cc-mode): Moved require's to top level.
Richard M. Stallman <rms@gnu.org>
parents:
20917
diff
changeset
|
473 "Dear Barry and Martin," |
18720 | 474 )))) |
475 | |
476 | |
477 (provide 'cc-mode) | |
478 ;;; cc-mode.el ends here |