Mercurial > emacs
annotate lisp/progmodes/cc-mode.el @ 20383:3a76b48c399d
1997-11-27 Richard Stallman <rms@sucrose.ai.mit.edu>
* dired.el (dired-move-to-filename-regexp): Make regexp fussier
about amount of whitespace after month name.
author | Joel N. Weber II <devnull@gnu.org> |
---|---|
date | Sat, 29 Nov 1997 05:21:18 +0000 |
parents | d7ea5d1fa91b |
children | 90f306f86f5d |
rev | line source |
---|---|
18720 | 1 ;;; cc-mode.el --- major mode for editing C, C++, Objective-C, and Java code |
2 | |
3 ;; Copyright (C) 1985,87,92,93,94,95,96,97 Free Software Foundation, Inc. | |
4 | |
5 ;; Authors: 1992-1997 Barry A. Warsaw | |
6 ;; 1987 Dave Detlefs and Stewart Clamen | |
7 ;; 1985 Richard M. Stallman | |
8 ;; Maintainer: cc-mode-help@python.org | |
9 ;; Created: a long, long, time ago. adapted from the original c-mode.el | |
10 ;; Keywords: c languages oop | |
11 | |
20146 | 12 (defconst c-version "5.19" |
13 "CC Mode version number.") | |
14 | |
18720 | 15 ;; NOTE: Read the commentary below for the right way to submit bug reports! |
16 ;; NOTE: See the accompanying texinfo manual for details on using this mode! | |
17 | |
18 ;; This file is part of GNU Emacs. | |
19 | |
20 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
21 ;; it under the terms of the GNU General Public License as published by | |
22 ;; the Free Software Foundation; either version 2, or (at your option) | |
23 ;; any later version. | |
24 | |
25 ;; GNU Emacs is distributed in the hope that it will be useful, | |
26 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
27 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
28 ;; GNU General Public License for more details. | |
29 | |
30 ;; You should have received a copy of the GNU General Public License | |
31 ;; along with GNU Emacs; see the file COPYING. If not, write to the | |
32 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
33 ;; Boston, MA 02111-1307, USA. | |
34 | |
35 ;;; Commentary: | |
36 | |
37 ;; This package provides GNU Emacs major modes for editing C, C++, | |
19253
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
38 ;; Objective-C, Java and IDL code. As of the latest Emacs and XEmacs |
18720 | 39 ;; releases, it is the default package for editing these languages. |
40 ;; This package is called "CC Mode", and should be spelled exactly | |
19253
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
41 ;; this way. It supports K&R and ANSI C, ANSI C++, Objective-C, Java, |
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
42 ;; and CORBA's IDL with a consistent indentation model across all |
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
43 ;; modes. This indentation model is intuitive and very flexible, so |
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
44 ;; that almost any desired style of indentation can be supported. |
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
45 ;; 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
|
46 ;; accompanying texinfo manual. |
18720 | 47 |
48 ;; CC Mode's immediate ancestors were, c++-mode.el, cplus-md.el, and | |
49 ;; cplus-md1.el.. | |
50 | |
51 ;; NOTE: This mode does not perform font-locking (a.k.a syntactic | |
52 ;; coloring, keyword highlighting, etc.) for any of the supported | |
53 ;; modes. Typically this is done by a package called font-lock.el | |
54 ;; which I do *not* maintain. You should contact the Emacs | |
55 ;; maintainers for questions about coloring or highlighting in any | |
56 ;; language mode. | |
57 | |
58 ;; To submit bug reports, type "C-c C-b". These will be sent to | |
59 ;; bug-gnu-emacs@prep.ai.mit.edu as well as cc-mode-help@python.org, | |
60 ;; and I'll read about them there (the former is mirrored as the | |
61 ;; Usenet newsgroup gnu.emacs.bug). Questions can sent to | |
62 ;; help-gnu-emacs@prep.ai.mit.edu (mirrored as gnu.emacs.help) and/or | |
63 ;; cc-mode-help@python.org. Please do not send bugs or questions to | |
64 ;; my personal account. | |
65 | |
66 ;; Many, many thanks go out to all the folks on the beta test list. | |
67 ;; Without their patience, testing, insight, code contributions, and | |
68 ;; encouragement CC Mode would be a far inferior package. | |
69 | |
70 ;; You can get the latest version of CC Mode, including PostScript | |
71 ;; documentation and separate individual files from: | |
72 ;; | |
73 ;; http://www.python.org/ftp/emacs/ | |
74 | |
75 ;; Or if you don't have access to the World Wide Web, through | |
76 ;; anonymous ftp from: | |
77 ;; | |
78 ;; ftp://ftp.python.org/pub/emacs | |
79 | |
80 ;;; Code: | |
81 | |
82 (eval-when-compile | |
83 (require 'cc-menus)) | |
84 (require 'cc-defs) | |
85 | |
19380
87b40a65d4cd
(c-buffer-is-cc-mode): Definition moved here from cc-vars.el.
Richard M. Stallman <rms@gnu.org>
parents:
19299
diff
changeset
|
86 (defvar c-buffer-is-cc-mode nil |
87b40a65d4cd
(c-buffer-is-cc-mode): Definition moved here from cc-vars.el.
Richard M. Stallman <rms@gnu.org>
parents:
19299
diff
changeset
|
87 "Non-nil for all buffers with a `major-mode' derived from CC Mode. |
87b40a65d4cd
(c-buffer-is-cc-mode): Definition moved here from cc-vars.el.
Richard M. Stallman <rms@gnu.org>
parents:
19299
diff
changeset
|
88 Otherwise, this variable is nil. I.e. this variable is non-nil for |
87b40a65d4cd
(c-buffer-is-cc-mode): Definition moved here from cc-vars.el.
Richard M. Stallman <rms@gnu.org>
parents:
19299
diff
changeset
|
89 `c-mode', `c++-mode', `objc-mode', `java-mode', `idl-mode', and any |
87b40a65d4cd
(c-buffer-is-cc-mode): Definition moved here from cc-vars.el.
Richard M. Stallman <rms@gnu.org>
parents:
19299
diff
changeset
|
90 other non-CC Mode mode that calls `c-initialize-cc-mode' |
87b40a65d4cd
(c-buffer-is-cc-mode): Definition moved here from cc-vars.el.
Richard M. Stallman <rms@gnu.org>
parents:
19299
diff
changeset
|
91 \(e.g. `awk-mode').") |
87b40a65d4cd
(c-buffer-is-cc-mode): Definition moved here from cc-vars.el.
Richard M. Stallman <rms@gnu.org>
parents:
19299
diff
changeset
|
92 (make-variable-buffer-local 'c-buffer-is-cc-mode) |
87b40a65d4cd
(c-buffer-is-cc-mode): Definition moved here from cc-vars.el.
Richard M. Stallman <rms@gnu.org>
parents:
19299
diff
changeset
|
93 (put 'c-buffer-is-cc-mode 'permanent-local t) |
87b40a65d4cd
(c-buffer-is-cc-mode): Definition moved here from cc-vars.el.
Richard M. Stallman <rms@gnu.org>
parents:
19299
diff
changeset
|
94 |
18720 | 95 |
18847
dd7615d21a97
(c-initialize-cc-mode): New function.
Richard M. Stallman <rms@gnu.org>
parents:
18720
diff
changeset
|
96 ;; 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
|
97 ;; 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
|
98 ;; use: |
dd7615d21a97
(c-initialize-cc-mode): New function.
Richard M. Stallman <rms@gnu.org>
parents:
18720
diff
changeset
|
99 ;; |
dd7615d21a97
(c-initialize-cc-mode): New function.
Richard M. Stallman <rms@gnu.org>
parents:
18720
diff
changeset
|
100 ;; (require 'cc-mode) |
dd7615d21a97
(c-initialize-cc-mode): New function.
Richard M. Stallman <rms@gnu.org>
parents:
18720
diff
changeset
|
101 ;; (c-initialize-cc-mode) |
dd7615d21a97
(c-initialize-cc-mode): New function.
Richard M. Stallman <rms@gnu.org>
parents:
18720
diff
changeset
|
102 |
19253
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
103 ;;;###autoload |
18847
dd7615d21a97
(c-initialize-cc-mode): New function.
Richard M. Stallman <rms@gnu.org>
parents:
18720
diff
changeset
|
104 (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
|
105 (setq c-buffer-is-cc-mode t) |
7cd7373cc021
(c-initialize-cc-mode): Set c-buffer-is-cc-mode to t.
Richard M. Stallman <rms@gnu.org>
parents:
19253
diff
changeset
|
106 ;; sigh. give in to the pressure, but make really sure all the |
7cd7373cc021
(c-initialize-cc-mode): Set c-buffer-is-cc-mode to t.
Richard M. Stallman <rms@gnu.org>
parents:
19253
diff
changeset
|
107 ;; definitions we need are here |
7cd7373cc021
(c-initialize-cc-mode): Set c-buffer-is-cc-mode to t.
Richard M. Stallman <rms@gnu.org>
parents:
19253
diff
changeset
|
108 (if (or (not (fboundp 'functionp)) |
7cd7373cc021
(c-initialize-cc-mode): Set c-buffer-is-cc-mode to t.
Richard M. Stallman <rms@gnu.org>
parents:
19253
diff
changeset
|
109 (not (fboundp 'char-before)) |
7cd7373cc021
(c-initialize-cc-mode): Set c-buffer-is-cc-mode to t.
Richard M. Stallman <rms@gnu.org>
parents:
19253
diff
changeset
|
110 (not (c-safe (char-after) t))) |
7cd7373cc021
(c-initialize-cc-mode): Set c-buffer-is-cc-mode to t.
Richard M. Stallman <rms@gnu.org>
parents:
19253
diff
changeset
|
111 (require 'cc-mode-19)) |
18847
dd7615d21a97
(c-initialize-cc-mode): New function.
Richard M. Stallman <rms@gnu.org>
parents:
18720
diff
changeset
|
112 ;; make sure all necessary components of CC Mode are loaded in. |
19253
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
113 (let ((initprop 'cc-mode-is-initialized)) |
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
114 (require 'cc-vars) |
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
115 (require 'cc-engine) |
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
116 (require 'cc-langs) |
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
117 (require 'cc-menus) |
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
118 (require 'cc-align) |
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
119 (require 'cc-styles) |
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
120 (require 'cc-cmds) |
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
121 ;; run the initialization hook, but only once |
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
122 (or (get 'c-initialize-cc-mode initprop) |
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
123 (progn |
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
124 (c-initialize-builtin-style) |
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
125 (run-hooks 'c-initialization-hook) |
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
126 (put 'c-initialize-cc-mode initprop t))) |
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
127 )) |
18847
dd7615d21a97
(c-initialize-cc-mode): New function.
Richard M. Stallman <rms@gnu.org>
parents:
18720
diff
changeset
|
128 |
dd7615d21a97
(c-initialize-cc-mode): New function.
Richard M. Stallman <rms@gnu.org>
parents:
18720
diff
changeset
|
129 |
18720 | 130 ;;;###autoload |
131 (defun c-mode () | |
132 "Major mode for editing K&R and ANSI C code. | |
133 To submit a problem report, enter `\\[c-submit-bug-report]' from a | |
134 c-mode buffer. This automatically sets up a mail buffer with version | |
135 information already added. You just need to add a description of the | |
136 problem, including a reproducible test case and send the message. | |
137 | |
138 To see what version of CC Mode you are running, enter `\\[c-version]'. | |
139 | |
140 The hook variable `c-mode-hook' is run with no args, if that value is | |
141 bound and has a non-nil value. Also the hook `c-mode-common-hook' is | |
142 run first. | |
143 | |
144 Key bindings: | |
145 \\{c-mode-map}" | |
146 (interactive) | |
18847
dd7615d21a97
(c-initialize-cc-mode): New function.
Richard M. Stallman <rms@gnu.org>
parents:
18720
diff
changeset
|
147 (c-initialize-cc-mode) |
18720 | 148 (kill-all-local-variables) |
149 (set-syntax-table c-mode-syntax-table) | |
150 (setq major-mode 'c-mode | |
151 mode-name "C" | |
152 local-abbrev-table c-mode-abbrev-table) | |
153 (use-local-map c-mode-map) | |
154 (c-common-init) | |
155 (setq comment-start "/* " | |
156 comment-end " */" | |
157 c-conditional-key c-C-conditional-key | |
158 c-class-key c-C-class-key | |
159 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
|
160 c-comment-start-regexp c-C++-comment-start-regexp |
18720 | 161 imenu-generic-expression cc-imenu-c-generic-expression) |
162 (run-hooks 'c-mode-common-hook) | |
163 (run-hooks 'c-mode-hook) | |
164 (c-update-modeline)) | |
165 | |
166 | |
167 ;;;###autoload | |
168 (defun c++-mode () | |
169 "Major mode for editing C++ code. | |
170 To submit a problem report, enter `\\[c-submit-bug-report]' from a | |
171 c++-mode buffer. This automatically sets up a mail buffer with | |
172 version information already added. You just need to add a description | |
173 of the problem, including a reproducible test case, and send the | |
174 message. | |
175 | |
176 To see what version of CC Mode you are running, enter `\\[c-version]'. | |
177 | |
178 The hook variable `c++-mode-hook' is run with no args, if that | |
179 variable is bound and has a non-nil value. Also the hook | |
180 `c-mode-common-hook' is run first. | |
181 | |
182 Key bindings: | |
183 \\{c++-mode-map}" | |
184 (interactive) | |
18847
dd7615d21a97
(c-initialize-cc-mode): New function.
Richard M. Stallman <rms@gnu.org>
parents:
18720
diff
changeset
|
185 (c-initialize-cc-mode) |
18720 | 186 (kill-all-local-variables) |
187 (set-syntax-table c++-mode-syntax-table) | |
188 (setq major-mode 'c++-mode | |
189 mode-name "C++" | |
190 local-abbrev-table c++-mode-abbrev-table) | |
191 (use-local-map c++-mode-map) | |
192 (c-common-init) | |
193 (setq comment-start "// " | |
194 comment-end "" | |
195 c-conditional-key c-C++-conditional-key | |
196 c-comment-start-regexp c-C++-comment-start-regexp | |
197 c-class-key c-C++-class-key | |
198 c-access-key c-C++-access-key | |
199 c-recognize-knr-p nil | |
200 imenu-generic-expression cc-imenu-c++-generic-expression) | |
201 (run-hooks 'c-mode-common-hook) | |
202 (run-hooks 'c++-mode-hook) | |
203 (c-update-modeline)) | |
204 | |
205 | |
206 ;;;###autoload | |
207 (defun objc-mode () | |
208 "Major mode for editing Objective C code. | |
209 To submit a problem report, enter `\\[c-submit-bug-report]' from an | |
210 objc-mode buffer. This automatically sets up a mail buffer with | |
211 version information already added. You just need to add a description | |
212 of the problem, including a reproducible test case, and send the | |
213 message. | |
214 | |
215 To see what version of CC Mode you are running, enter `\\[c-version]'. | |
216 | |
217 The hook variable `objc-mode-hook' is run with no args, if that value | |
218 is bound and has a non-nil value. Also the hook `c-mode-common-hook' | |
219 is run first. | |
220 | |
221 Key bindings: | |
222 \\{objc-mode-map}" | |
223 (interactive) | |
18847
dd7615d21a97
(c-initialize-cc-mode): New function.
Richard M. Stallman <rms@gnu.org>
parents:
18720
diff
changeset
|
224 (c-initialize-cc-mode) |
18720 | 225 (kill-all-local-variables) |
226 (set-syntax-table objc-mode-syntax-table) | |
227 (setq major-mode 'objc-mode | |
228 mode-name "ObjC" | |
229 local-abbrev-table objc-mode-abbrev-table) | |
230 (use-local-map objc-mode-map) | |
231 (c-common-init) | |
232 (setq comment-start "// " | |
233 comment-end "" | |
234 c-conditional-key c-C-conditional-key | |
235 c-comment-start-regexp c-C++-comment-start-regexp | |
236 c-class-key c-ObjC-class-key | |
237 c-baseclass-key nil | |
238 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
|
239 c-method-key c-ObjC-method-key |
ecb78a6ccd8d
(objc-mode): Bind imenu-create-index-function
Karl Heuer <kwzh@gnu.org>
parents:
19808
diff
changeset
|
240 imenu-create-index-function 'cc-imenu-objc-function) |
18720 | 241 (run-hooks 'c-mode-common-hook) |
242 (run-hooks 'objc-mode-hook) | |
243 (c-update-modeline)) | |
244 | |
245 | |
246 ;;;###autoload | |
247 (defun java-mode () | |
248 "Major mode for editing Java code. | |
20135
ecb78a6ccd8d
(objc-mode): Bind imenu-create-index-function
Karl Heuer <kwzh@gnu.org>
parents:
19808
diff
changeset
|
249 To submit a problem report, enter `\\[c-submit-bug-report]' from a |
18720 | 250 java-mode buffer. This automatically sets up a mail buffer with |
251 version information already added. You just need to add a description | |
252 of the problem, including a reproducible test case and send the | |
253 message. | |
254 | |
255 To see what version of CC Mode you are running, enter `\\[c-version]'. | |
256 | |
257 The hook variable `java-mode-hook' is run with no args, if that value | |
258 is bound and has a non-nil value. Also the common hook | |
259 `c-mode-common-hook' is run first. Note that this mode automatically | |
260 sets the \"java\" style before calling any hooks so be careful if you | |
261 set styles in `c-mode-common-hook'. | |
262 | |
263 Key bindings: | |
264 \\{java-mode-map}" | |
265 (interactive) | |
18847
dd7615d21a97
(c-initialize-cc-mode): New function.
Richard M. Stallman <rms@gnu.org>
parents:
18720
diff
changeset
|
266 (c-initialize-cc-mode) |
18720 | 267 (kill-all-local-variables) |
268 (set-syntax-table java-mode-syntax-table) | |
269 (setq major-mode 'java-mode | |
270 mode-name "Java" | |
271 local-abbrev-table java-mode-abbrev-table) | |
272 (use-local-map java-mode-map) | |
273 (c-common-init) | |
274 (setq comment-start "// " | |
275 comment-end "" | |
276 c-conditional-key c-Java-conditional-key | |
277 c-comment-start-regexp c-Java-comment-start-regexp | |
278 c-class-key c-Java-class-key | |
279 c-method-key c-Java-method-key | |
280 c-baseclass-key nil | |
281 c-recognize-knr-p nil | |
282 c-access-key c-Java-access-key | |
283 ;defun-prompt-regexp c-Java-defun-prompt-regexp | |
284 imenu-generic-expression cc-imenu-java-generic-expression | |
285 ) | |
286 (c-set-style "java") | |
287 (run-hooks 'c-mode-common-hook) | |
288 (run-hooks 'java-mode-hook) | |
289 (c-update-modeline)) | |
290 | |
291 | |
19253
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
292 ;;;###autoload |
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
293 (defun idl-mode () |
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
294 "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
|
295 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
|
296 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
|
297 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
|
298 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
|
299 message. |
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
300 |
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
301 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
|
302 |
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
303 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
|
304 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
|
305 `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
|
306 |
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
307 Key bindings: |
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
308 \\{idl-mode-map}" |
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
309 (interactive) |
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
310 (c-initialize-cc-mode) |
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
311 (kill-all-local-variables) |
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
312 (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
|
313 (setq major-mode 'idl-mode |
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
314 mode-name "IDL" |
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
315 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
|
316 (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
|
317 (c-common-init) |
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
318 (setq comment-start "// " |
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
319 comment-end "" |
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
320 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
|
321 c-comment-start-regexp c-C++-comment-start-regexp |
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
322 c-class-key c-C++-class-key |
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
323 c-access-key c-C++-access-key |
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
324 c-recognize-knr-p nil) |
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
325 ;; imenu-generic-expression cc-imenu-c++-generic-expression) |
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
326 (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
|
327 (run-hooks 'idl-mode-hook) |
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
328 (c-update-modeline)) |
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
329 |
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
330 |
20146 | 331 ;; bug reporting |
18720 | 332 |
333 (defconst c-mode-help-address | |
334 "bug-gnu-emacs@prep.ai.mit.edu, cc-mode-help@python.org" | |
335 "Address for CC Mode bug reports.") | |
336 | |
337 (defun c-version () | |
338 "Echo the current version of CC Mode in the minibuffer." | |
339 (interactive) | |
340 (message "Using CC Mode version %s" c-version) | |
341 (c-keep-region-active)) | |
342 | |
343 ;; Get reporter-submit-bug-report when byte-compiling | |
344 (eval-when-compile | |
345 (require 'reporter)) | |
346 | |
347 (defun c-submit-bug-report () | |
348 "Submit via mail a bug report on CC Mode." | |
349 (interactive) | |
350 (require 'cc-vars) | |
351 ;; load in reporter | |
352 (let ((reporter-prompt-for-summary-p t) | |
353 (reporter-dont-compact-list '(c-offsets-alist)) | |
354 (style c-indentation-style) | |
355 (hook c-special-indent-hook) | |
356 (c-features c-emacs-features)) | |
357 (and | |
358 (if (y-or-n-p "Do you want to submit a report on CC Mode? ") | |
359 t (message "") nil) | |
360 (require 'reporter) | |
361 (reporter-submit-bug-report | |
362 c-mode-help-address | |
363 (concat "CC Mode " c-version " (" | |
364 (cond ((eq major-mode 'c++-mode) "C++") | |
365 ((eq major-mode 'c-mode) "C") | |
366 ((eq major-mode 'objc-mode) "ObjC") | |
367 ((eq major-mode 'java-mode) "Java") | |
368 ) | |
369 ")") | |
370 (let ((vars (list | |
371 ;; report only the vars that affect indentation | |
372 'c-basic-offset | |
373 'c-offsets-alist | |
374 'c-cleanup-list | |
375 'c-comment-only-line-offset | |
376 'c-backslash-column | |
377 'c-delete-function | |
378 'c-electric-pound-behavior | |
379 'c-hanging-braces-alist | |
380 'c-hanging-colons-alist | |
381 'c-hanging-comment-starter-p | |
382 'c-hanging-comment-ender-p | |
383 'c-indent-comments-syntactically-p | |
384 'c-tab-always-indent | |
20146 | 385 'c-comment-continuation-stars |
18720 | 386 'c-label-minimum-indentation |
387 'defun-prompt-regexp | |
388 'tab-width | |
389 ))) | |
390 (if (not (boundp 'defun-prompt-regexp)) | |
391 (delq 'defun-prompt-regexp vars) | |
392 vars)) | |
393 (function | |
394 (lambda () | |
395 (insert | |
396 "Buffer Style: " style "\n\n" | |
397 (if hook | |
398 (concat "\n@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n" | |
399 "c-special-indent-hook is set to '" | |
400 (format "%s" hook) | |
401 ".\nPerhaps this is your problem?\n" | |
402 "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n\n") | |
403 "\n") | |
404 (format "c-emacs-features: %s\n" c-features) | |
405 ))) | |
406 nil | |
407 "Dear Barry," | |
408 )))) | |
409 | |
410 | |
411 (provide 'cc-mode) | |
412 ;;; cc-mode.el ends here |