Mercurial > emacs
annotate lisp/progmodes/cc-mode.el @ 67500:e94d15e8e9b3
*** empty log message ***
author | Juri Linkov <juri@jurta.org> |
---|---|
date | Sun, 11 Dec 2005 09:57:08 +0000 |
parents | 04d2abb755d9 |
children | dc49655f57ae 7beb78bc1f8e |
rev | line source |
---|---|
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1 ;;; cc-mode.el --- major mode for editing C and similar languages |
18720 | 2 |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
3 ;; Copyright (C) 1985,1987,1992-2003, 2004, 2005 Free Software Foundation, |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
4 ;; Inc. |
18720 | 5 |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
6 ;; Authors: 2003- Alan Mackenzie |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
7 ;; 1998- Martin Stjernholm |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
8 ;; 1992-1999 Barry A. Warsaw |
18720 | 9 ;; 1987 Dave Detlefs and Stewart Clamen |
10 ;; 1985 Richard M. Stallman | |
24282 | 11 ;; Maintainer: bug-cc-mode@gnu.org |
18720 | 12 ;; Created: a long, long, time ago. adapted from the original c-mode.el |
13 ;; Keywords: c languages oop | |
14 | |
15 ;; This file is part of GNU Emacs. | |
16 | |
17 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
18 ;; it under the terms of the GNU General Public License as published by | |
19 ;; the Free Software Foundation; either version 2, or (at your option) | |
20 ;; any later version. | |
21 | |
22 ;; GNU Emacs is distributed in the hope that it will be useful, | |
23 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
24 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
25 ;; GNU General Public License for more details. | |
26 | |
27 ;; You should have received a copy of the GNU General Public License | |
62641
27b53b1903b6
2005-05-23 Martin Stjernholm <bug-cc-mode@gnu.org>
Martin Stjernholm <mast@lysator.liu.se>
parents:
62046
diff
changeset
|
28 ;; along with this program; see the file COPYING. If not, write to |
27b53b1903b6
2005-05-23 Martin Stjernholm <bug-cc-mode@gnu.org>
Martin Stjernholm <mast@lysator.liu.se>
parents:
62046
diff
changeset
|
29 ;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
27b53b1903b6
2005-05-23 Martin Stjernholm <bug-cc-mode@gnu.org>
Martin Stjernholm <mast@lysator.liu.se>
parents:
62046
diff
changeset
|
30 ;; Boston, MA 02110-1301, USA. |
18720 | 31 |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
32 ;;; Commentary: |
36920 | 33 |
34 ;; NOTE: Read the commentary below for the right way to submit bug reports! | |
35 ;; NOTE: See the accompanying texinfo manual for details on using this mode! | |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
36 ;; Note: The version string is in cc-defs. |
18720 | 37 |
38 ;; This package provides GNU Emacs major modes for editing C, C++, | |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
39 ;; Objective-C, Java, CORBA's IDL, Pike and AWK code. As of the |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
40 ;; latest Emacs and XEmacs releases, it is the default package for |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
41 ;; editing these languages. This package is called "CC Mode", and |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
42 ;; should be spelled exactly this way. |
24282 | 43 |
44 ;; CC Mode supports K&R and ANSI C, ANSI C++, Objective-C, Java, | |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
45 ;; CORBA's IDL, Pike and AWK with a consistent indentation model |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
46 ;; across all modes. This indentation model is intuitive and very |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
47 ;; flexible, so that almost any desired style of indentation can be |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
48 ;; supported. Installation, usage, and programming details are |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
49 ;; contained in an 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 ;; To submit bug reports, type "C-c C-b". These will be sent to | |
24282 | 55 ;; bug-gnu-emacs@gnu.org (mirrored as the Usenet newsgroup |
56 ;; gnu.emacs.bug) as well as bug-cc-mode@gnu.org, which directly | |
57 ;; contacts the CC Mode maintainers. Questions can sent to | |
58 ;; help-gnu-emacs@gnu.org (mirrored as gnu.emacs.help) and/or | |
36920 | 59 ;; bug-cc-mode@gnu.org. Please do not send bugs or questions to our |
60 ;; personal accounts; we reserve the right to ignore such email! | |
18720 | 61 |
62 ;; Many, many thanks go out to all the folks on the beta test list. | |
63 ;; Without their patience, testing, insight, code contributions, and | |
64 ;; encouragement CC Mode would be a far inferior package. | |
65 | |
66 ;; You can get the latest version of CC Mode, including PostScript | |
67 ;; documentation and separate individual files from: | |
68 ;; | |
30401
b85ee58b24ec
(c-initialize-cc-mode): Handling of obsolete
Gerd Moellmann <gerd@gnu.org>
parents:
26817
diff
changeset
|
69 ;; http://cc-mode.sourceforge.net/ |
18720 | 70 ;; |
24282 | 71 ;; You can join a moderated CC Mode announcement-only mailing list by |
72 ;; visiting | |
73 ;; | |
30401
b85ee58b24ec
(c-initialize-cc-mode): Handling of obsolete
Gerd Moellmann <gerd@gnu.org>
parents:
26817
diff
changeset
|
74 ;; http://lists.sourceforge.net/mailman/listinfo/cc-mode-announce |
18720 | 75 |
76 ;;; Code: | |
77 | |
26817 | 78 (eval-when-compile |
79 (let ((load-path | |
36920 | 80 (if (and (boundp 'byte-compile-dest-file) |
81 (stringp byte-compile-dest-file)) | |
82 (cons (file-name-directory byte-compile-dest-file) load-path) | |
26817 | 83 load-path))) |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
84 (load "cc-bytecomp" nil t))) |
21109
a0eda86dd0be
(c-initialize-cc-mode): Moved require's to top level.
Richard M. Stallman <rms@gnu.org>
parents:
20917
diff
changeset
|
85 |
36920 | 86 (cc-require 'cc-defs) |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
87 (cc-require-when-compile 'cc-langs) |
36920 | 88 (cc-require 'cc-vars) |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
89 (cc-require 'cc-engine) |
36920 | 90 (cc-require 'cc-styles) |
91 (cc-require 'cc-cmds) | |
92 (cc-require 'cc-align) | |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
93 (cc-require 'cc-menus) |
36920 | 94 |
62641
27b53b1903b6
2005-05-23 Martin Stjernholm <bug-cc-mode@gnu.org>
Martin Stjernholm <mast@lysator.liu.se>
parents:
62046
diff
changeset
|
95 ;; Silence the compiler. |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
96 (cc-bytecomp-defvar adaptive-fill-first-line-regexp) ; Emacs |
36920 | 97 (cc-bytecomp-defun set-keymap-parents) ; XEmacs |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
98 (cc-bytecomp-defun run-mode-hooks) ; Emacs 21.1 |
62641
27b53b1903b6
2005-05-23 Martin Stjernholm <bug-cc-mode@gnu.org>
Martin Stjernholm <mast@lysator.liu.se>
parents:
62046
diff
changeset
|
99 (cc-bytecomp-obsolete-fun make-local-hook) ; Marked obsolete in Emacs 21.1. |
36920 | 100 |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
101 ;; We set these variables during mode init, yet we don't require |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
102 ;; font-lock. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
103 (cc-bytecomp-defvar font-lock-defaults) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
104 (cc-bytecomp-defvar font-lock-syntactic-keywords) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
105 |
36920 | 106 ;; Menu support for both XEmacs and Emacs. If you don't have easymenu |
107 ;; with your version of Emacs, you are incompatible! | |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
108 (cc-external-require 'easymenu) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
109 |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
110 ;; Autoload directive for emacsen that doesn't have an older CC Mode |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
111 ;; version in the dist. |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
112 (autoload 'c-subword-mode "cc-subword" |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
113 "Mode enabling subword movement and editing keys." t) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
114 |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
115 ;; Load cc-fonts first after font-lock is loaded, since it isn't |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
116 ;; necessary until font locking is requested. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
117 (eval-after-load "font-lock" |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
118 '(require 'cc-fonts)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
119 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
120 ;; cc-langs isn't loaded when we're byte compiled, so add autoload |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
121 ;; directives for the interface functions. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
122 (autoload 'c-make-init-lang-vars-fun "cc-langs") |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
123 (autoload 'c-init-language-vars "cc-langs" nil nil 'macro) |
18720 | 124 |
125 | |
18847
dd7615d21a97
(c-initialize-cc-mode): New function.
Richard M. Stallman <rms@gnu.org>
parents:
18720
diff
changeset
|
126 ;; 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
|
127 ;; 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
|
128 ;; use: |
dd7615d21a97
(c-initialize-cc-mode): New function.
Richard M. Stallman <rms@gnu.org>
parents:
18720
diff
changeset
|
129 ;; |
dd7615d21a97
(c-initialize-cc-mode): New function.
Richard M. Stallman <rms@gnu.org>
parents:
18720
diff
changeset
|
130 ;; (require 'cc-mode) |
44728
7a3ac6c387fe
CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents:
42390
diff
changeset
|
131 ;; |
7a3ac6c387fe
CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents:
42390
diff
changeset
|
132 ;; And in the major mode function: |
7a3ac6c387fe
CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents:
42390
diff
changeset
|
133 ;; |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
134 ;; (c-initialize-cc-mode t) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
135 ;; (c-init-language-vars some-mode) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
136 ;; (c-common-init 'some-mode) ; Or perhaps (c-basic-common-init 'some-mode) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
137 ;; |
52108
5a4fdabed57e
2003-08-03 Martin Stjernholm <bug-cc-mode@gnu.org>
Martin Stjernholm <mast@lysator.liu.se>
parents:
51747
diff
changeset
|
138 ;; If you're not writing a derived mode using the language variable |
5a4fdabed57e
2003-08-03 Martin Stjernholm <bug-cc-mode@gnu.org>
Martin Stjernholm <mast@lysator.liu.se>
parents:
51747
diff
changeset
|
139 ;; system, then some-mode is one of the language modes directly |
5a4fdabed57e
2003-08-03 Martin Stjernholm <bug-cc-mode@gnu.org>
Martin Stjernholm <mast@lysator.liu.se>
parents:
51747
diff
changeset
|
140 ;; supported by CC Mode. You can then use (c-init-language-vars-for |
5a4fdabed57e
2003-08-03 Martin Stjernholm <bug-cc-mode@gnu.org>
Martin Stjernholm <mast@lysator.liu.se>
parents:
51747
diff
changeset
|
141 ;; 'some-mode) instead of `c-init-language-vars'. |
5a4fdabed57e
2003-08-03 Martin Stjernholm <bug-cc-mode@gnu.org>
Martin Stjernholm <mast@lysator.liu.se>
parents:
51747
diff
changeset
|
142 ;; `c-init-language-vars-for' is a function that avoids the rather |
5a4fdabed57e
2003-08-03 Martin Stjernholm <bug-cc-mode@gnu.org>
Martin Stjernholm <mast@lysator.liu.se>
parents:
51747
diff
changeset
|
143 ;; large expansion of `c-init-language-vars'. |
5a4fdabed57e
2003-08-03 Martin Stjernholm <bug-cc-mode@gnu.org>
Martin Stjernholm <mast@lysator.liu.se>
parents:
51747
diff
changeset
|
144 ;; |
5a4fdabed57e
2003-08-03 Martin Stjernholm <bug-cc-mode@gnu.org>
Martin Stjernholm <mast@lysator.liu.se>
parents:
51747
diff
changeset
|
145 ;; If you use `c-basic-common-init' then you might want to call |
5a4fdabed57e
2003-08-03 Martin Stjernholm <bug-cc-mode@gnu.org>
Martin Stjernholm <mast@lysator.liu.se>
parents:
51747
diff
changeset
|
146 ;; `c-font-lock-init' too to set up CC Mode's font lock support. |
5a4fdabed57e
2003-08-03 Martin Stjernholm <bug-cc-mode@gnu.org>
Martin Stjernholm <mast@lysator.liu.se>
parents:
51747
diff
changeset
|
147 ;; |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
148 ;; See cc-langs.el for further info. A small example of a derived mode |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
149 ;; is also available at <http://cc-mode.sourceforge.net/ |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
150 ;; derived-mode-ex.el>. |
18847
dd7615d21a97
(c-initialize-cc-mode): New function.
Richard M. Stallman <rms@gnu.org>
parents:
18720
diff
changeset
|
151 |
44728
7a3ac6c387fe
CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents:
42390
diff
changeset
|
152 (defun c-leave-cc-mode-mode () |
7a3ac6c387fe
CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents:
42390
diff
changeset
|
153 (setq c-buffer-is-cc-mode nil)) |
7a3ac6c387fe
CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents:
42390
diff
changeset
|
154 |
52108
5a4fdabed57e
2003-08-03 Martin Stjernholm <bug-cc-mode@gnu.org>
Martin Stjernholm <mast@lysator.liu.se>
parents:
51747
diff
changeset
|
155 (defun c-init-language-vars-for (mode) |
5a4fdabed57e
2003-08-03 Martin Stjernholm <bug-cc-mode@gnu.org>
Martin Stjernholm <mast@lysator.liu.se>
parents:
51747
diff
changeset
|
156 "Initialize the language variables for one of the language modes |
5a4fdabed57e
2003-08-03 Martin Stjernholm <bug-cc-mode@gnu.org>
Martin Stjernholm <mast@lysator.liu.se>
parents:
51747
diff
changeset
|
157 directly supported by CC Mode. This can be used instead of the |
5a4fdabed57e
2003-08-03 Martin Stjernholm <bug-cc-mode@gnu.org>
Martin Stjernholm <mast@lysator.liu.se>
parents:
51747
diff
changeset
|
158 `c-init-language-vars' macro if the language you want to use is one of |
5a4fdabed57e
2003-08-03 Martin Stjernholm <bug-cc-mode@gnu.org>
Martin Stjernholm <mast@lysator.liu.se>
parents:
51747
diff
changeset
|
159 those, rather than a derived language defined through the language |
5a4fdabed57e
2003-08-03 Martin Stjernholm <bug-cc-mode@gnu.org>
Martin Stjernholm <mast@lysator.liu.se>
parents:
51747
diff
changeset
|
160 variable system (see \"cc-langs.el\")." |
5a4fdabed57e
2003-08-03 Martin Stjernholm <bug-cc-mode@gnu.org>
Martin Stjernholm <mast@lysator.liu.se>
parents:
51747
diff
changeset
|
161 (cond ((eq mode 'c-mode) (c-init-language-vars c-mode)) |
5a4fdabed57e
2003-08-03 Martin Stjernholm <bug-cc-mode@gnu.org>
Martin Stjernholm <mast@lysator.liu.se>
parents:
51747
diff
changeset
|
162 ((eq mode 'c++-mode) (c-init-language-vars c++-mode)) |
5a4fdabed57e
2003-08-03 Martin Stjernholm <bug-cc-mode@gnu.org>
Martin Stjernholm <mast@lysator.liu.se>
parents:
51747
diff
changeset
|
163 ((eq mode 'objc-mode) (c-init-language-vars objc-mode)) |
5a4fdabed57e
2003-08-03 Martin Stjernholm <bug-cc-mode@gnu.org>
Martin Stjernholm <mast@lysator.liu.se>
parents:
51747
diff
changeset
|
164 ((eq mode 'java-mode) (c-init-language-vars java-mode)) |
5a4fdabed57e
2003-08-03 Martin Stjernholm <bug-cc-mode@gnu.org>
Martin Stjernholm <mast@lysator.liu.se>
parents:
51747
diff
changeset
|
165 ((eq mode 'idl-mode) (c-init-language-vars idl-mode)) |
5a4fdabed57e
2003-08-03 Martin Stjernholm <bug-cc-mode@gnu.org>
Martin Stjernholm <mast@lysator.liu.se>
parents:
51747
diff
changeset
|
166 ((eq mode 'pike-mode) (c-init-language-vars pike-mode)) |
5a4fdabed57e
2003-08-03 Martin Stjernholm <bug-cc-mode@gnu.org>
Martin Stjernholm <mast@lysator.liu.se>
parents:
51747
diff
changeset
|
167 ((eq mode 'awk-mode) (c-init-language-vars awk-mode)) |
5a4fdabed57e
2003-08-03 Martin Stjernholm <bug-cc-mode@gnu.org>
Martin Stjernholm <mast@lysator.liu.se>
parents:
51747
diff
changeset
|
168 (t (error "Unsupported mode %s" mode)))) |
5a4fdabed57e
2003-08-03 Martin Stjernholm <bug-cc-mode@gnu.org>
Martin Stjernholm <mast@lysator.liu.se>
parents:
51747
diff
changeset
|
169 |
19253
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
170 ;;;###autoload |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
171 (defun c-initialize-cc-mode (&optional new-style-init) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
172 "Initialize CC Mode for use in the current buffer. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
173 If the optional NEW-STYLE-INIT is nil or left out then all necessary |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
174 initialization to run CC Mode for the C language is done. Otherwise |
52108
5a4fdabed57e
2003-08-03 Martin Stjernholm <bug-cc-mode@gnu.org>
Martin Stjernholm <mast@lysator.liu.se>
parents:
51747
diff
changeset
|
175 only some basic setup is done, and a call to `c-init-language-vars' or |
5a4fdabed57e
2003-08-03 Martin Stjernholm <bug-cc-mode@gnu.org>
Martin Stjernholm <mast@lysator.liu.se>
parents:
51747
diff
changeset
|
176 `c-init-language-vars-for' is necessary too (which gives more |
5a4fdabed57e
2003-08-03 Martin Stjernholm <bug-cc-mode@gnu.org>
Martin Stjernholm <mast@lysator.liu.se>
parents:
51747
diff
changeset
|
177 control). See \"cc-mode.el\" for more info." |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
178 |
19299
7cd7373cc021
(c-initialize-cc-mode): Set c-buffer-is-cc-mode to t.
Richard M. Stallman <rms@gnu.org>
parents:
19253
diff
changeset
|
179 (setq c-buffer-is-cc-mode t) |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
180 |
24282 | 181 (let ((initprop 'cc-mode-is-initialized) |
182 c-initialization-ok) | |
183 (unless (get 'c-initialize-cc-mode initprop) | |
184 (unwind-protect | |
185 (progn | |
26817 | 186 (put 'c-initialize-cc-mode initprop t) |
187 (c-initialize-builtin-style) | |
24282 | 188 (run-hooks 'c-initialization-hook) |
26817 | 189 ;; Fix obsolete variables. |
190 (if (boundp 'c-comment-continuation-stars) | |
191 (setq c-block-comment-prefix c-comment-continuation-stars)) | |
44728
7a3ac6c387fe
CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents:
42390
diff
changeset
|
192 (add-hook 'change-major-mode-hook 'c-leave-cc-mode-mode) |
24282 | 193 (setq c-initialization-ok t)) |
194 ;; Will try initialization hooks again if they failed. | |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
195 (put 'c-initialize-cc-mode initprop c-initialization-ok)))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
196 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
197 (unless new-style-init |
52108
5a4fdabed57e
2003-08-03 Martin Stjernholm <bug-cc-mode@gnu.org>
Martin Stjernholm <mast@lysator.liu.se>
parents:
51747
diff
changeset
|
198 (c-init-language-vars-for 'c-mode))) |
18847
dd7615d21a97
(c-initialize-cc-mode): New function.
Richard M. Stallman <rms@gnu.org>
parents:
18720
diff
changeset
|
199 |
dd7615d21a97
(c-initialize-cc-mode): New function.
Richard M. Stallman <rms@gnu.org>
parents:
18720
diff
changeset
|
200 |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
201 ;;; Common routines. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
202 |
36920 | 203 (defvar c-mode-base-map () |
204 "Keymap shared by all CC Mode related modes.") | |
205 | |
206 (defun c-make-inherited-keymap () | |
207 (let ((map (make-sparse-keymap))) | |
62641
27b53b1903b6
2005-05-23 Martin Stjernholm <bug-cc-mode@gnu.org>
Martin Stjernholm <mast@lysator.liu.se>
parents:
62046
diff
changeset
|
208 ;; Necessary to use `cc-bytecomp-fboundp' below since this |
27b53b1903b6
2005-05-23 Martin Stjernholm <bug-cc-mode@gnu.org>
Martin Stjernholm <mast@lysator.liu.se>
parents:
62046
diff
changeset
|
209 ;; function is called from top-level forms that are evaluated |
27b53b1903b6
2005-05-23 Martin Stjernholm <bug-cc-mode@gnu.org>
Martin Stjernholm <mast@lysator.liu.se>
parents:
62046
diff
changeset
|
210 ;; while cc-bytecomp is active when one does M-x eval-buffer. |
36920 | 211 (cond |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
212 ;; XEmacs |
62641
27b53b1903b6
2005-05-23 Martin Stjernholm <bug-cc-mode@gnu.org>
Martin Stjernholm <mast@lysator.liu.se>
parents:
62046
diff
changeset
|
213 ((cc-bytecomp-fboundp 'set-keymap-parents) |
36920 | 214 (set-keymap-parents map c-mode-base-map)) |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
215 ;; Emacs |
62641
27b53b1903b6
2005-05-23 Martin Stjernholm <bug-cc-mode@gnu.org>
Martin Stjernholm <mast@lysator.liu.se>
parents:
62046
diff
changeset
|
216 ((cc-bytecomp-fboundp 'set-keymap-parent) |
36920 | 217 (set-keymap-parent map c-mode-base-map)) |
218 ;; incompatible | |
219 (t (error "CC Mode is incompatible with this version of Emacs"))) | |
220 map)) | |
221 | |
44728
7a3ac6c387fe
CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents:
42390
diff
changeset
|
222 (defun c-define-abbrev-table (name defs) |
7a3ac6c387fe
CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents:
42390
diff
changeset
|
223 ;; Compatibility wrapper for `define-abbrev' which passes a non-nil |
7a3ac6c387fe
CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents:
42390
diff
changeset
|
224 ;; sixth argument for SYSTEM-FLAG in emacsen that support it |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
225 ;; (currently only Emacs >= 21.2). |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
226 (let ((table (or (symbol-value name) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
227 (progn (define-abbrev-table name nil) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
228 (symbol-value name))))) |
44728
7a3ac6c387fe
CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents:
42390
diff
changeset
|
229 (while defs |
7a3ac6c387fe
CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents:
42390
diff
changeset
|
230 (condition-case nil |
7a3ac6c387fe
CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents:
42390
diff
changeset
|
231 (apply 'define-abbrev table (append (car defs) '(t))) |
7a3ac6c387fe
CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents:
42390
diff
changeset
|
232 (wrong-number-of-arguments |
7a3ac6c387fe
CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents:
42390
diff
changeset
|
233 (apply 'define-abbrev table (car defs)))) |
7a3ac6c387fe
CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents:
42390
diff
changeset
|
234 (setq defs (cdr defs))))) |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
235 (put 'c-define-abbrev-table 'lisp-indent-function 1) |
44728
7a3ac6c387fe
CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents:
42390
diff
changeset
|
236 |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
237 (defun c-bind-special-erase-keys () |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
238 ;; Only used in Emacs to bind C-c C-<delete> and C-c C-<backspace> |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
239 ;; to the proper keys depending on `normal-erase-is-backspace'. |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
240 (if normal-erase-is-backspace |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
241 (progn |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
242 (define-key c-mode-base-map (kbd "C-c C-<delete>") |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
243 'c-hungry-delete-forward) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
244 (define-key c-mode-base-map (kbd "C-c C-<backspace>") |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
245 'c-hungry-backspace)) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
246 (define-key c-mode-base-map (kbd "C-c C-<delete>") |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
247 'c-hungry-backspace) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
248 (define-key c-mode-base-map (kbd "C-c C-<backspace>") |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
249 'c-hungry-delete-forward))) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
250 |
36920 | 251 (if c-mode-base-map |
252 nil | |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
253 |
36920 | 254 (setq c-mode-base-map (make-sparse-keymap)) |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
255 |
36920 | 256 ;; Separate M-BS from C-M-h. The former should remain |
257 ;; backward-kill-word. | |
258 (define-key c-mode-base-map [(control meta h)] 'c-mark-function) | |
259 (define-key c-mode-base-map "\e\C-q" 'c-indent-exp) | |
260 (substitute-key-definition 'backward-sentence | |
261 'c-beginning-of-statement | |
262 c-mode-base-map global-map) | |
263 (substitute-key-definition 'forward-sentence | |
264 'c-end-of-statement | |
265 c-mode-base-map global-map) | |
266 (substitute-key-definition 'indent-new-comment-line | |
267 'c-indent-new-comment-line | |
268 c-mode-base-map global-map) | |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
269 (substitute-key-definition 'indent-for-tab-command |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
270 'c-indent-command |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
271 c-mode-base-map global-map) |
44728
7a3ac6c387fe
CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents:
42390
diff
changeset
|
272 (when (fboundp 'comment-indent-new-line) |
7a3ac6c387fe
CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents:
42390
diff
changeset
|
273 ;; indent-new-comment-line has changed name to |
7a3ac6c387fe
CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents:
42390
diff
changeset
|
274 ;; comment-indent-new-line in Emacs 21. |
7a3ac6c387fe
CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents:
42390
diff
changeset
|
275 (substitute-key-definition 'comment-indent-new-line |
7a3ac6c387fe
CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents:
42390
diff
changeset
|
276 'c-indent-new-comment-line |
7a3ac6c387fe
CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents:
42390
diff
changeset
|
277 c-mode-base-map global-map)) |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
278 |
36920 | 279 ;; RMS says don't make these the default. |
280 ;; (define-key c-mode-base-map "\e\C-a" 'c-beginning-of-defun) | |
281 ;; (define-key c-mode-base-map "\e\C-e" 'c-end-of-defun) | |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
282 |
36920 | 283 (define-key c-mode-base-map "\C-c\C-n" 'c-forward-conditional) |
284 (define-key c-mode-base-map "\C-c\C-p" 'c-backward-conditional) | |
285 (define-key c-mode-base-map "\C-c\C-u" 'c-up-conditional) | |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
286 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
287 ;; It doesn't suffice to put `c-fill-paragraph' on |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
288 ;; `fill-paragraph-function' since `c-fill-paragraph' must be called |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
289 ;; before any fill prefix adaption is done. E.g. `filladapt-mode' |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
290 ;; replaces `fill-paragraph' and does the adaption before calling |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
291 ;; `fill-paragraph-function', and we have to mask comments etc |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
292 ;; before that. Also, `c-fill-paragraph' chains on to |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
293 ;; `fill-paragraph' and the value on `fill-parapgraph-function' to |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
294 ;; do the actual filling work. |
36920 | 295 (substitute-key-definition 'fill-paragraph 'c-fill-paragraph |
296 c-mode-base-map global-map) | |
297 ;; In XEmacs the default fill function is called | |
298 ;; fill-paragraph-or-region. | |
299 (substitute-key-definition 'fill-paragraph-or-region 'c-fill-paragraph | |
300 c-mode-base-map global-map) | |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
301 |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
302 ;; We bind the forward deletion key and (implicitly) C-d to |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
303 ;; `c-electric-delete-forward', and the backward deletion key to |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
304 ;; `c-electric-backspace'. The hungry variants are bound to the |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
305 ;; same keys but prefixed with C-c. This implies that C-c C-d is |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
306 ;; `c-hungry-delete-forward'. For consistency, we bind not only C-c |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
307 ;; <backspace> to `c-hungry-backspace' but also C-c C-<backspace>, |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
308 ;; so that the Ctrl key can be held down during the whole sequence |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
309 ;; regardless of the direction. This in turn implies that we bind |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
310 ;; C-c C-<delete> to `c-hungry-delete-forward', for the same reason. |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
311 |
37563
79039a33283a
Bind c-electric-delete-forward to C-d and c-electric-backspace to DEL.
Eli Zaretskii <eliz@gnu.org>
parents:
36920
diff
changeset
|
312 ;; Bind the electric deletion functions to C-d and DEL. Emacs 21 |
79039a33283a
Bind c-electric-delete-forward to C-d and c-electric-backspace to DEL.
Eli Zaretskii <eliz@gnu.org>
parents:
36920
diff
changeset
|
313 ;; automatically maps the [delete] and [backspace] keys to these two |
79039a33283a
Bind c-electric-delete-forward to C-d and c-electric-backspace to DEL.
Eli Zaretskii <eliz@gnu.org>
parents:
36920
diff
changeset
|
314 ;; depending on window system and user preferences. (In earlier |
79039a33283a
Bind c-electric-delete-forward to C-d and c-electric-backspace to DEL.
Eli Zaretskii <eliz@gnu.org>
parents:
36920
diff
changeset
|
315 ;; versions it's possible to do the same by using `function-key-map'.) |
79039a33283a
Bind c-electric-delete-forward to C-d and c-electric-backspace to DEL.
Eli Zaretskii <eliz@gnu.org>
parents:
36920
diff
changeset
|
316 (define-key c-mode-base-map "\C-d" 'c-electric-delete-forward) |
79039a33283a
Bind c-electric-delete-forward to C-d and c-electric-backspace to DEL.
Eli Zaretskii <eliz@gnu.org>
parents:
36920
diff
changeset
|
317 (define-key c-mode-base-map "\177" 'c-electric-backspace) |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
318 (define-key c-mode-base-map "\C-c\C-d" 'c-hungry-delete-forward) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
319 (define-key c-mode-base-map [?\C-c ?\d] 'c-hungry-backspace) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
320 (define-key c-mode-base-map [?\C-c ?\C-\d] 'c-hungry-backspace) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
321 (define-key c-mode-base-map [?\C-c deletechar] 'c-hungry-delete-forward) ; C-c <delete> on a tty. |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
322 (define-key c-mode-base-map [?\C-c (control deletechar)] ; C-c C-<delete> on a tty. |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
323 'c-hungry-delete-forward) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
324 (when (boundp 'normal-erase-is-backspace) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
325 ;; The automatic C-d and DEL mapping functionality doesn't extend |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
326 ;; to special combinations like C-c C-<delete>, so we have to hook |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
327 ;; into the `normal-erase-is-backspace' system to bind it directly |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
328 ;; as appropriate. |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
329 (add-hook 'normal-erase-is-backspace-hook 'c-bind-special-erase-keys) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
330 (c-bind-special-erase-keys)) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
331 |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
332 (when (fboundp 'delete-forward-p) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
333 ;; In XEmacs we fix the forward and backward deletion behavior by |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
334 ;; binding the keysyms for the [delete] and [backspace] keys |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
335 ;; directly, and use `delete-forward-p' to decide what [delete] |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
336 ;; should do. That's done in the XEmacs specific |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
337 ;; `c-electric-delete' and `c-hungry-delete' functions. |
37563
79039a33283a
Bind c-electric-delete-forward to C-d and c-electric-backspace to DEL.
Eli Zaretskii <eliz@gnu.org>
parents:
36920
diff
changeset
|
338 (define-key c-mode-base-map [delete] 'c-electric-delete) |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
339 (define-key c-mode-base-map [backspace] 'c-electric-backspace) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
340 (define-key c-mode-base-map (kbd "C-c <delete>") 'c-hungry-delete) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
341 (define-key c-mode-base-map (kbd "C-c C-<delete>") 'c-hungry-delete) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
342 (define-key c-mode-base-map (kbd "C-c <backspace>") 'c-hungry-backspace) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
343 (define-key c-mode-base-map (kbd "C-c C-<backspace>") 'c-hungry-backspace)) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
344 |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
345 (define-key c-mode-base-map "#" 'c-electric-pound) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
346 (define-key c-mode-base-map "{" 'c-electric-brace) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
347 (define-key c-mode-base-map "}" 'c-electric-brace) |
36920 | 348 (define-key c-mode-base-map "/" 'c-electric-slash) |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
349 (define-key c-mode-base-map "*" 'c-electric-star) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
350 (define-key c-mode-base-map ";" 'c-electric-semi&comma) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
351 (define-key c-mode-base-map "," 'c-electric-semi&comma) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
352 (define-key c-mode-base-map ":" 'c-electric-colon) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
353 (define-key c-mode-base-map "(" 'c-electric-paren) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
354 (define-key c-mode-base-map ")" 'c-electric-paren) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
355 |
36920 | 356 (define-key c-mode-base-map "\C-c\C-\\" 'c-backslash-region) |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
357 (define-key c-mode-base-map "\C-c\C-a" 'c-toggle-auto-newline) |
36920 | 358 (define-key c-mode-base-map "\C-c\C-b" 'c-submit-bug-report) |
359 (define-key c-mode-base-map "\C-c\C-c" 'comment-region) | |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
360 (define-key c-mode-base-map "\C-c\C-l" 'c-toggle-electric-state) |
36920 | 361 (define-key c-mode-base-map "\C-c\C-o" 'c-set-offset) |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
362 (define-key c-mode-base-map "\C-c\C-q" 'c-indent-defun) |
36920 | 363 (define-key c-mode-base-map "\C-c\C-s" 'c-show-syntactic-information) |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
364 ;; (define-key c-mode-base-map "\C-c\C-t" 'c-toggle-auto-hungry-state) Commented out by ACM, 2005-03-05. |
36920 | 365 (define-key c-mode-base-map "\C-c." 'c-set-style) |
366 ;; conflicts with OOBR | |
367 ;;(define-key c-mode-base-map "\C-c\C-v" 'c-version) | |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
368 ;; (define-key c-mode-base-map "\C-c\C-y" 'c-toggle-hungry-state) Commented out by ACM, 2005-11-22. |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
369 (define-key c-mode-base-map "\C-c\C-w" 'c-subword-mode) |
36920 | 370 ) |
371 | |
372 ;; We don't require the outline package, but we configure it a bit anyway. | |
373 (cc-bytecomp-defvar outline-level) | |
374 | |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
375 (defun c-mode-menu (modestr) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
376 "Return a menu spec suitable for `easy-menu-define' that is exactly |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
377 like the C mode menu except that the menu bar item name is MODESTR |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
378 instead of \"C\". |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
379 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
380 This function is provided for compatibility only; derived modes should |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
381 preferably use the `c-mode-menu' language constant directly." |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
382 (cons modestr (c-lang-const c-mode-menu c))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
383 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
384 ;; Ugly hack to pull in the definition of `c-populate-syntax-table' |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
385 ;; from cc-langs to make it available at runtime. It's either this or |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
386 ;; moving the definition for it to cc-defs, but that would mean to |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
387 ;; break up the syntax table setup over two files. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
388 (defalias 'c-populate-syntax-table |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
389 (cc-eval-when-compile |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
390 (let ((f (symbol-function 'c-populate-syntax-table))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
391 (if (byte-code-function-p f) f (byte-compile f))))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
392 |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
393 ;; CAUTION: Try to avoid installing things on |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
394 ;; `before-change-functions'. The macro `combine-after-change-calls' |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
395 ;; is used and it doesn't work if there are things on that hook. That |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
396 ;; can cause font lock functions to run in inconvenient places during |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
397 ;; temporary changes in some font lock support modes, causing extra |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
398 ;; unnecessary work and font lock glitches due to interactions between |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
399 ;; various text properties. |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
400 |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
401 (defun c-after-change (beg end len) |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
402 ;; Function put on `after-change-functions' to adjust various caches |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
403 ;; etc. Prefer speed to finesse here, since there will be an order |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
404 ;; of magnitude more calls to this function than any of the |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
405 ;; functions that use the caches. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
406 ;; |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
407 ;; Note that care must be taken so that this is called before any |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
408 ;; font-lock callbacks since we might get calls to functions using |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
409 ;; these caches from inside them, and we must thus be sure that this |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
410 ;; has already been executed. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
411 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
412 (c-save-buffer-state () |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
413 ;; When `combine-after-change-calls' is used we might get calls |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
414 ;; with regions outside the current narrowing. This has been |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
415 ;; observed in Emacs 20.7. |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
416 (save-restriction |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
417 (widen) |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
418 |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
419 (when (> end (point-max)) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
420 ;; Some emacsen might return positions past the end. This has been |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
421 ;; observed in Emacs 20.7 when rereading a buffer changed on disk |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
422 ;; (haven't been able to minimize it, but Emacs 21.3 appears to |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
423 ;; work). |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
424 (setq end (point-max)) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
425 (when (> beg end) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
426 (setq beg end))) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
427 |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
428 (c-invalidate-sws-region-after beg end) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
429 (c-invalidate-state-cache beg) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
430 (c-invalidate-find-decl-cache beg) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
431 |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
432 (when c-recognize-<>-arglists |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
433 (c-after-change-check-<>-operators beg end))))) |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
434 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
435 (defun c-basic-common-init (mode default-style) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
436 "Do the necessary initialization for the syntax handling routines |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
437 and the line breaking/filling code. Intended to be used by other |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
438 packages that embed CC Mode. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
439 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
440 MODE is the CC Mode flavor to set up, e.g. 'c-mode or 'java-mode. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
441 DEFAULT-STYLE tells which indentation style to install. It has the |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
442 same format as `c-default-style'. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
443 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
444 Note that `c-init-language-vars' must be called before this function. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
445 This function cannot do that since `c-init-language-vars' is a macro |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
446 that requires a literal mode spec at compile time." |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
447 |
44728
7a3ac6c387fe
CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents:
42390
diff
changeset
|
448 (setq c-buffer-is-cc-mode mode) |
7a3ac6c387fe
CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents:
42390
diff
changeset
|
449 |
36920 | 450 ;; these variables should always be buffer local; they do not affect |
451 ;; indentation style. | |
452 (make-local-variable 'parse-sexp-ignore-comments) | |
453 (make-local-variable 'indent-line-function) | |
454 (make-local-variable 'indent-region-function) | |
455 (make-local-variable 'normal-auto-fill-function) | |
456 (make-local-variable 'comment-start) | |
457 (make-local-variable 'comment-end) | |
458 (make-local-variable 'comment-start-skip) | |
459 (make-local-variable 'comment-multi-line) | |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
460 (make-local-variable 'comment-line-break-function) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
461 (make-local-variable 'paragraph-start) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
462 (make-local-variable 'paragraph-separate) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
463 (make-local-variable 'paragraph-ignore-fill-prefix) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
464 (make-local-variable 'adaptive-fill-mode) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
465 (make-local-variable 'adaptive-fill-regexp) |
44728
7a3ac6c387fe
CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents:
42390
diff
changeset
|
466 |
36920 | 467 ;; now set their values |
49496
2c05c557df6c
(c-require-final-newline): Made this variable an alist to specify a value
Martin Stjernholm <mast@lysator.liu.se>
parents:
49470
diff
changeset
|
468 (setq parse-sexp-ignore-comments t |
36920 | 469 indent-line-function 'c-indent-line |
470 indent-region-function 'c-indent-region | |
471 normal-auto-fill-function 'c-do-auto-fill | |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
472 comment-multi-line t |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
473 comment-line-break-function 'c-indent-new-comment-line) |
44728
7a3ac6c387fe
CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents:
42390
diff
changeset
|
474 |
49654
b025ca405045
(c-basic-common-init): Install `c-fill-paragraph' on
Martin Stjernholm <mast@lysator.liu.se>
parents:
49496
diff
changeset
|
475 ;; Install `c-fill-paragraph' on `fill-paragraph-function' so that a |
b025ca405045
(c-basic-common-init): Install `c-fill-paragraph' on
Martin Stjernholm <mast@lysator.liu.se>
parents:
49496
diff
changeset
|
476 ;; direct call to `fill-paragraph' behaves better. This still |
b025ca405045
(c-basic-common-init): Install `c-fill-paragraph' on
Martin Stjernholm <mast@lysator.liu.se>
parents:
49496
diff
changeset
|
477 ;; doesn't work with filladapt but it's better than nothing. |
b025ca405045
(c-basic-common-init): Install `c-fill-paragraph' on
Martin Stjernholm <mast@lysator.liu.se>
parents:
49496
diff
changeset
|
478 (make-local-variable 'fill-paragraph-function) |
b025ca405045
(c-basic-common-init): Install `c-fill-paragraph' on
Martin Stjernholm <mast@lysator.liu.se>
parents:
49496
diff
changeset
|
479 (setq fill-paragraph-function 'c-fill-paragraph) |
b025ca405045
(c-basic-common-init): Install `c-fill-paragraph' on
Martin Stjernholm <mast@lysator.liu.se>
parents:
49496
diff
changeset
|
480 |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
481 (when (or c-recognize-<>-arglists |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
482 (c-major-mode-is 'awk-mode)) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
483 ;; We'll use the syntax-table text property to change the syntax |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
484 ;; of some chars for this language, so do the necessary setup for |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
485 ;; that. |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
486 ;; |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
487 ;; Note to other package developers: It's ok to turn this on in CC |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
488 ;; Mode buffers when CC Mode doesn't, but it's not ok to turn it |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
489 ;; off if CC Mode has turned it on. |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
490 |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
491 ;; Emacs. |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
492 (when (boundp 'parse-sexp-lookup-properties) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
493 (make-local-variable 'parse-sexp-lookup-properties) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
494 (setq parse-sexp-lookup-properties t)) |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
495 |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
496 ;; Same as above for XEmacs. |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
497 (when (boundp 'lookup-syntax-properties) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
498 (make-local-variable 'lookup-syntax-properties) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
499 (setq lookup-syntax-properties t))) |
49496
2c05c557df6c
(c-require-final-newline): Made this variable an alist to specify a value
Martin Stjernholm <mast@lysator.liu.se>
parents:
49470
diff
changeset
|
500 |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
501 ;; Use this in Emacs 21 to avoid meddling with the rear-nonsticky |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
502 ;; property on each character. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
503 (when (boundp 'text-property-default-nonsticky) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
504 (make-local-variable 'text-property-default-nonsticky) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
505 (let ((elem (assq 'syntax-table text-property-default-nonsticky))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
506 (if elem |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
507 (setcdr elem t) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
508 (setq text-property-default-nonsticky |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
509 (cons '(syntax-table . t) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
510 text-property-default-nonsticky)))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
511 (setq text-property-default-nonsticky |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
512 (cons '(c-type . t) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
513 text-property-default-nonsticky))) |
44728
7a3ac6c387fe
CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents:
42390
diff
changeset
|
514 |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
515 ;; In Emacs 21 and later it's possible to turn off the ad-hoc |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
516 ;; heuristic that open parens in column 0 are defun starters. Since |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
517 ;; we have c-state-cache, that heuristic isn't useful and only causes |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
518 ;; trouble, so turn it off. |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
519 (when (memq 'col-0-paren c-emacs-features) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
520 (make-local-variable 'open-paren-in-column-0-is-defun-start) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
521 (setq open-paren-in-column-0-is-defun-start nil)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
522 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
523 (c-clear-found-types) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
524 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
525 ;; now set the mode style based on default-style |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
526 (let ((style (if (stringp default-style) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
527 default-style |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
528 (or (cdr (assq mode default-style)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
529 (cdr (assq 'other default-style)) |
36920 | 530 "gnu")))) |
531 ;; Override style variables if `c-old-style-variable-behavior' is | |
532 ;; set. Also override if we are using global style variables, | |
533 ;; have already initialized a style once, and are switching to a | |
534 ;; different style. (It's doubtful whether this is desirable, but | |
535 ;; the whole situation with nonlocal style variables is a bit | |
536 ;; awkward. It's at least the most compatible way with the old | |
537 ;; style init procedure.) | |
538 (c-set-style style (not (or c-old-style-variable-behavior | |
539 (and (not c-style-variables-are-local-p) | |
540 c-indentation-style | |
541 (not (string-equal c-indentation-style | |
542 style))))))) | |
44728
7a3ac6c387fe
CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents:
42390
diff
changeset
|
543 (c-setup-paragraph-variables) |
7a3ac6c387fe
CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents:
42390
diff
changeset
|
544 |
36920 | 545 ;; we have to do something special for c-offsets-alist so that the |
546 ;; buffer local value has its own alist structure. | |
547 (setq c-offsets-alist (copy-alist c-offsets-alist)) | |
44728
7a3ac6c387fe
CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents:
42390
diff
changeset
|
548 |
36920 | 549 ;; setup the comment indent variable in a Emacs version portable way |
550 (make-local-variable 'comment-indent-function) | |
551 (setq comment-indent-function 'c-comment-indent) | |
44728
7a3ac6c387fe
CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents:
42390
diff
changeset
|
552 |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
553 ;; Put submode indicators onto minor-mode-alist, but only once. |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
554 (or (assq 'c-submode-indicators minor-mode-alist) |
36920 | 555 (setq minor-mode-alist |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
556 (cons '(c-submode-indicators c-submode-indicators) |
36920 | 557 minor-mode-alist))) |
44728
7a3ac6c387fe
CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents:
42390
diff
changeset
|
558 |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
559 ;; Install the functions that ensure that various internal caches |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
560 ;; don't become invalid due to buffer changes. |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
561 (make-local-hook 'after-change-functions) |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
562 (add-hook 'after-change-functions 'c-after-change nil t)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
563 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
564 (defun c-after-font-lock-init () |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
565 ;; Put on `font-lock-mode-hook'. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
566 (remove-hook 'after-change-functions 'c-after-change t) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
567 (add-hook 'after-change-functions 'c-after-change nil t)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
568 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
569 (defun c-font-lock-init () |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
570 "Set up the font-lock variables for using the font-lock support in CC Mode. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
571 This does not load the font-lock package. Use after |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
572 `c-basic-common-init' and after cc-fonts has been loaded." |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
573 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
574 (make-local-variable 'font-lock-defaults) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
575 (setq font-lock-defaults |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
576 `(,(if (c-major-mode-is 'awk-mode) |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
577 ;; awk-mode currently has only one font lock level. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
578 'awk-font-lock-keywords |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
579 (mapcar 'c-mode-symbol |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
580 '("font-lock-keywords" "font-lock-keywords-1" |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
581 "font-lock-keywords-2" "font-lock-keywords-3"))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
582 nil nil |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
583 ,c-identifier-syntax-modifications |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
584 c-beginning-of-syntax |
65661
1da971deed7b
(c-font-lock-init): Specify font-lock-lines-before.
Richard M. Stallman <rms@gnu.org>
parents:
64699
diff
changeset
|
585 (font-lock-lines-before . 1) |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
586 (font-lock-mark-block-function |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
587 . c-mark-function))) |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
588 |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
589 (make-local-hook 'font-lock-mode-hook) |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
590 (add-hook 'font-lock-mode-hook 'c-after-font-lock-init nil t)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
591 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
592 (defun c-setup-doc-comment-style () |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
593 "Initialize the variables that depend on the value of `c-doc-comment-style'." |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
594 (when (and (featurep 'font-lock) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
595 (symbol-value 'font-lock-mode)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
596 ;; Force font lock mode to reinitialize itself. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
597 (font-lock-mode 0) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
598 (font-lock-mode 1))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
599 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
600 (defun c-common-init (&optional mode) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
601 "Common initialization for all CC Mode modes. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
602 In addition to the work done by `c-basic-common-init' and |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
603 `c-font-lock-init', this function sets up various other things as |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
604 customary in CC Mode modes but which aren't strictly necessary for CC |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
605 Mode to operate correctly. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
606 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
607 MODE is the symbol for the mode to initialize, like 'c-mode. See |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
608 `c-basic-common-init' for details. It's only optional to be |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
609 compatible with old code; callers should always specify it." |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
610 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
611 (unless mode |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
612 ;; Called from an old third party package. The fallback is to |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
613 ;; initialize for C. |
52108
5a4fdabed57e
2003-08-03 Martin Stjernholm <bug-cc-mode@gnu.org>
Martin Stjernholm <mast@lysator.liu.se>
parents:
51747
diff
changeset
|
614 (c-init-language-vars-for 'c-mode)) |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
615 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
616 (c-basic-common-init mode c-default-style) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
617 (when mode |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
618 ;; Only initialize font locking if we aren't called from an old package. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
619 (c-font-lock-init)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
620 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
621 (make-local-variable 'outline-regexp) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
622 (make-local-variable 'outline-level) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
623 (setq outline-regexp "[^#\n\^M]" |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
624 outline-level 'c-outline-level) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
625 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
626 (let ((rfn (assq mode c-require-final-newline))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
627 (when rfn |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
628 (make-local-variable 'require-final-newline) |
59239
a88429b12685
(c-common-init): Use mode-require-final-newline.
Richard M. Stallman <rms@gnu.org>
parents:
58747
diff
changeset
|
629 (and (cdr rfn) |
a88429b12685
(c-common-init): Use mode-require-final-newline.
Richard M. Stallman <rms@gnu.org>
parents:
58747
diff
changeset
|
630 (setq require-final-newline mode-require-final-newline))))) |
36920 | 631 |
632 (defun c-postprocess-file-styles () | |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
633 "Function that post processes relevant file local variables in CC Mode. |
36920 | 634 Currently, this function simply applies any style and offset settings |
635 found in the file's Local Variable list. It first applies any style | |
636 setting found in `c-file-style', then it applies any offset settings | |
637 it finds in `c-file-offsets'. | |
638 | |
639 Note that the style variables are always made local to the buffer." | |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
640 |
36920 | 641 ;; apply file styles and offsets |
45632
9d60ac21968f
(c-postprocess-file-styles): Do nothing except in CC modes.
Richard M. Stallman <rms@gnu.org>
parents:
44728
diff
changeset
|
642 (when c-buffer-is-cc-mode |
9d60ac21968f
(c-postprocess-file-styles): Do nothing except in CC modes.
Richard M. Stallman <rms@gnu.org>
parents:
44728
diff
changeset
|
643 (if (or c-file-style c-file-offsets) |
9d60ac21968f
(c-postprocess-file-styles): Do nothing except in CC modes.
Richard M. Stallman <rms@gnu.org>
parents:
44728
diff
changeset
|
644 (c-make-styles-buffer-local t)) |
9d60ac21968f
(c-postprocess-file-styles): Do nothing except in CC modes.
Richard M. Stallman <rms@gnu.org>
parents:
44728
diff
changeset
|
645 (and c-file-style |
9d60ac21968f
(c-postprocess-file-styles): Do nothing except in CC modes.
Richard M. Stallman <rms@gnu.org>
parents:
44728
diff
changeset
|
646 (c-set-style c-file-style)) |
9d60ac21968f
(c-postprocess-file-styles): Do nothing except in CC modes.
Richard M. Stallman <rms@gnu.org>
parents:
44728
diff
changeset
|
647 (and c-file-offsets |
9d60ac21968f
(c-postprocess-file-styles): Do nothing except in CC modes.
Richard M. Stallman <rms@gnu.org>
parents:
44728
diff
changeset
|
648 (mapcar |
9d60ac21968f
(c-postprocess-file-styles): Do nothing except in CC modes.
Richard M. Stallman <rms@gnu.org>
parents:
44728
diff
changeset
|
649 (lambda (langentry) |
9d60ac21968f
(c-postprocess-file-styles): Do nothing except in CC modes.
Richard M. Stallman <rms@gnu.org>
parents:
44728
diff
changeset
|
650 (let ((langelem (car langentry)) |
9d60ac21968f
(c-postprocess-file-styles): Do nothing except in CC modes.
Richard M. Stallman <rms@gnu.org>
parents:
44728
diff
changeset
|
651 (offset (cdr langentry))) |
9d60ac21968f
(c-postprocess-file-styles): Do nothing except in CC modes.
Richard M. Stallman <rms@gnu.org>
parents:
44728
diff
changeset
|
652 (c-set-offset langelem offset))) |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
653 c-file-offsets)) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
654 ;; Problem: The file local variable block might have explicitly set a |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
655 ;; style variable. The `c-set-style' or `mapcar' call might have |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
656 ;; overwritten this. So we run `hack-local-variables' again to remedy |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
657 ;; this. There are no guarantees this will work properly, particularly as |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
658 ;; we have no control over what the other hook functions on |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
659 ;; `hack-local-variables-hook' would have done, or what any "eval" |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
660 ;; expression will do when evaluated again. C'est la vie! ACM, |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
661 ;; 2005/11/2. |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
662 (if (or c-file-style c-file-offsets) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
663 (let ((hack-local-variables-hook nil)) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
664 (hack-local-variables))))) |
36920 | 665 |
666 (add-hook 'hack-local-variables-hook 'c-postprocess-file-styles) | |
667 | |
62641
27b53b1903b6
2005-05-23 Martin Stjernholm <bug-cc-mode@gnu.org>
Martin Stjernholm <mast@lysator.liu.se>
parents:
62046
diff
changeset
|
668 (defmacro c-run-mode-hooks (&rest hooks) |
27b53b1903b6
2005-05-23 Martin Stjernholm <bug-cc-mode@gnu.org>
Martin Stjernholm <mast@lysator.liu.se>
parents:
62046
diff
changeset
|
669 ;; Emacs 21.1 has introduced a system with delayed mode hooks that |
27b53b1903b6
2005-05-23 Martin Stjernholm <bug-cc-mode@gnu.org>
Martin Stjernholm <mast@lysator.liu.se>
parents:
62046
diff
changeset
|
670 ;; require the use of the new function `run-mode-hooks'. |
27b53b1903b6
2005-05-23 Martin Stjernholm <bug-cc-mode@gnu.org>
Martin Stjernholm <mast@lysator.liu.se>
parents:
62046
diff
changeset
|
671 (if (cc-bytecomp-fboundp 'run-mode-hooks) |
27b53b1903b6
2005-05-23 Martin Stjernholm <bug-cc-mode@gnu.org>
Martin Stjernholm <mast@lysator.liu.se>
parents:
62046
diff
changeset
|
672 `(run-mode-hooks ,@hooks) |
27b53b1903b6
2005-05-23 Martin Stjernholm <bug-cc-mode@gnu.org>
Martin Stjernholm <mast@lysator.liu.se>
parents:
62046
diff
changeset
|
673 `(progn ,@(mapcar (lambda (hook) `(run-hooks ,hook)) hooks)))) |
27b53b1903b6
2005-05-23 Martin Stjernholm <bug-cc-mode@gnu.org>
Martin Stjernholm <mast@lysator.liu.se>
parents:
62046
diff
changeset
|
674 |
36920 | 675 |
676 ;; Support for C | |
677 | |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
678 ;;;###autoload |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
679 (defvar c-mode-syntax-table nil |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
680 "Syntax table used in c-mode buffers.") |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
681 (or c-mode-syntax-table |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
682 (setq c-mode-syntax-table |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
683 (funcall (c-lang-const c-make-mode-syntax-table c)))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
684 |
36920 | 685 (defvar c-mode-abbrev-table nil |
686 "Abbreviation table used in c-mode buffers.") | |
44728
7a3ac6c387fe
CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents:
42390
diff
changeset
|
687 (c-define-abbrev-table 'c-mode-abbrev-table |
7a3ac6c387fe
CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents:
42390
diff
changeset
|
688 '(("else" "else" c-electric-continued-statement 0) |
7a3ac6c387fe
CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents:
42390
diff
changeset
|
689 ("while" "while" c-electric-continued-statement 0))) |
36920 | 690 |
691 (defvar c-mode-map () | |
692 "Keymap used in c-mode buffers.") | |
693 (if c-mode-map | |
694 nil | |
695 (setq c-mode-map (c-make-inherited-keymap)) | |
696 ;; add bindings which are only useful for C | |
697 (define-key c-mode-map "\C-c\C-e" 'c-macro-expand) | |
698 ) | |
699 | |
700 (easy-menu-define c-c-menu c-mode-map "C Mode Commands" | |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
701 (cons "C" (c-lang-const c-mode-menu c))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
702 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
703 ;; In XEmacs >= 21.5 modes should add their own entries to |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
704 ;; `auto-mode-alist'. The comment form of autoload is used to avoid |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
705 ;; doing this on load. That since `add-to-list' prepends the value |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
706 ;; which could cause it to clobber user settings. Later emacsen have |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
707 ;; an append option, but it's not safe to use. |
51747
b4fb79bf98ba
Fixed some autoload problems: Try to ensure that the entry for ".c"
Martin Stjernholm <mast@lysator.liu.se>
parents:
51714
diff
changeset
|
708 |
b4fb79bf98ba
Fixed some autoload problems: Try to ensure that the entry for ".c"
Martin Stjernholm <mast@lysator.liu.se>
parents:
51714
diff
changeset
|
709 ;; The the extension ".C" is associated to C++ while the lowercase |
b4fb79bf98ba
Fixed some autoload problems: Try to ensure that the entry for ".c"
Martin Stjernholm <mast@lysator.liu.se>
parents:
51714
diff
changeset
|
710 ;; variant goes to C. On case insensitive file systems, this means |
b4fb79bf98ba
Fixed some autoload problems: Try to ensure that the entry for ".c"
Martin Stjernholm <mast@lysator.liu.se>
parents:
51714
diff
changeset
|
711 ;; that ".c" files also might open C++ mode if the C++ entry comes |
b4fb79bf98ba
Fixed some autoload problems: Try to ensure that the entry for ".c"
Martin Stjernholm <mast@lysator.liu.se>
parents:
51714
diff
changeset
|
712 ;; first on `auto-mode-alist'. Thus we try to ensure that ".C" comes |
b4fb79bf98ba
Fixed some autoload problems: Try to ensure that the entry for ".c"
Martin Stjernholm <mast@lysator.liu.se>
parents:
51714
diff
changeset
|
713 ;; after ".c", and since `add-to-list' adds the entry first we have to |
b4fb79bf98ba
Fixed some autoload problems: Try to ensure that the entry for ".c"
Martin Stjernholm <mast@lysator.liu.se>
parents:
51714
diff
changeset
|
714 ;; add the ".C" entry first. |
b4fb79bf98ba
Fixed some autoload problems: Try to ensure that the entry for ".c"
Martin Stjernholm <mast@lysator.liu.se>
parents:
51714
diff
changeset
|
715 ;;;###autoload (add-to-list 'auto-mode-alist '("\\.\\(cc\\|hh\\)\\'" . c++-mode)) |
b4fb79bf98ba
Fixed some autoload problems: Try to ensure that the entry for ".c"
Martin Stjernholm <mast@lysator.liu.se>
parents:
51714
diff
changeset
|
716 ;;;###autoload (add-to-list 'auto-mode-alist '("\\.[ch]\\(pp\\|xx\\|\\+\\+\\)\\'" . c++-mode)) |
b4fb79bf98ba
Fixed some autoload problems: Try to ensure that the entry for ".c"
Martin Stjernholm <mast@lysator.liu.se>
parents:
51714
diff
changeset
|
717 ;;;###autoload (add-to-list 'auto-mode-alist '("\\.\\(CC?\\|HH?\\)\\'" . c++-mode)) |
b4fb79bf98ba
Fixed some autoload problems: Try to ensure that the entry for ".c"
Martin Stjernholm <mast@lysator.liu.se>
parents:
51714
diff
changeset
|
718 |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
719 ;;;###autoload (add-to-list 'auto-mode-alist '("\\.[ch]\\'" . c-mode)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
720 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
721 ;; NB: The following two associate yacc and lex files to C Mode, which |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
722 ;; is not really suitable for those formats. Anyway, afaik there's |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
723 ;; currently no better mode for them, and besides this is legacy. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
724 ;;;###autoload (add-to-list 'auto-mode-alist '("\\.y\\(acc\\)?\\'" . c-mode)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
725 ;;;###autoload (add-to-list 'auto-mode-alist '("\\.lex\\'" . c-mode)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
726 |
18720 | 727 ;;;###autoload |
728 (defun c-mode () | |
729 "Major mode for editing K&R and ANSI C code. | |
730 To submit a problem report, enter `\\[c-submit-bug-report]' from a | |
731 c-mode buffer. This automatically sets up a mail buffer with version | |
732 information already added. You just need to add a description of the | |
51747
b4fb79bf98ba
Fixed some autoload problems: Try to ensure that the entry for ".c"
Martin Stjernholm <mast@lysator.liu.se>
parents:
51714
diff
changeset
|
733 problem, including a reproducible test case, and send the message. |
18720 | 734 |
735 To see what version of CC Mode you are running, enter `\\[c-version]'. | |
736 | |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
737 The hook `c-mode-common-hook' is run with no args at mode |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
738 initialization, then `c-mode-hook'. |
18720 | 739 |
740 Key bindings: | |
741 \\{c-mode-map}" | |
742 (interactive) | |
44728
7a3ac6c387fe
CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents:
42390
diff
changeset
|
743 (kill-all-local-variables) |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
744 (c-initialize-cc-mode t) |
18720 | 745 (set-syntax-table c-mode-syntax-table) |
746 (setq major-mode 'c-mode | |
747 mode-name "C" | |
36920 | 748 local-abbrev-table c-mode-abbrev-table |
749 abbrev-mode t) | |
18720 | 750 (use-local-map c-mode-map) |
52108
5a4fdabed57e
2003-08-03 Martin Stjernholm <bug-cc-mode@gnu.org>
Martin Stjernholm <mast@lysator.liu.se>
parents:
51747
diff
changeset
|
751 (c-init-language-vars-for 'c-mode) |
44728
7a3ac6c387fe
CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents:
42390
diff
changeset
|
752 (c-common-init 'c-mode) |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
753 (easy-menu-add c-c-menu) |
26817 | 754 (cc-imenu-init cc-imenu-c-generic-expression) |
62641
27b53b1903b6
2005-05-23 Martin Stjernholm <bug-cc-mode@gnu.org>
Martin Stjernholm <mast@lysator.liu.se>
parents:
62046
diff
changeset
|
755 (c-run-mode-hooks 'c-mode-common-hook 'c-mode-hook) |
18720 | 756 (c-update-modeline)) |
757 | |
758 | |
36920 | 759 ;; Support for C++ |
760 | |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
761 ;;;###autoload |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
762 (defvar c++-mode-syntax-table nil |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
763 "Syntax table used in c++-mode buffers.") |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
764 (or c++-mode-syntax-table |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
765 (setq c++-mode-syntax-table |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
766 (funcall (c-lang-const c-make-mode-syntax-table c++)))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
767 |
36920 | 768 (defvar c++-mode-abbrev-table nil |
769 "Abbreviation table used in c++-mode buffers.") | |
44728
7a3ac6c387fe
CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents:
42390
diff
changeset
|
770 (c-define-abbrev-table 'c++-mode-abbrev-table |
7a3ac6c387fe
CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents:
42390
diff
changeset
|
771 '(("else" "else" c-electric-continued-statement 0) |
7a3ac6c387fe
CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents:
42390
diff
changeset
|
772 ("while" "while" c-electric-continued-statement 0) |
7a3ac6c387fe
CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents:
42390
diff
changeset
|
773 ("catch" "catch" c-electric-continued-statement 0))) |
36920 | 774 |
775 (defvar c++-mode-map () | |
776 "Keymap used in c++-mode buffers.") | |
777 (if c++-mode-map | |
778 nil | |
779 (setq c++-mode-map (c-make-inherited-keymap)) | |
780 ;; add bindings which are only useful for C++ | |
781 (define-key c++-mode-map "\C-c\C-e" 'c-macro-expand) | |
782 (define-key c++-mode-map "\C-c:" 'c-scope-operator) | |
783 (define-key c++-mode-map "<" 'c-electric-lt-gt) | |
784 (define-key c++-mode-map ">" 'c-electric-lt-gt)) | |
785 | |
786 (easy-menu-define c-c++-menu c++-mode-map "C++ Mode Commands" | |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
787 (cons "C++" (c-lang-const c-mode-menu c++))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
788 |
18720 | 789 ;;;###autoload |
790 (defun c++-mode () | |
791 "Major mode for editing C++ code. | |
792 To submit a problem report, enter `\\[c-submit-bug-report]' from a | |
793 c++-mode buffer. This automatically sets up a mail buffer with | |
794 version information already added. You just need to add a description | |
795 of the problem, including a reproducible test case, and send the | |
796 message. | |
797 | |
798 To see what version of CC Mode you are running, enter `\\[c-version]'. | |
799 | |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
800 The hook `c-mode-common-hook' is run with no args at mode |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
801 initialization, then `c++-mode-hook'. |
18720 | 802 |
803 Key bindings: | |
804 \\{c++-mode-map}" | |
805 (interactive) | |
44728
7a3ac6c387fe
CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents:
42390
diff
changeset
|
806 (kill-all-local-variables) |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
807 (c-initialize-cc-mode t) |
18720 | 808 (set-syntax-table c++-mode-syntax-table) |
809 (setq major-mode 'c++-mode | |
810 mode-name "C++" | |
36920 | 811 local-abbrev-table c++-mode-abbrev-table |
812 abbrev-mode t) | |
18720 | 813 (use-local-map c++-mode-map) |
52108
5a4fdabed57e
2003-08-03 Martin Stjernholm <bug-cc-mode@gnu.org>
Martin Stjernholm <mast@lysator.liu.se>
parents:
51747
diff
changeset
|
814 (c-init-language-vars-for 'c++-mode) |
44728
7a3ac6c387fe
CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents:
42390
diff
changeset
|
815 (c-common-init 'c++-mode) |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
816 (easy-menu-add c-c++-menu) |
26817 | 817 (cc-imenu-init cc-imenu-c++-generic-expression) |
62641
27b53b1903b6
2005-05-23 Martin Stjernholm <bug-cc-mode@gnu.org>
Martin Stjernholm <mast@lysator.liu.se>
parents:
62046
diff
changeset
|
818 (c-run-mode-hooks 'c-mode-common-hook 'c++-mode-hook) |
18720 | 819 (c-update-modeline)) |
820 | |
821 | |
36920 | 822 ;; Support for Objective-C |
823 | |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
824 ;;;###autoload |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
825 (defvar objc-mode-syntax-table nil |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
826 "Syntax table used in objc-mode buffers.") |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
827 (or objc-mode-syntax-table |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
828 (setq objc-mode-syntax-table |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
829 (funcall (c-lang-const c-make-mode-syntax-table objc)))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
830 |
36920 | 831 (defvar objc-mode-abbrev-table nil |
832 "Abbreviation table used in objc-mode buffers.") | |
44728
7a3ac6c387fe
CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents:
42390
diff
changeset
|
833 (c-define-abbrev-table 'objc-mode-abbrev-table |
7a3ac6c387fe
CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents:
42390
diff
changeset
|
834 '(("else" "else" c-electric-continued-statement 0) |
7a3ac6c387fe
CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents:
42390
diff
changeset
|
835 ("while" "while" c-electric-continued-statement 0))) |
36920 | 836 |
837 (defvar objc-mode-map () | |
838 "Keymap used in objc-mode buffers.") | |
839 (if objc-mode-map | |
840 nil | |
841 (setq objc-mode-map (c-make-inherited-keymap)) | |
842 ;; add bindings which are only useful for Objective-C | |
843 (define-key objc-mode-map "\C-c\C-e" 'c-macro-expand)) | |
844 | |
845 (easy-menu-define c-objc-menu objc-mode-map "ObjC Mode Commands" | |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
846 (cons "ObjC" (c-lang-const c-mode-menu objc))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
847 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
848 ;;;###autoload (add-to-list 'auto-mode-alist '("\\.m\\'" . objc-mode)) |
36920 | 849 |
18720 | 850 ;;;###autoload |
851 (defun objc-mode () | |
852 "Major mode for editing Objective C code. | |
853 To submit a problem report, enter `\\[c-submit-bug-report]' from an | |
854 objc-mode buffer. This automatically sets up a mail buffer with | |
855 version information already added. You just need to add a description | |
856 of the problem, including a reproducible test case, and send the | |
857 message. | |
858 | |
859 To see what version of CC Mode you are running, enter `\\[c-version]'. | |
860 | |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
861 The hook `c-mode-common-hook' is run with no args at mode |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
862 initialization, then `objc-mode-hook'. |
18720 | 863 |
864 Key bindings: | |
865 \\{objc-mode-map}" | |
866 (interactive) | |
44728
7a3ac6c387fe
CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents:
42390
diff
changeset
|
867 (kill-all-local-variables) |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
868 (c-initialize-cc-mode t) |
18720 | 869 (set-syntax-table objc-mode-syntax-table) |
870 (setq major-mode 'objc-mode | |
871 mode-name "ObjC" | |
36920 | 872 local-abbrev-table objc-mode-abbrev-table |
873 abbrev-mode t) | |
18720 | 874 (use-local-map objc-mode-map) |
52108
5a4fdabed57e
2003-08-03 Martin Stjernholm <bug-cc-mode@gnu.org>
Martin Stjernholm <mast@lysator.liu.se>
parents:
51747
diff
changeset
|
875 (c-init-language-vars-for 'objc-mode) |
44728
7a3ac6c387fe
CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents:
42390
diff
changeset
|
876 (c-common-init 'objc-mode) |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
877 (easy-menu-add c-objc-menu) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
878 (cc-imenu-init nil 'cc-imenu-objc-function) |
62641
27b53b1903b6
2005-05-23 Martin Stjernholm <bug-cc-mode@gnu.org>
Martin Stjernholm <mast@lysator.liu.se>
parents:
62046
diff
changeset
|
879 (c-run-mode-hooks 'c-mode-common-hook 'objc-mode-hook) |
18720 | 880 (c-update-modeline)) |
881 | |
882 | |
36920 | 883 ;; Support for Java |
884 | |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
885 ;;;###autoload |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
886 (defvar java-mode-syntax-table nil |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
887 "Syntax table used in java-mode buffers.") |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
888 (or java-mode-syntax-table |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
889 (setq java-mode-syntax-table |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
890 (funcall (c-lang-const c-make-mode-syntax-table java)))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
891 |
36920 | 892 (defvar java-mode-abbrev-table nil |
893 "Abbreviation table used in java-mode buffers.") | |
44728
7a3ac6c387fe
CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents:
42390
diff
changeset
|
894 (c-define-abbrev-table 'java-mode-abbrev-table |
7a3ac6c387fe
CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents:
42390
diff
changeset
|
895 '(("else" "else" c-electric-continued-statement 0) |
7a3ac6c387fe
CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents:
42390
diff
changeset
|
896 ("while" "while" c-electric-continued-statement 0) |
7a3ac6c387fe
CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents:
42390
diff
changeset
|
897 ("catch" "catch" c-electric-continued-statement 0) |
7a3ac6c387fe
CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents:
42390
diff
changeset
|
898 ("finally" "finally" c-electric-continued-statement 0))) |
36920 | 899 |
900 (defvar java-mode-map () | |
901 "Keymap used in java-mode buffers.") | |
902 (if java-mode-map | |
903 nil | |
904 (setq java-mode-map (c-make-inherited-keymap)) | |
905 ;; add bindings which are only useful for Java | |
906 ) | |
907 | |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
908 ;; Regexp trying to describe the beginning of a Java top-level |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
909 ;; definition. This is not used by CC Mode, nor is it maintained |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
910 ;; since it's practically impossible to write a regexp that reliably |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
911 ;; matches such a construct. Other tools are necessary. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
912 (defconst c-Java-defun-prompt-regexp |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
913 "^[ \t]*\\(\\(\\(public\\|protected\\|private\\|const\\|abstract\\|synchronized\\|final\\|static\\|threadsafe\\|transient\\|native\\|volatile\\)\\s-+\\)*\\(\\(\\([[a-zA-Z][][_$.a-zA-Z0-9]*[][_$.a-zA-Z0-9]+\\|[[a-zA-Z]\\)\\s-*\\)\\s-+\\)\\)?\\(\\([[a-zA-Z][][_$.a-zA-Z0-9]*\\s-+\\)\\s-*\\)?\\([_a-zA-Z][^][ \t:;.,{}()=]*\\|\\([_$a-zA-Z][_$.a-zA-Z0-9]*\\)\\)\\s-*\\(([^);{}]*)\\)?\\([] \t]*\\)\\(\\s-*\\<throws\\>\\s-*\\(\\([_$a-zA-Z][_$.a-zA-Z0-9]*\\)[, \t\n\r\f\v]*\\)+\\)?\\s-*") |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
914 |
36920 | 915 (easy-menu-define c-java-menu java-mode-map "Java Mode Commands" |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
916 (cons "Java" (c-lang-const c-mode-menu java))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
917 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
918 ;;;###autoload (add-to-list 'auto-mode-alist '("\\.java\\'" . java-mode)) |
36920 | 919 |
18720 | 920 ;;;###autoload |
921 (defun java-mode () | |
922 "Major mode for editing Java code. | |
20135
ecb78a6ccd8d
(objc-mode): Bind imenu-create-index-function
Karl Heuer <kwzh@gnu.org>
parents:
19808
diff
changeset
|
923 To submit a problem report, enter `\\[c-submit-bug-report]' from a |
18720 | 924 java-mode buffer. This automatically sets up a mail buffer with |
925 version information already added. You just need to add a description | |
51747
b4fb79bf98ba
Fixed some autoload problems: Try to ensure that the entry for ".c"
Martin Stjernholm <mast@lysator.liu.se>
parents:
51714
diff
changeset
|
926 of the problem, including a reproducible test case, and send the |
18720 | 927 message. |
928 | |
929 To see what version of CC Mode you are running, enter `\\[c-version]'. | |
930 | |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
931 The hook `c-mode-common-hook' is run with no args at mode |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
932 initialization, then `java-mode-hook'. |
18720 | 933 |
934 Key bindings: | |
935 \\{java-mode-map}" | |
936 (interactive) | |
44728
7a3ac6c387fe
CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents:
42390
diff
changeset
|
937 (kill-all-local-variables) |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
938 (c-initialize-cc-mode t) |
18720 | 939 (set-syntax-table java-mode-syntax-table) |
940 (setq major-mode 'java-mode | |
941 mode-name "Java" | |
30401
b85ee58b24ec
(c-initialize-cc-mode): Handling of obsolete
Gerd Moellmann <gerd@gnu.org>
parents:
26817
diff
changeset
|
942 local-abbrev-table java-mode-abbrev-table |
44728
7a3ac6c387fe
CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents:
42390
diff
changeset
|
943 abbrev-mode t) |
18720 | 944 (use-local-map java-mode-map) |
52108
5a4fdabed57e
2003-08-03 Martin Stjernholm <bug-cc-mode@gnu.org>
Martin Stjernholm <mast@lysator.liu.se>
parents:
51747
diff
changeset
|
945 (c-init-language-vars-for 'java-mode) |
44728
7a3ac6c387fe
CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents:
42390
diff
changeset
|
946 (c-common-init 'java-mode) |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
947 (easy-menu-add c-java-menu) |
26817 | 948 (cc-imenu-init cc-imenu-java-generic-expression) |
62641
27b53b1903b6
2005-05-23 Martin Stjernholm <bug-cc-mode@gnu.org>
Martin Stjernholm <mast@lysator.liu.se>
parents:
62046
diff
changeset
|
949 (c-run-mode-hooks 'c-mode-common-hook 'java-mode-hook) |
18720 | 950 (c-update-modeline)) |
951 | |
952 | |
36920 | 953 ;; Support for CORBA's IDL language |
954 | |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
955 ;;;###autoload |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
956 (defvar idl-mode-syntax-table nil |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
957 "Syntax table used in idl-mode buffers.") |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
958 (or idl-mode-syntax-table |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
959 (setq idl-mode-syntax-table |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
960 (funcall (c-lang-const c-make-mode-syntax-table idl)))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
961 |
36920 | 962 (defvar idl-mode-abbrev-table nil |
963 "Abbreviation table used in idl-mode buffers.") | |
44728
7a3ac6c387fe
CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents:
42390
diff
changeset
|
964 (c-define-abbrev-table 'idl-mode-abbrev-table nil) |
36920 | 965 |
966 (defvar idl-mode-map () | |
967 "Keymap used in idl-mode buffers.") | |
968 (if idl-mode-map | |
969 nil | |
970 (setq idl-mode-map (c-make-inherited-keymap)) | |
971 ;; add bindings which are only useful for IDL | |
972 ) | |
973 | |
974 (easy-menu-define c-idl-menu idl-mode-map "IDL Mode Commands" | |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
975 (cons "IDL" (c-lang-const c-mode-menu idl))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
976 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
977 ;;;###autoload (add-to-list 'auto-mode-alist '("\\.idl\\'" . idl-mode)) |
36920 | 978 |
19253
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
979 ;;;###autoload |
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
980 (defun idl-mode () |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
981 "Major mode for editing CORBA's IDL, PSDL and CIDL code. |
19253
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
982 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
|
983 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
|
984 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
|
985 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
|
986 message. |
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
987 |
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
988 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
|
989 |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
990 The hook `c-mode-common-hook' is run with no args at mode |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
991 initialization, then `idl-mode-hook'. |
19253
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
992 |
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
993 Key bindings: |
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
994 \\{idl-mode-map}" |
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
995 (interactive) |
44728
7a3ac6c387fe
CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents:
42390
diff
changeset
|
996 (kill-all-local-variables) |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
997 (c-initialize-cc-mode t) |
19253
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
998 (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
|
999 (setq major-mode 'idl-mode |
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
1000 mode-name "IDL" |
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
1001 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
|
1002 (use-local-map idl-mode-map) |
52108
5a4fdabed57e
2003-08-03 Martin Stjernholm <bug-cc-mode@gnu.org>
Martin Stjernholm <mast@lysator.liu.se>
parents:
51747
diff
changeset
|
1003 (c-init-language-vars-for 'idl-mode) |
44728
7a3ac6c387fe
CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents:
42390
diff
changeset
|
1004 (c-common-init 'idl-mode) |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1005 (easy-menu-add c-idl-menu) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1006 ;;(cc-imenu-init cc-imenu-idl-generic-expression) ;TODO |
62641
27b53b1903b6
2005-05-23 Martin Stjernholm <bug-cc-mode@gnu.org>
Martin Stjernholm <mast@lysator.liu.se>
parents:
62046
diff
changeset
|
1007 (c-run-mode-hooks 'c-mode-common-hook 'idl-mode-hook) |
19253
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
1008 (c-update-modeline)) |
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
1009 |
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
1010 |
36920 | 1011 ;; Support for Pike |
1012 | |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1013 ;;;###autoload |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1014 (defvar pike-mode-syntax-table nil |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1015 "Syntax table used in pike-mode buffers.") |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1016 (or pike-mode-syntax-table |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1017 (setq pike-mode-syntax-table |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1018 (funcall (c-lang-const c-make-mode-syntax-table pike)))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1019 |
36920 | 1020 (defvar pike-mode-abbrev-table nil |
1021 "Abbreviation table used in pike-mode buffers.") | |
44728
7a3ac6c387fe
CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents:
42390
diff
changeset
|
1022 (c-define-abbrev-table 'pike-mode-abbrev-table |
7a3ac6c387fe
CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents:
42390
diff
changeset
|
1023 '(("else" "else" c-electric-continued-statement 0) |
7a3ac6c387fe
CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents:
42390
diff
changeset
|
1024 ("while" "while" c-electric-continued-statement 0))) |
36920 | 1025 |
1026 (defvar pike-mode-map () | |
1027 "Keymap used in pike-mode buffers.") | |
1028 (if pike-mode-map | |
1029 nil | |
1030 (setq pike-mode-map (c-make-inherited-keymap)) | |
1031 ;; additional bindings | |
1032 (define-key pike-mode-map "\C-c\C-e" 'c-macro-expand)) | |
1033 | |
1034 (easy-menu-define c-pike-menu pike-mode-map "Pike Mode Commands" | |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1035 (cons "Pike" (c-lang-const c-mode-menu pike))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1036 |
51747
b4fb79bf98ba
Fixed some autoload problems: Try to ensure that the entry for ".c"
Martin Stjernholm <mast@lysator.liu.se>
parents:
51714
diff
changeset
|
1037 ;;;###autoload (add-to-list 'auto-mode-alist '("\\.\\(u?lpc\\|pike\\|pmod\\(.in\\)?\\)\\'" . pike-mode)) |
b4fb79bf98ba
Fixed some autoload problems: Try to ensure that the entry for ".c"
Martin Stjernholm <mast@lysator.liu.se>
parents:
51714
diff
changeset
|
1038 ;;;###autoload (add-to-list 'interpreter-mode-alist '("pike" . pike-mode)) |
36920 | 1039 |
24282 | 1040 ;;;###autoload |
1041 (defun pike-mode () | |
1042 "Major mode for editing Pike code. | |
44728
7a3ac6c387fe
CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents:
42390
diff
changeset
|
1043 To submit a problem report, enter `\\[c-submit-bug-report]' from a |
7a3ac6c387fe
CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents:
42390
diff
changeset
|
1044 pike-mode buffer. This automatically sets up a mail buffer with |
24282 | 1045 version information already added. You just need to add a description |
1046 of the problem, including a reproducible test case, and send the | |
1047 message. | |
1048 | |
1049 To see what version of CC Mode you are running, enter `\\[c-version]'. | |
1050 | |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1051 The hook `c-mode-common-hook' is run with no args at mode |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1052 initialization, then `pike-mode-hook'. |
24282 | 1053 |
1054 Key bindings: | |
1055 \\{pike-mode-map}" | |
1056 (interactive) | |
44728
7a3ac6c387fe
CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents:
42390
diff
changeset
|
1057 (kill-all-local-variables) |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1058 (c-initialize-cc-mode t) |
24282 | 1059 (set-syntax-table pike-mode-syntax-table) |
1060 (setq major-mode 'pike-mode | |
1061 mode-name "Pike" | |
36920 | 1062 local-abbrev-table pike-mode-abbrev-table |
44728
7a3ac6c387fe
CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents:
42390
diff
changeset
|
1063 abbrev-mode t) |
24282 | 1064 (use-local-map pike-mode-map) |
52108
5a4fdabed57e
2003-08-03 Martin Stjernholm <bug-cc-mode@gnu.org>
Martin Stjernholm <mast@lysator.liu.se>
parents:
51747
diff
changeset
|
1065 (c-init-language-vars-for 'pike-mode) |
44728
7a3ac6c387fe
CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents:
42390
diff
changeset
|
1066 (c-common-init 'pike-mode) |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1067 (easy-menu-add c-pike-menu) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1068 ;;(cc-imenu-init cc-imenu-pike-generic-expression) ;TODO |
62641
27b53b1903b6
2005-05-23 Martin Stjernholm <bug-cc-mode@gnu.org>
Martin Stjernholm <mast@lysator.liu.se>
parents:
62046
diff
changeset
|
1069 (c-run-mode-hooks 'c-mode-common-hook 'pike-mode-hook) |
24282 | 1070 (c-update-modeline)) |
1071 | |
1072 | |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
1073 ;; Support for AWK |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1074 |
51747
b4fb79bf98ba
Fixed some autoload problems: Try to ensure that the entry for ".c"
Martin Stjernholm <mast@lysator.liu.se>
parents:
51714
diff
changeset
|
1075 ;;;###autoload (add-to-list 'auto-mode-alist '("\\.awk\\'" . awk-mode)) |
b4fb79bf98ba
Fixed some autoload problems: Try to ensure that the entry for ".c"
Martin Stjernholm <mast@lysator.liu.se>
parents:
51714
diff
changeset
|
1076 ;;;###autoload (add-to-list 'interpreter-mode-alist '("awk" . awk-mode)) |
b4fb79bf98ba
Fixed some autoload problems: Try to ensure that the entry for ".c"
Martin Stjernholm <mast@lysator.liu.se>
parents:
51714
diff
changeset
|
1077 ;;;###autoload (add-to-list 'interpreter-mode-alist '("mawk" . awk-mode)) |
b4fb79bf98ba
Fixed some autoload problems: Try to ensure that the entry for ".c"
Martin Stjernholm <mast@lysator.liu.se>
parents:
51714
diff
changeset
|
1078 ;;;###autoload (add-to-list 'interpreter-mode-alist '("nawk" . awk-mode)) |
b4fb79bf98ba
Fixed some autoload problems: Try to ensure that the entry for ".c"
Martin Stjernholm <mast@lysator.liu.se>
parents:
51714
diff
changeset
|
1079 ;;;###autoload (add-to-list 'interpreter-mode-alist '("gawk" . awk-mode)) |
b4fb79bf98ba
Fixed some autoload problems: Try to ensure that the entry for ".c"
Martin Stjernholm <mast@lysator.liu.se>
parents:
51714
diff
changeset
|
1080 |
b4fb79bf98ba
Fixed some autoload problems: Try to ensure that the entry for ".c"
Martin Stjernholm <mast@lysator.liu.se>
parents:
51714
diff
changeset
|
1081 ;;; Autoload directives must be on the top level, so we construct an |
b4fb79bf98ba
Fixed some autoload problems: Try to ensure that the entry for ".c"
Martin Stjernholm <mast@lysator.liu.se>
parents:
51714
diff
changeset
|
1082 ;;; autoload form instead. |
58747
e3dfd80003ea
(awk-mode autoload): Supply t meaning interactive function.
Richard M. Stallman <rms@gnu.org>
parents:
58198
diff
changeset
|
1083 ;;;###autoload (autoload 'awk-mode "cc-mode" "Major mode for editing AWK code." t) |
51747
b4fb79bf98ba
Fixed some autoload problems: Try to ensure that the entry for ".c"
Martin Stjernholm <mast@lysator.liu.se>
parents:
51714
diff
changeset
|
1084 |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
1085 (defvar awk-mode-abbrev-table nil |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
1086 "Abbreviation table used in awk-mode buffers.") |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
1087 (c-define-abbrev-table 'awk-mode-abbrev-table |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
1088 '(("else" "else" c-electric-continued-statement 0) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
1089 ("while" "while" c-electric-continued-statement 0))) |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1090 |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
1091 (defvar awk-mode-map () |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
1092 "Keymap used in awk-mode buffers.") |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
1093 (if awk-mode-map |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
1094 nil |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
1095 (setq awk-mode-map (c-make-inherited-keymap)) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
1096 ;; add bindings which are only useful for awk. |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
1097 (define-key awk-mode-map "#" 'self-insert-command) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
1098 (define-key awk-mode-map "/" 'self-insert-command) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
1099 (define-key awk-mode-map "*" 'self-insert-command) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
1100 (define-key awk-mode-map "\C-c\C-n" 'undefined) ; #if doesn't exist in awk. |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
1101 (define-key awk-mode-map "\C-c\C-p" 'undefined) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
1102 (define-key awk-mode-map "\C-c\C-u" 'undefined) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
1103 (define-key awk-mode-map "\M-a" 'c-beginning-of-statement) ; 2003/10/7 |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
1104 (define-key awk-mode-map "\M-e" 'c-end-of-statement) ; 2003/10/7 |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
1105 (define-key awk-mode-map "\C-\M-a" 'c-awk-beginning-of-defun) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
1106 (define-key awk-mode-map "\C-\M-e" 'c-awk-end-of-defun)) |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1107 |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
1108 (easy-menu-define c-awk-menu awk-mode-map "AWK Mode Commands" |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
1109 (cons "AWK" (c-lang-const c-mode-menu awk))) |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1110 |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
1111 (defun awk-mode () |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
1112 "Major mode for editing AWK code. |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1113 To submit a problem report, enter `\\[c-submit-bug-report]' from an |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1114 awk-mode buffer. This automatically sets up a mail buffer with version |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1115 information already added. You just need to add a description of the |
51747
b4fb79bf98ba
Fixed some autoload problems: Try to ensure that the entry for ".c"
Martin Stjernholm <mast@lysator.liu.se>
parents:
51714
diff
changeset
|
1116 problem, including a reproducible test case, and send the message. |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1117 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1118 To see what version of CC Mode you are running, enter `\\[c-version]'. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1119 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1120 The hook `c-mode-common-hook' is run with no args at mode |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1121 initialization, then `awk-mode-hook'. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1122 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1123 Key bindings: |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1124 \\{awk-mode-map}" |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
1125 (interactive) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
1126 (require 'cc-awk) ; Added 2003/6/10. |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
1127 (kill-all-local-variables) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
1128 (c-initialize-cc-mode t) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
1129 (set-syntax-table awk-mode-syntax-table) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
1130 (setq major-mode 'awk-mode |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
1131 mode-name "AWK" |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
1132 local-abbrev-table awk-mode-abbrev-table |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
1133 abbrev-mode t) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
1134 (use-local-map awk-mode-map) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
1135 (c-init-language-vars-for 'awk-mode) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
1136 (c-common-init 'awk-mode) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
1137 ;; The rest of CC Mode does not (yet) use `font-lock-syntactic-keywords', |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
1138 ;; so it's not set by `c-font-lock-init'. |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
1139 (make-local-variable 'font-lock-syntactic-keywords) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
1140 (setq font-lock-syntactic-keywords |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
1141 '((c-awk-set-syntax-table-properties |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
1142 0 (0) ; Everything on this line is a dummy. |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
1143 nil t))) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
1144 (c-awk-unstick-NL-prop) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
1145 (add-hook 'before-change-functions 'c-awk-before-change nil t) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
1146 (add-hook 'after-change-functions 'c-awk-after-change nil t) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
1147 (c-save-buffer-state nil |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
1148 (save-restriction |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
1149 (widen) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
1150 (c-awk-clear-NL-props (point-min) (point-max)) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
1151 (c-awk-after-change (point-min) (point-max) 0))) ; Set syntax-table props. |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1152 |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
1153 ;; Prevent Xemacs's buffer-syntactic-context being used. See the comment |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
1154 ;; in cc-engine.el, just before (defun c-fast-in-literal ... |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
1155 (defalias 'c-in-literal 'c-slow-in-literal) |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1156 |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
1157 (c-run-mode-hooks 'c-mode-common-hook 'awk-mode-hook) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
1158 (c-update-modeline)) |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1159 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1160 |
20146 | 1161 ;; bug reporting |
18720 | 1162 |
1163 (defconst c-mode-help-address | |
44728
7a3ac6c387fe
CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents:
42390
diff
changeset
|
1164 "bug-cc-mode@gnu.org" |
7a3ac6c387fe
CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents:
42390
diff
changeset
|
1165 "Address(es) for CC Mode bug reports.") |
18720 | 1166 |
1167 (defun c-version () | |
1168 "Echo the current version of CC Mode in the minibuffer." | |
1169 (interactive) | |
1170 (message "Using CC Mode version %s" c-version) | |
1171 (c-keep-region-active)) | |
1172 | |
36920 | 1173 (defvar c-prepare-bug-report-hooks nil) |
1174 | |
1175 ;; Dynamic variables used by reporter. | |
1176 (defvar reporter-prompt-for-summary-p) | |
1177 (defvar reporter-dont-compact-list) | |
1178 | |
18720 | 1179 (defun c-submit-bug-report () |
1180 "Submit via mail a bug report on CC Mode." | |
1181 (interactive) | |
20917
c6e2c4d9a305
(c-mode, c++-mode, objc-mode, java-mode): Set
Richard M. Stallman <rms@gnu.org>
parents:
20459
diff
changeset
|
1182 (require 'reporter) |
18720 | 1183 ;; load in reporter |
1184 (let ((reporter-prompt-for-summary-p t) | |
1185 (reporter-dont-compact-list '(c-offsets-alist)) | |
1186 (style c-indentation-style) | |
1187 (c-features c-emacs-features)) | |
1188 (and | |
1189 (if (y-or-n-p "Do you want to submit a report on CC Mode? ") | |
1190 t (message "") nil) | |
1191 (reporter-submit-bug-report | |
1192 c-mode-help-address | |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1193 (concat "CC Mode " c-version " (" mode-name ")") |
26817 | 1194 (let ((vars (append |
1195 c-style-variables | |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1196 '(c-buffer-is-cc-mode |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1197 c-tab-always-indent |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1198 c-syntactic-indentation |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1199 c-syntactic-indentation-in-macros |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1200 c-ignore-auto-fill |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1201 c-auto-align-backslashes |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1202 c-backspace-function |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1203 c-delete-function |
26817 | 1204 c-electric-pound-behavior |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1205 c-default-style |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1206 c-enable-xemacs-performance-kludge-p |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1207 c-old-style-variable-behavior |
26817 | 1208 defun-prompt-regexp |
1209 tab-width | |
1210 comment-column | |
1211 parse-sexp-ignore-comments | |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1212 parse-sexp-lookup-properties |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1213 lookup-syntax-properties |
26817 | 1214 ;; A brain-damaged XEmacs only variable that, if |
1215 ;; set to nil can cause all kinds of chaos. | |
1216 signal-error-on-buffer-boundary | |
1217 ;; Variables that affect line breaking and comments. | |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1218 auto-fill-mode |
30401
b85ee58b24ec
(c-initialize-cc-mode): Handling of obsolete
Gerd Moellmann <gerd@gnu.org>
parents:
26817
diff
changeset
|
1219 auto-fill-function |
26817 | 1220 filladapt-mode |
1221 comment-multi-line | |
1222 comment-start-skip | |
1223 fill-prefix | |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1224 fill-column |
26817 | 1225 paragraph-start |
1226 adaptive-fill-mode | |
1227 adaptive-fill-regexp) | |
1228 nil))) | |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1229 (mapcar (lambda (var) (unless (boundp var) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1230 (setq vars (delq var vars)))) |
30401
b85ee58b24ec
(c-initialize-cc-mode): Handling of obsolete
Gerd Moellmann <gerd@gnu.org>
parents:
26817
diff
changeset
|
1231 '(signal-error-on-buffer-boundary |
b85ee58b24ec
(c-initialize-cc-mode): Handling of obsolete
Gerd Moellmann <gerd@gnu.org>
parents:
26817
diff
changeset
|
1232 filladapt-mode |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1233 defun-prompt-regexp |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1234 font-lock-mode |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1235 font-lock-maximum-decoration |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1236 parse-sexp-lookup-properties |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1237 lookup-syntax-properties)) |
26817 | 1238 vars) |
41592
b89d0c514129
(c-submit-bug-report): Make sure that the arguments to `insert' are strings.
Sam Steingold <sds@gnu.org>
parents:
37563
diff
changeset
|
1239 (lambda () |
44728
7a3ac6c387fe
CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents:
42390
diff
changeset
|
1240 (run-hooks 'c-prepare-bug-report-hooks) |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1241 (insert (format "Buffer Style: %s\nc-emacs-features: %s\n" |
44728
7a3ac6c387fe
CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents:
42390
diff
changeset
|
1242 style c-features))))))) |
18720 | 1243 |
1244 | |
36920 | 1245 (cc-provide 'cc-mode) |
52401 | 1246 |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
65812
diff
changeset
|
1247 ;;; arch-tag: 7825e5c4-fd09-439f-a04d-4c13208ba3d7 |
18720 | 1248 ;;; cc-mode.el ends here |