Mercurial > emacs
annotate lisp/progmodes/cc-mode.el @ 19860:c17fd465ea95 libc-970911 libc-970912 libc-970913 libc-970914 libc-970915 libc-970916 libc-970917 libc-970918 libc-970919 libc-970920 libc-970921 libc-970922 libc-970923 libc-970924 libc-970925 libc-970926 libc-970927 libc-970928 libc-970929 libc-970930 libc-971001 libc-971018 libc-971019 libc-971020 libc-971021 libc-971022 libc-971023 libc-971024 libc-971025 libc-971026 libc-971027 libc-971028 libc-971029 libc-971030 libc-971031 libc-971101 libc-971102 libc-971103 libc-971104 libc-971105 libc-971106 libc-971107 libc-971108 libc-971109 libc-971110 libc-971111 libc-971112 libc-971113 libc-971114 libc-971115 libc-971116 libc-971117 libc-971118 libc-971120 libc-971121 libc-971122 libc-971123 libc-971124 libc-971125 libc-971126 libc-971127 libc-971128 libc-971129 libc-971130 libc-971201 libc-971203 libc-971204 libc-971205 libc-971206 libc-971207 libc-971208 libc-971209 libc-971210 libc-971211 libc-971212 libc-971213 libc-971214 libc-971217 libc-971218 libc-971219 libc-971220 libc-971221 libc-971222 libc-971223 libc-971224 libc-971225 libc-971226 libc-971227 libc-971228 libc-971229 libc-971230 libc-971231 libc-980103 libc-980104 libc-980105 libc-980106 libc-980107 libc-980108 libc-980109 libc-980110 libc-980111 libc-980112 libc-980114 libc-980115 libc-980116 libc-980117 libc-980118 libc-980119 libc-980120 libc-980121 libc-980122 libc-980123 libc-980124 libc-980125 libc-980126 libc-980127 libc-980128
typos.
author | Jeff Law <law@redhat.com> |
---|---|
date | Wed, 10 Sep 1997 21:16:20 +0000 |
parents | 89bb8d12f27b |
children | ecb78a6ccd8d |
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 | |
19808 | 10 ;; Version: 5.17 |
18720 | 11 ;; Keywords: c languages oop |
12 | |
13 ;; NOTE: Read the commentary below for the right way to submit bug reports! | |
14 ;; NOTE: See the accompanying texinfo manual for details on using this mode! | |
15 | |
16 ;; This file is part of GNU Emacs. | |
17 | |
18 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
19 ;; it under the terms of the GNU General Public License as published by | |
20 ;; the Free Software Foundation; either version 2, or (at your option) | |
21 ;; any later version. | |
22 | |
23 ;; GNU Emacs is distributed in the hope that it will be useful, | |
24 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
25 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
26 ;; GNU General Public License for more details. | |
27 | |
28 ;; You should have received a copy of the GNU General Public License | |
29 ;; along with GNU Emacs; see the file COPYING. If not, write to the | |
30 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
31 ;; Boston, MA 02111-1307, USA. | |
32 | |
33 ;;; Commentary: | |
34 | |
35 ;; 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
|
36 ;; Objective-C, Java and IDL code. As of the latest Emacs and XEmacs |
18720 | 37 ;; releases, it is the default package for editing these languages. |
38 ;; 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
|
39 ;; 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
|
40 ;; 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
|
41 ;; 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
|
42 ;; 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
|
43 ;; 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
|
44 ;; accompanying texinfo manual. |
18720 | 45 |
46 ;; CC Mode's immediate ancestors were, c++-mode.el, cplus-md.el, and | |
47 ;; cplus-md1.el.. | |
48 | |
49 ;; NOTE: This mode does not perform font-locking (a.k.a syntactic | |
50 ;; coloring, keyword highlighting, etc.) for any of the supported | |
51 ;; modes. Typically this is done by a package called font-lock.el | |
52 ;; which I do *not* maintain. You should contact the Emacs | |
53 ;; maintainers for questions about coloring or highlighting in any | |
54 ;; language mode. | |
55 | |
56 ;; To submit bug reports, type "C-c C-b". These will be sent to | |
57 ;; bug-gnu-emacs@prep.ai.mit.edu as well as cc-mode-help@python.org, | |
58 ;; and I'll read about them there (the former is mirrored as the | |
59 ;; Usenet newsgroup gnu.emacs.bug). Questions can sent to | |
60 ;; help-gnu-emacs@prep.ai.mit.edu (mirrored as gnu.emacs.help) and/or | |
61 ;; cc-mode-help@python.org. Please do not send bugs or questions to | |
62 ;; my personal account. | |
63 | |
64 ;; Many, many thanks go out to all the folks on the beta test list. | |
65 ;; Without their patience, testing, insight, code contributions, and | |
66 ;; encouragement CC Mode would be a far inferior package. | |
67 | |
68 ;; You can get the latest version of CC Mode, including PostScript | |
69 ;; documentation and separate individual files from: | |
70 ;; | |
71 ;; http://www.python.org/ftp/emacs/ | |
72 | |
73 ;; Or if you don't have access to the World Wide Web, through | |
74 ;; anonymous ftp from: | |
75 ;; | |
76 ;; ftp://ftp.python.org/pub/emacs | |
77 | |
78 ;;; Code: | |
79 | |
80 (eval-when-compile | |
81 (require 'cc-menus)) | |
82 (require 'cc-defs) | |
83 | |
19380
87b40a65d4cd
(c-buffer-is-cc-mode): Definition moved here from cc-vars.el.
Richard M. Stallman <rms@gnu.org>
parents:
19299
diff
changeset
|
84 (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
|
85 "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
|
86 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
|
87 `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
|
88 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
|
89 \(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
|
90 (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
|
91 (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
|
92 |
18720 | 93 |
18847
dd7615d21a97
(c-initialize-cc-mode): New function.
Richard M. Stallman <rms@gnu.org>
parents:
18720
diff
changeset
|
94 ;; 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
|
95 ;; 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
|
96 ;; use: |
dd7615d21a97
(c-initialize-cc-mode): New function.
Richard M. Stallman <rms@gnu.org>
parents:
18720
diff
changeset
|
97 ;; |
dd7615d21a97
(c-initialize-cc-mode): New function.
Richard M. Stallman <rms@gnu.org>
parents:
18720
diff
changeset
|
98 ;; (require 'cc-mode) |
dd7615d21a97
(c-initialize-cc-mode): New function.
Richard M. Stallman <rms@gnu.org>
parents:
18720
diff
changeset
|
99 ;; (c-initialize-cc-mode) |
dd7615d21a97
(c-initialize-cc-mode): New function.
Richard M. Stallman <rms@gnu.org>
parents:
18720
diff
changeset
|
100 |
19253
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
101 ;;;###autoload |
18847
dd7615d21a97
(c-initialize-cc-mode): New function.
Richard M. Stallman <rms@gnu.org>
parents:
18720
diff
changeset
|
102 (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
|
103 (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
|
104 ;; 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
|
105 ;; 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
|
106 (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
|
107 (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
|
108 (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
|
109 (require 'cc-mode-19)) |
18847
dd7615d21a97
(c-initialize-cc-mode): New function.
Richard M. Stallman <rms@gnu.org>
parents:
18720
diff
changeset
|
110 ;; 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
|
111 (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
|
112 (require 'cc-vars) |
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
113 (require 'cc-engine) |
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
114 (require 'cc-langs) |
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
115 (require 'cc-menus) |
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
116 (require 'cc-align) |
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
117 (require 'cc-styles) |
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
118 (require 'cc-cmds) |
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
119 ;; 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
|
120 (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
|
121 (progn |
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
122 (c-initialize-builtin-style) |
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
123 (run-hooks 'c-initialization-hook) |
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
124 (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
|
125 )) |
18847
dd7615d21a97
(c-initialize-cc-mode): New function.
Richard M. Stallman <rms@gnu.org>
parents:
18720
diff
changeset
|
126 |
dd7615d21a97
(c-initialize-cc-mode): New function.
Richard M. Stallman <rms@gnu.org>
parents:
18720
diff
changeset
|
127 |
18720 | 128 ;;;###autoload |
129 (defun c-mode () | |
130 "Major mode for editing K&R and ANSI C code. | |
131 To submit a problem report, enter `\\[c-submit-bug-report]' from a | |
132 c-mode buffer. This automatically sets up a mail buffer with version | |
133 information already added. You just need to add a description of the | |
134 problem, including a reproducible test case and send the message. | |
135 | |
136 To see what version of CC Mode you are running, enter `\\[c-version]'. | |
137 | |
138 The hook variable `c-mode-hook' is run with no args, if that value is | |
139 bound and has a non-nil value. Also the hook `c-mode-common-hook' is | |
140 run first. | |
141 | |
142 Key bindings: | |
143 \\{c-mode-map}" | |
144 (interactive) | |
18847
dd7615d21a97
(c-initialize-cc-mode): New function.
Richard M. Stallman <rms@gnu.org>
parents:
18720
diff
changeset
|
145 (c-initialize-cc-mode) |
18720 | 146 (kill-all-local-variables) |
147 (set-syntax-table c-mode-syntax-table) | |
148 (setq major-mode 'c-mode | |
149 mode-name "C" | |
150 local-abbrev-table c-mode-abbrev-table) | |
151 (use-local-map c-mode-map) | |
152 (c-common-init) | |
153 (setq comment-start "/* " | |
154 comment-end " */" | |
155 c-conditional-key c-C-conditional-key | |
156 c-class-key c-C-class-key | |
157 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
|
158 c-comment-start-regexp c-C++-comment-start-regexp |
18720 | 159 imenu-generic-expression cc-imenu-c-generic-expression) |
160 (run-hooks 'c-mode-common-hook) | |
161 (run-hooks 'c-mode-hook) | |
162 (c-update-modeline)) | |
163 | |
164 | |
165 ;;;###autoload | |
166 (defun c++-mode () | |
167 "Major mode for editing C++ code. | |
168 To submit a problem report, enter `\\[c-submit-bug-report]' from a | |
169 c++-mode buffer. This automatically sets up a mail buffer with | |
170 version information already added. You just need to add a description | |
171 of the problem, including a reproducible test case, and send the | |
172 message. | |
173 | |
174 To see what version of CC Mode you are running, enter `\\[c-version]'. | |
175 | |
176 The hook variable `c++-mode-hook' is run with no args, if that | |
177 variable is bound and has a non-nil value. Also the hook | |
178 `c-mode-common-hook' is run first. | |
179 | |
180 Key bindings: | |
181 \\{c++-mode-map}" | |
182 (interactive) | |
18847
dd7615d21a97
(c-initialize-cc-mode): New function.
Richard M. Stallman <rms@gnu.org>
parents:
18720
diff
changeset
|
183 (c-initialize-cc-mode) |
18720 | 184 (kill-all-local-variables) |
185 (set-syntax-table c++-mode-syntax-table) | |
186 (setq major-mode 'c++-mode | |
187 mode-name "C++" | |
188 local-abbrev-table c++-mode-abbrev-table) | |
189 (use-local-map c++-mode-map) | |
190 (c-common-init) | |
191 (setq comment-start "// " | |
192 comment-end "" | |
193 c-conditional-key c-C++-conditional-key | |
194 c-comment-start-regexp c-C++-comment-start-regexp | |
195 c-class-key c-C++-class-key | |
196 c-access-key c-C++-access-key | |
197 c-recognize-knr-p nil | |
198 imenu-generic-expression cc-imenu-c++-generic-expression) | |
199 (run-hooks 'c-mode-common-hook) | |
200 (run-hooks 'c++-mode-hook) | |
201 (c-update-modeline)) | |
202 | |
203 | |
204 ;;;###autoload | |
205 (defun objc-mode () | |
206 "Major mode for editing Objective C code. | |
207 To submit a problem report, enter `\\[c-submit-bug-report]' from an | |
208 objc-mode buffer. This automatically sets up a mail buffer with | |
209 version information already added. You just need to add a description | |
210 of the problem, including a reproducible test case, and send the | |
211 message. | |
212 | |
213 To see what version of CC Mode you are running, enter `\\[c-version]'. | |
214 | |
215 The hook variable `objc-mode-hook' is run with no args, if that value | |
216 is bound and has a non-nil value. Also the hook `c-mode-common-hook' | |
217 is run first. | |
218 | |
219 Key bindings: | |
220 \\{objc-mode-map}" | |
221 (interactive) | |
18847
dd7615d21a97
(c-initialize-cc-mode): New function.
Richard M. Stallman <rms@gnu.org>
parents:
18720
diff
changeset
|
222 (c-initialize-cc-mode) |
18720 | 223 (kill-all-local-variables) |
224 (set-syntax-table objc-mode-syntax-table) | |
225 (setq major-mode 'objc-mode | |
226 mode-name "ObjC" | |
227 local-abbrev-table objc-mode-abbrev-table) | |
228 (use-local-map objc-mode-map) | |
229 (c-common-init) | |
230 (setq comment-start "// " | |
231 comment-end "" | |
232 c-conditional-key c-C-conditional-key | |
233 c-comment-start-regexp c-C++-comment-start-regexp | |
234 c-class-key c-ObjC-class-key | |
235 c-baseclass-key nil | |
236 c-access-key c-ObjC-access-key | |
237 c-method-key c-ObjC-method-key) | |
238 (run-hooks 'c-mode-common-hook) | |
239 (run-hooks 'objc-mode-hook) | |
240 (c-update-modeline)) | |
241 | |
242 | |
243 ;;;###autoload | |
244 (defun java-mode () | |
245 "Major mode for editing Java code. | |
246 To submit a problem report, enter `\\[c-submit-bug-report]' from an | |
247 java-mode buffer. This automatically sets up a mail buffer with | |
248 version information already added. You just need to add a description | |
249 of the problem, including a reproducible test case and send the | |
250 message. | |
251 | |
252 To see what version of CC Mode you are running, enter `\\[c-version]'. | |
253 | |
254 The hook variable `java-mode-hook' is run with no args, if that value | |
255 is bound and has a non-nil value. Also the common hook | |
256 `c-mode-common-hook' is run first. Note that this mode automatically | |
257 sets the \"java\" style before calling any hooks so be careful if you | |
258 set styles in `c-mode-common-hook'. | |
259 | |
260 Key bindings: | |
261 \\{java-mode-map}" | |
262 (interactive) | |
18847
dd7615d21a97
(c-initialize-cc-mode): New function.
Richard M. Stallman <rms@gnu.org>
parents:
18720
diff
changeset
|
263 (c-initialize-cc-mode) |
18720 | 264 (kill-all-local-variables) |
265 (set-syntax-table java-mode-syntax-table) | |
266 (setq major-mode 'java-mode | |
267 mode-name "Java" | |
268 local-abbrev-table java-mode-abbrev-table) | |
269 (use-local-map java-mode-map) | |
270 (c-common-init) | |
271 (setq comment-start "// " | |
272 comment-end "" | |
273 c-conditional-key c-Java-conditional-key | |
274 c-comment-start-regexp c-Java-comment-start-regexp | |
275 c-class-key c-Java-class-key | |
276 c-method-key c-Java-method-key | |
277 c-baseclass-key nil | |
278 c-recognize-knr-p nil | |
279 c-access-key c-Java-access-key | |
280 ;defun-prompt-regexp c-Java-defun-prompt-regexp | |
281 imenu-generic-expression cc-imenu-java-generic-expression | |
282 ) | |
283 (c-set-style "java") | |
284 (run-hooks 'c-mode-common-hook) | |
285 (run-hooks 'java-mode-hook) | |
286 (c-update-modeline)) | |
287 | |
288 | |
19253
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
289 ;;;###autoload |
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
290 (defun idl-mode () |
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
291 "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
|
292 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
|
293 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
|
294 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
|
295 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
|
296 message. |
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
297 |
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
298 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
|
299 |
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
300 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
|
301 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
|
302 `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
|
303 |
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
304 Key bindings: |
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
305 \\{idl-mode-map}" |
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
306 (interactive) |
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
307 (c-initialize-cc-mode) |
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
308 (kill-all-local-variables) |
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
309 (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
|
310 (setq major-mode 'idl-mode |
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
311 mode-name "IDL" |
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
312 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
|
313 (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
|
314 (c-common-init) |
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
315 (setq comment-start "// " |
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
316 comment-end "" |
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
317 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
|
318 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
|
319 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
|
320 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
|
321 c-recognize-knr-p nil) |
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
322 ;; 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
|
323 (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
|
324 (run-hooks 'idl-mode-hook) |
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
325 (c-update-modeline)) |
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
326 |
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
327 |
18720 | 328 ;; defuns for submitting bug reports |
19808 | 329 (defconst c-version "5.17" |
18720 | 330 "CC Mode version number.") |
331 | |
332 (defconst c-mode-help-address | |
333 "bug-gnu-emacs@prep.ai.mit.edu, cc-mode-help@python.org" | |
334 "Address for CC Mode bug reports.") | |
335 | |
336 (defun c-version () | |
337 "Echo the current version of CC Mode in the minibuffer." | |
338 (interactive) | |
339 (message "Using CC Mode version %s" c-version) | |
340 (c-keep-region-active)) | |
341 | |
342 ;; Get reporter-submit-bug-report when byte-compiling | |
343 (eval-when-compile | |
344 (require 'reporter)) | |
345 | |
346 (defun c-submit-bug-report () | |
347 "Submit via mail a bug report on CC Mode." | |
348 (interactive) | |
349 (require 'cc-vars) | |
350 ;; load in reporter | |
351 (let ((reporter-prompt-for-summary-p t) | |
352 (reporter-dont-compact-list '(c-offsets-alist)) | |
353 (style c-indentation-style) | |
354 (hook c-special-indent-hook) | |
355 (c-features c-emacs-features)) | |
356 (and | |
357 (if (y-or-n-p "Do you want to submit a report on CC Mode? ") | |
358 t (message "") nil) | |
359 (require 'reporter) | |
360 (reporter-submit-bug-report | |
361 c-mode-help-address | |
362 (concat "CC Mode " c-version " (" | |
363 (cond ((eq major-mode 'c++-mode) "C++") | |
364 ((eq major-mode 'c-mode) "C") | |
365 ((eq major-mode 'objc-mode) "ObjC") | |
366 ((eq major-mode 'java-mode) "Java") | |
367 ) | |
368 ")") | |
369 (let ((vars (list | |
370 ;; report only the vars that affect indentation | |
371 'c-basic-offset | |
372 'c-offsets-alist | |
373 'c-cleanup-list | |
374 'c-comment-only-line-offset | |
375 'c-backslash-column | |
376 'c-delete-function | |
377 'c-electric-pound-behavior | |
378 'c-hanging-braces-alist | |
379 'c-hanging-colons-alist | |
380 'c-hanging-comment-starter-p | |
381 'c-hanging-comment-ender-p | |
382 'c-indent-comments-syntactically-p | |
383 'c-tab-always-indent | |
384 'c-recognize-knr-p | |
385 'c-label-minimum-indentation | |
386 'defun-prompt-regexp | |
387 'tab-width | |
388 ))) | |
389 (if (not (boundp 'defun-prompt-regexp)) | |
390 (delq 'defun-prompt-regexp vars) | |
391 vars)) | |
392 (function | |
393 (lambda () | |
394 (insert | |
395 "Buffer Style: " style "\n\n" | |
396 (if hook | |
397 (concat "\n@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n" | |
398 "c-special-indent-hook is set to '" | |
399 (format "%s" hook) | |
400 ".\nPerhaps this is your problem?\n" | |
401 "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n\n") | |
402 "\n") | |
403 (format "c-emacs-features: %s\n" c-features) | |
404 ))) | |
405 nil | |
406 "Dear Barry," | |
407 )))) | |
408 | |
409 | |
410 (provide 'cc-mode) | |
411 ;;; cc-mode.el ends here |