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