Mercurial > emacs
annotate lisp/progmodes/cc-mode.el @ 63092:80ef8a2a052d
(debug): Don't bury the buffer unless it's in a dedicated window.
| author | Stefan Monnier <monnier@iro.umontreal.ca> |
|---|---|
| date | Mon, 06 Jun 2005 19:47:05 +0000 |
| parents | 27b53b1903b6 |
| children | 629afbe74e61 5b029ff3b08d |
| 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 |
|
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
3 ;; Copyright (C) 1985,1987,1992-2003 Free Software Foundation, Inc. |
| 18720 | 4 |
|
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
5 ;; Authors: 2003- Alan Mackenzie |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
6 ;; 1998- Martin Stjernholm |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
7 ;; 1992-1999 Barry A. Warsaw |
| 18720 | 8 ;; 1987 Dave Detlefs and Stewart Clamen |
| 9 ;; 1985 Richard M. Stallman | |
| 24282 | 10 ;; Maintainer: bug-cc-mode@gnu.org |
| 18720 | 11 ;; Created: a long, long, time ago. adapted from the original c-mode.el |
| 12 ;; Keywords: c languages oop | |
| 13 | |
| 14 ;; This file is part of GNU Emacs. | |
| 15 | |
| 16 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
| 17 ;; it under the terms of the GNU General Public License as published by | |
| 18 ;; the Free Software Foundation; either version 2, or (at your option) | |
| 19 ;; any later version. | |
| 20 | |
| 21 ;; GNU Emacs is distributed in the hope that it will be useful, | |
| 22 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 23 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 24 ;; GNU General Public License for more details. | |
| 25 | |
| 26 ;; 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
|
27 ;; 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
|
28 ;; 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
|
29 ;; Boston, MA 02110-1301, USA. |
| 18720 | 30 |
|
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
31 ;;; Commentary: |
| 36920 | 32 |
| 33 ;; NOTE: Read the commentary below for the right way to submit bug reports! | |
| 34 ;; 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
|
35 ;; Note: The version string is in cc-defs. |
| 18720 | 36 |
| 37 ;; 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
|
38 ;; 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
|
39 ;; 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
|
40 ;; 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
|
41 ;; should be spelled exactly this way. |
| 24282 | 42 |
| 43 ;; 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
|
44 ;; 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
|
45 ;; 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
|
46 ;; 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
|
47 ;; 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
|
48 ;; contained in an accompanying texinfo manual. |
| 18720 | 49 |
| 50 ;; CC Mode's immediate ancestors were, c++-mode.el, cplus-md.el, and | |
| 51 ;; cplus-md1.el.. | |
| 52 | |
| 53 ;; To submit bug reports, type "C-c C-b". These will be sent to | |
| 24282 | 54 ;; bug-gnu-emacs@gnu.org (mirrored as the Usenet newsgroup |
| 55 ;; gnu.emacs.bug) as well as bug-cc-mode@gnu.org, which directly | |
| 56 ;; contacts the CC Mode maintainers. Questions can sent to | |
| 57 ;; help-gnu-emacs@gnu.org (mirrored as gnu.emacs.help) and/or | |
| 36920 | 58 ;; bug-cc-mode@gnu.org. Please do not send bugs or questions to our |
| 59 ;; personal accounts; we reserve the right to ignore such email! | |
| 18720 | 60 |
| 61 ;; Many, many thanks go out to all the folks on the beta test list. | |
| 62 ;; Without their patience, testing, insight, code contributions, and | |
| 63 ;; encouragement CC Mode would be a far inferior package. | |
| 64 | |
| 65 ;; You can get the latest version of CC Mode, including PostScript | |
| 66 ;; documentation and separate individual files from: | |
| 67 ;; | |
|
30401
b85ee58b24ec
(c-initialize-cc-mode): Handling of obsolete
Gerd Moellmann <gerd@gnu.org>
parents:
26817
diff
changeset
|
68 ;; http://cc-mode.sourceforge.net/ |
| 18720 | 69 ;; |
| 24282 | 70 ;; You can join a moderated CC Mode announcement-only mailing list by |
| 71 ;; visiting | |
| 72 ;; | |
|
30401
b85ee58b24ec
(c-initialize-cc-mode): Handling of obsolete
Gerd Moellmann <gerd@gnu.org>
parents:
26817
diff
changeset
|
73 ;; http://lists.sourceforge.net/mailman/listinfo/cc-mode-announce |
| 18720 | 74 |
| 75 ;;; Code: | |
| 76 | |
| 26817 | 77 (eval-when-compile |
| 78 (let ((load-path | |
| 36920 | 79 (if (and (boundp 'byte-compile-dest-file) |
| 80 (stringp byte-compile-dest-file)) | |
| 81 (cons (file-name-directory byte-compile-dest-file) load-path) | |
| 26817 | 82 load-path))) |
|
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
83 (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
|
84 |
| 36920 | 85 (cc-require 'cc-defs) |
|
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
86 (cc-require-when-compile 'cc-langs) |
| 36920 | 87 (cc-require 'cc-vars) |
|
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
88 (cc-require 'cc-engine) |
| 36920 | 89 (cc-require 'cc-styles) |
| 90 (cc-require 'cc-cmds) | |
| 91 (cc-require 'cc-align) | |
|
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
92 (cc-require 'cc-menus) |
| 36920 | 93 |
|
62641
27b53b1903b6
2005-05-23 Martin Stjernholm <bug-cc-mode@gnu.org>
Martin Stjernholm <mast@lysator.liu.se>
parents:
62046
diff
changeset
|
94 ;; Silence the compiler. |
| 36920 | 95 (cc-bytecomp-defvar comment-line-break-function) ; (X)Emacs 20+ |
| 96 (cc-bytecomp-defvar adaptive-fill-first-line-regexp) ; Emacs 20+ | |
| 97 (cc-bytecomp-defun set-keymap-parents) ; XEmacs | |
|
62641
27b53b1903b6
2005-05-23 Martin Stjernholm <bug-cc-mode@gnu.org>
Martin Stjernholm <mast@lysator.liu.se>
parents:
62046
diff
changeset
|
98 (cc-bytecomp-defun run-mode-hooks) ; Emacs 21.1+ |
|
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 |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
110 ;; 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
|
111 ;; necessary until font locking is requested. |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
112 (eval-after-load "font-lock" |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
113 '(require 'cc-fonts)) |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
114 |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
115 ;; 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
|
116 ;; directives for the interface functions. |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
117 (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
|
118 (autoload 'c-init-language-vars "cc-langs" nil nil 'macro) |
| 18720 | 119 |
| 120 | |
|
18847
dd7615d21a97
(c-initialize-cc-mode): New function.
Richard M. Stallman <rms@gnu.org>
parents:
18720
diff
changeset
|
121 ;; 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
|
122 ;; 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
|
123 ;; use: |
|
dd7615d21a97
(c-initialize-cc-mode): New function.
Richard M. Stallman <rms@gnu.org>
parents:
18720
diff
changeset
|
124 ;; |
|
dd7615d21a97
(c-initialize-cc-mode): New function.
Richard M. Stallman <rms@gnu.org>
parents:
18720
diff
changeset
|
125 ;; (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
|
126 ;; |
|
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
|
127 ;; 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
|
128 ;; |
|
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
129 ;; (c-initialize-cc-mode t) |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
130 ;; (c-init-language-vars some-mode) |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
131 ;; (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
|
132 ;; |
|
52108
5a4fdabed57e
2003-08-03 Martin Stjernholm <bug-cc-mode@gnu.org>
Martin Stjernholm <mast@lysator.liu.se>
parents:
51747
diff
changeset
|
133 ;; 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
|
134 ;; 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
|
135 ;; 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
|
136 ;; '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
|
137 ;; `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
|
138 ;; 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
|
139 ;; |
|
5a4fdabed57e
2003-08-03 Martin Stjernholm <bug-cc-mode@gnu.org>
Martin Stjernholm <mast@lysator.liu.se>
parents:
51747
diff
changeset
|
140 ;; 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
|
141 ;; `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
|
142 ;; |
|
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
143 ;; 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
|
144 ;; 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
|
145 ;; derived-mode-ex.el>. |
|
18847
dd7615d21a97
(c-initialize-cc-mode): New function.
Richard M. Stallman <rms@gnu.org>
parents:
18720
diff
changeset
|
146 |
|
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
|
147 (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
|
148 (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
|
149 |
|
52108
5a4fdabed57e
2003-08-03 Martin Stjernholm <bug-cc-mode@gnu.org>
Martin Stjernholm <mast@lysator.liu.se>
parents:
51747
diff
changeset
|
150 (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
|
151 "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
|
152 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
|
153 `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
|
154 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
|
155 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
|
156 ;; This function does not do any hidden buffer changes. |
|
5a4fdabed57e
2003-08-03 Martin Stjernholm <bug-cc-mode@gnu.org>
Martin Stjernholm <mast@lysator.liu.se>
parents:
51747
diff
changeset
|
157 (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
|
158 ((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
|
159 ((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
|
160 ((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
|
161 ((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
|
162 ((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
|
163 ((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
|
164 (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
|
165 |
|
19253
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
166 ;;;###autoload |
|
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
167 (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
|
168 "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
|
169 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
|
170 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
|
171 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
|
172 `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
|
173 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
|
174 ;; |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
175 ;; This function does not do any hidden buffer changes. |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
176 |
|
19299
7cd7373cc021
(c-initialize-cc-mode): Set c-buffer-is-cc-mode to t.
Richard M. Stallman <rms@gnu.org>
parents:
19253
diff
changeset
|
177 (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
|
178 |
| 24282 | 179 (let ((initprop 'cc-mode-is-initialized) |
| 180 c-initialization-ok) | |
| 181 (unless (get 'c-initialize-cc-mode initprop) | |
| 182 (unwind-protect | |
| 183 (progn | |
| 26817 | 184 (put 'c-initialize-cc-mode initprop t) |
| 185 (c-initialize-builtin-style) | |
| 24282 | 186 (run-hooks 'c-initialization-hook) |
| 26817 | 187 ;; Fix obsolete variables. |
| 188 (if (boundp 'c-comment-continuation-stars) | |
| 189 (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
|
190 (add-hook 'change-major-mode-hook 'c-leave-cc-mode-mode) |
| 24282 | 191 (setq c-initialization-ok t)) |
| 192 ;; 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
|
193 (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
|
194 |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
195 (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
|
196 (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
|
197 |
|
dd7615d21a97
(c-initialize-cc-mode): New function.
Richard M. Stallman <rms@gnu.org>
parents:
18720
diff
changeset
|
198 |
|
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
199 ;;; Common routines. |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
200 |
| 36920 | 201 (defvar c-mode-base-map () |
| 202 "Keymap shared by all CC Mode related modes.") | |
| 203 | |
| 204 (defun c-make-inherited-keymap () | |
| 205 (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
|
206 ;; 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
|
207 ;; 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
|
208 ;; while cc-bytecomp is active when one does M-x eval-buffer. |
| 36920 | 209 (cond |
|
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
210 ;; XEmacs |
|
62641
27b53b1903b6
2005-05-23 Martin Stjernholm <bug-cc-mode@gnu.org>
Martin Stjernholm <mast@lysator.liu.se>
parents:
62046
diff
changeset
|
211 ((cc-bytecomp-fboundp 'set-keymap-parents) |
| 36920 | 212 (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
|
213 ;; Emacs |
|
62641
27b53b1903b6
2005-05-23 Martin Stjernholm <bug-cc-mode@gnu.org>
Martin Stjernholm <mast@lysator.liu.se>
parents:
62046
diff
changeset
|
214 ((cc-bytecomp-fboundp 'set-keymap-parent) |
| 36920 | 215 (set-keymap-parent map c-mode-base-map)) |
| 216 ;; incompatible | |
| 217 (t (error "CC Mode is incompatible with this version of Emacs"))) | |
| 218 map)) | |
| 219 | |
|
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
|
220 (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
|
221 ;; 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
|
222 ;; sixth argument for SYSTEM-FLAG in emacsen that support it |
|
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 ;; (currently only Emacs 21.2). |
|
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
224 (let ((table (or (symbol-value name) |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
225 (progn (define-abbrev-table name nil) |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
226 (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
|
227 (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
|
228 (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
|
229 (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
|
230 (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
|
231 (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
|
232 (setq defs (cdr defs))))) |
|
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
233 (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
|
234 |
| 36920 | 235 (if c-mode-base-map |
| 236 nil | |
| 237 ;; TBD: should we even worry about naming this keymap. My vote: no, | |
| 238 ;; because Emacs and XEmacs do it differently. | |
| 239 (setq c-mode-base-map (make-sparse-keymap)) | |
| 240 ;; put standard keybindings into MAP | |
| 241 ;; the following mappings correspond more or less directly to BOCM | |
| 242 (define-key c-mode-base-map "{" 'c-electric-brace) | |
| 243 (define-key c-mode-base-map "}" 'c-electric-brace) | |
| 244 (define-key c-mode-base-map ";" 'c-electric-semi&comma) | |
| 245 (define-key c-mode-base-map "#" 'c-electric-pound) | |
| 246 (define-key c-mode-base-map ":" 'c-electric-colon) | |
| 247 (define-key c-mode-base-map "(" 'c-electric-paren) | |
| 248 (define-key c-mode-base-map ")" 'c-electric-paren) | |
| 249 ;; Separate M-BS from C-M-h. The former should remain | |
| 250 ;; backward-kill-word. | |
| 251 (define-key c-mode-base-map [(control meta h)] 'c-mark-function) | |
| 252 (define-key c-mode-base-map "\e\C-q" 'c-indent-exp) | |
| 253 (substitute-key-definition 'backward-sentence | |
| 254 'c-beginning-of-statement | |
| 255 c-mode-base-map global-map) | |
| 256 (substitute-key-definition 'forward-sentence | |
| 257 'c-end-of-statement | |
| 258 c-mode-base-map global-map) | |
| 259 (substitute-key-definition 'indent-new-comment-line | |
| 260 'c-indent-new-comment-line | |
| 261 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
|
262 (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
|
263 ;; 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
|
264 ;; 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
|
265 (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
|
266 '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
|
267 c-mode-base-map global-map)) |
| 36920 | 268 ;; RMS says don't make these the default. |
| 269 ;; (define-key c-mode-base-map "\e\C-a" 'c-beginning-of-defun) | |
| 270 ;; (define-key c-mode-base-map "\e\C-e" 'c-end-of-defun) | |
| 271 (define-key c-mode-base-map "\C-c\C-n" 'c-forward-conditional) | |
| 272 (define-key c-mode-base-map "\C-c\C-p" 'c-backward-conditional) | |
| 273 (define-key c-mode-base-map "\C-c\C-u" 'c-up-conditional) | |
| 274 (substitute-key-definition 'indent-for-tab-command | |
| 275 'c-indent-command | |
| 276 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
|
277 |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
278 ;; 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
|
279 ;; `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
|
280 ;; 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
|
281 ;; 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
|
282 ;; `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
|
283 ;; 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
|
284 ;; `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
|
285 ;; do the actual filling work. |
| 36920 | 286 (substitute-key-definition 'fill-paragraph 'c-fill-paragraph |
| 287 c-mode-base-map global-map) | |
| 288 ;; In XEmacs the default fill function is called | |
| 289 ;; fill-paragraph-or-region. | |
| 290 (substitute-key-definition 'fill-paragraph-or-region 'c-fill-paragraph | |
| 291 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
|
292 |
|
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
|
293 ;; 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
|
294 ;; 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
|
295 ;; 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
|
296 ;; 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
|
297 (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
|
298 (define-key c-mode-base-map "\177" 'c-electric-backspace) |
|
79039a33283a
Bind c-electric-delete-forward to C-d and c-electric-backspace to DEL.
Eli Zaretskii <eliz@gnu.org>
parents:
36920
diff
changeset
|
299 (when (boundp 'delete-key-deletes-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
|
300 ;; In XEmacs 20 and later we fix the forward and backward deletion |
|
79039a33283a
Bind c-electric-delete-forward to C-d and c-electric-backspace to DEL.
Eli Zaretskii <eliz@gnu.org>
parents:
36920
diff
changeset
|
301 ;; behavior by binding the keysyms for the [delete] and |
|
79039a33283a
Bind c-electric-delete-forward to C-d and c-electric-backspace to DEL.
Eli Zaretskii <eliz@gnu.org>
parents:
36920
diff
changeset
|
302 ;; [backspace] keys directly, and use `delete-forward-p' or |
|
79039a33283a
Bind c-electric-delete-forward to C-d and c-electric-backspace to DEL.
Eli Zaretskii <eliz@gnu.org>
parents:
36920
diff
changeset
|
303 ;; `delete-key-deletes-forward' to decide what [delete] should do. |
|
79039a33283a
Bind c-electric-delete-forward to C-d and c-electric-backspace to DEL.
Eli Zaretskii <eliz@gnu.org>
parents:
36920
diff
changeset
|
304 (define-key c-mode-base-map [delete] 'c-electric-delete) |
|
79039a33283a
Bind c-electric-delete-forward to C-d and c-electric-backspace to DEL.
Eli Zaretskii <eliz@gnu.org>
parents:
36920
diff
changeset
|
305 (define-key c-mode-base-map [backspace] 'c-electric-backspace)) |
| 36920 | 306 (define-key c-mode-base-map "," 'c-electric-semi&comma) |
| 307 (define-key c-mode-base-map "*" 'c-electric-star) | |
| 308 (define-key c-mode-base-map "/" 'c-electric-slash) | |
| 309 (define-key c-mode-base-map "\C-c\C-q" 'c-indent-defun) | |
| 310 (define-key c-mode-base-map "\C-c\C-\\" 'c-backslash-region) | |
| 311 (define-key c-mode-base-map "\C-c\C-a" 'c-toggle-auto-state) | |
| 312 (define-key c-mode-base-map "\C-c\C-b" 'c-submit-bug-report) | |
| 313 (define-key c-mode-base-map "\C-c\C-c" 'comment-region) | |
| 314 (define-key c-mode-base-map "\C-c\C-d" 'c-toggle-hungry-state) | |
| 315 (define-key c-mode-base-map "\C-c\C-o" 'c-set-offset) | |
| 316 (define-key c-mode-base-map "\C-c\C-s" 'c-show-syntactic-information) | |
| 317 (define-key c-mode-base-map "\C-c\C-t" 'c-toggle-auto-hungry-state) | |
| 318 (define-key c-mode-base-map "\C-c." 'c-set-style) | |
| 319 ;; conflicts with OOBR | |
| 320 ;;(define-key c-mode-base-map "\C-c\C-v" 'c-version) | |
| 321 ) | |
| 322 | |
| 323 ;; We don't require the outline package, but we configure it a bit anyway. | |
| 324 (cc-bytecomp-defvar outline-level) | |
| 325 | |
|
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
326 (defun c-mode-menu (modestr) |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
327 "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
|
328 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
|
329 instead of \"C\". |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
330 |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
331 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
|
332 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
|
333 (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
|
334 |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
335 ;; 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
|
336 ;; 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
|
337 ;; 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
|
338 ;; 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
|
339 (defalias 'c-populate-syntax-table |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
340 (cc-eval-when-compile |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
341 (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
|
342 (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
|
343 |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
344 (defun c-after-change (beg end len) |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
345 ;; Function put on `after-change-functions' to adjust various |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
346 ;; caches. Prefer speed to finesse here, since there will be an |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
347 ;; order of magnitude more calls to this function than any of the |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
348 ;; functions that use the caches. |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
349 ;; |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
350 ;; 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
|
351 ;; 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
|
352 ;; 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
|
353 ;; has already been executed. |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
354 ;; |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
355 ;; This function does not do any hidden buffer changes. |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
356 |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
357 (c-save-buffer-state () |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
358 (when (> end (point-max)) |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
359 ;; Some emacsen might return positions past the end. This has been |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
360 ;; observed in Emacs 20.7 when rereading a buffer changed on disk |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
361 ;; (haven't been able to minimize it, but Emacs 21.3 appears to |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
362 ;; work). |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
363 (setq end (point-max)) |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
364 (when (> beg end) |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
365 (setq beg end))) |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
366 |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
367 (c-invalidate-sws-region-after beg end) |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
368 (c-invalidate-state-cache beg) |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
369 (c-invalidate-find-decl-cache beg))) |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
370 |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
371 (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
|
372 "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
|
373 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
|
374 packages that embed CC Mode. |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
375 |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
376 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
|
377 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
|
378 same format as `c-default-style'. |
|
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 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
|
381 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
|
382 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
|
383 ;; |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
384 ;; This function does not do any hidden buffer changes. |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
385 |
|
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
|
386 (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
|
387 |
| 36920 | 388 ;; these variables should always be buffer local; they do not affect |
| 389 ;; indentation style. | |
| 390 (make-local-variable 'parse-sexp-ignore-comments) | |
| 391 (make-local-variable 'indent-line-function) | |
| 392 (make-local-variable 'indent-region-function) | |
| 393 (make-local-variable 'normal-auto-fill-function) | |
| 394 (make-local-variable 'comment-start) | |
| 395 (make-local-variable 'comment-end) | |
| 396 (make-local-variable 'comment-start-skip) | |
| 397 (make-local-variable 'comment-multi-line) | |
| 398 (make-local-variable 'paragraph-start) | |
| 399 (make-local-variable 'paragraph-separate) | |
| 400 (make-local-variable 'paragraph-ignore-fill-prefix) | |
| 401 (make-local-variable 'adaptive-fill-mode) | |
| 402 (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
|
403 |
| 36920 | 404 ;; 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
|
405 (setq parse-sexp-ignore-comments t |
| 36920 | 406 indent-line-function 'c-indent-line |
| 407 indent-region-function 'c-indent-region | |
| 408 normal-auto-fill-function 'c-do-auto-fill | |
| 409 comment-multi-line t) | |
|
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
|
410 |
|
49654
b025ca405045
(c-basic-common-init): Install `c-fill-paragraph' on
Martin Stjernholm <mast@lysator.liu.se>
parents:
49496
diff
changeset
|
411 ;; 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
|
412 ;; 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
|
413 ;; 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
|
414 (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
|
415 (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
|
416 |
|
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
417 ;; (X)Emacs 20 and later. |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
418 (when (boundp 'comment-line-break-function) |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
419 (make-local-variable 'comment-line-break-function) |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
420 (setq comment-line-break-function |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
421 'c-indent-new-comment-line)) |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
422 |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
423 ;; Emacs 20 and later. |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
424 (when (boundp 'parse-sexp-lookup-properties) |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
425 (make-local-variable 'parse-sexp-lookup-properties) |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
426 (setq parse-sexp-lookup-properties t)) |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
427 |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
428 ;; Same as above for XEmacs 21 (although currently undocumented). |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
429 (when (boundp 'lookup-syntax-properties) |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
430 (make-local-variable 'lookup-syntax-properties) |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
431 (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
|
432 |
|
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
433 ;; 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
|
434 ;; property on each character. |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
435 (when (boundp 'text-property-default-nonsticky) |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
436 (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
|
437 (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
|
438 (if elem |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
439 (setcdr elem t) |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
440 (setq text-property-default-nonsticky |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
441 (cons '(syntax-table . t) |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
442 text-property-default-nonsticky)))) |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
443 (setq text-property-default-nonsticky |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
444 (cons '(c-type . t) |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
445 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
|
446 |
|
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
447 ;; 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
|
448 ;; heuristic that open parens in column 0 are defun starters. Since |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
449 ;; we have c-state-cache that isn't useful and only causes trouble |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
450 ;; so turn it off. |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
451 (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
|
452 (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
|
453 (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
|
454 |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
455 ;; The `c-type' text property with `c-decl-end' is used to mark the |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
456 ;; ends of access keys to make interactive refontification work |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
457 ;; better. |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
458 (when c-opt-access-key |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
459 (setq c-type-decl-end-used t)) |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
460 |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
461 (c-clear-found-types) |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
462 |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
463 ;; 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
|
464 (let ((style (if (stringp default-style) |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
465 default-style |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
466 (or (cdr (assq mode default-style)) |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
467 (cdr (assq 'other default-style)) |
| 36920 | 468 "gnu")))) |
| 469 ;; Override style variables if `c-old-style-variable-behavior' is | |
| 470 ;; set. Also override if we are using global style variables, | |
| 471 ;; have already initialized a style once, and are switching to a | |
| 472 ;; different style. (It's doubtful whether this is desirable, but | |
| 473 ;; the whole situation with nonlocal style variables is a bit | |
| 474 ;; awkward. It's at least the most compatible way with the old | |
| 475 ;; style init procedure.) | |
| 476 (c-set-style style (not (or c-old-style-variable-behavior | |
| 477 (and (not c-style-variables-are-local-p) | |
| 478 c-indentation-style | |
| 479 (not (string-equal c-indentation-style | |
| 480 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
|
481 (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
|
482 |
| 36920 | 483 ;; we have to do something special for c-offsets-alist so that the |
| 484 ;; buffer local value has its own alist structure. | |
| 485 (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
|
486 |
| 36920 | 487 ;; setup the comment indent variable in a Emacs version portable way |
| 488 (make-local-variable 'comment-indent-function) | |
| 489 (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
|
490 |
| 36920 | 491 ;; put auto-hungry designators onto minor-mode-alist, but only once |
| 492 (or (assq 'c-auto-hungry-string minor-mode-alist) | |
| 493 (setq minor-mode-alist | |
| 494 (cons '(c-auto-hungry-string c-auto-hungry-string) | |
| 495 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
|
496 |
|
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
497 ;; 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
|
498 ;; don't become invalid due to buffer changes. |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
499 (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
|
500 |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
501 (defun c-after-font-lock-init () |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
502 ;; Put on `font-lock-mode-hook'. |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
503 (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
|
504 (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
|
505 |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
506 (defun c-font-lock-init () |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
507 "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
|
508 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
|
509 `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
|
510 |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
511 (make-local-variable 'font-lock-defaults) |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
512 (setq font-lock-defaults |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
513 `(,(if (c-mode-is-new-awk-p) |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
514 ;; 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
|
515 'awk-font-lock-keywords |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
516 (mapcar 'c-mode-symbol |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
517 '("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
|
518 "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
|
519 nil nil |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
520 ,c-identifier-syntax-modifications |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
521 c-beginning-of-syntax |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
522 (font-lock-mark-block-function |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
523 . c-mark-function))) |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
524 (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
|
525 |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
526 (defun c-setup-doc-comment-style () |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
527 "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
|
528 (when (and (featurep 'font-lock) |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
529 (symbol-value 'font-lock-mode)) |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
530 ;; 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
|
531 (font-lock-mode 0) |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
532 (font-lock-mode 1))) |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
533 |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
534 (defun c-common-init (&optional mode) |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
535 "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
|
536 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
|
537 `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
|
538 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
|
539 Mode to operate correctly. |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
540 |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
541 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
|
542 `c-basic-common-init' for details. It's only optional to be |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
543 compatible with old code; callers should always specify it. |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
544 |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
545 This function does not do any hidden buffer changes." |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
546 |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
547 (unless mode |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
548 ;; 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
|
549 ;; 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
|
550 (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
|
551 |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
552 (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
|
553 (when mode |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
554 ;; 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
|
555 (c-font-lock-init)) |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
556 |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
557 (make-local-variable 'outline-regexp) |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
558 (make-local-variable 'outline-level) |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
559 (setq outline-regexp "[^#\n\^M]" |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
560 outline-level 'c-outline-level) |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
561 |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
562 (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
|
563 (when rfn |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
564 (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
|
565 (and (cdr rfn) |
|
a88429b12685
(c-common-init): Use mode-require-final-newline.
Richard M. Stallman <rms@gnu.org>
parents:
58747
diff
changeset
|
566 (setq require-final-newline mode-require-final-newline))))) |
| 36920 | 567 |
| 568 (defun c-postprocess-file-styles () | |
|
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
569 "Function that post processes relevant file local variables in CC Mode. |
| 36920 | 570 Currently, this function simply applies any style and offset settings |
| 571 found in the file's Local Variable list. It first applies any style | |
| 572 setting found in `c-file-style', then it applies any offset settings | |
| 573 it finds in `c-file-offsets'. | |
| 574 | |
| 575 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
|
576 ;; |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
577 ;; This function does not do any hidden buffer changes. |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
578 |
| 36920 | 579 ;; 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
|
580 (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
|
581 (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
|
582 (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
|
583 (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
|
584 (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
|
585 (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
|
586 (mapcar |
|
9d60ac21968f
(c-postprocess-file-styles): Do nothing except in CC modes.
Richard M. Stallman <rms@gnu.org>
parents:
44728
diff
changeset
|
587 (lambda (langentry) |
|
9d60ac21968f
(c-postprocess-file-styles): Do nothing except in CC modes.
Richard M. Stallman <rms@gnu.org>
parents:
44728
diff
changeset
|
588 (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
|
589 (offset (cdr langentry))) |
|
9d60ac21968f
(c-postprocess-file-styles): Do nothing except in CC modes.
Richard M. Stallman <rms@gnu.org>
parents:
44728
diff
changeset
|
590 (c-set-offset langelem offset))) |
|
9d60ac21968f
(c-postprocess-file-styles): Do nothing except in CC modes.
Richard M. Stallman <rms@gnu.org>
parents:
44728
diff
changeset
|
591 c-file-offsets)))) |
| 36920 | 592 |
| 593 (add-hook 'hack-local-variables-hook 'c-postprocess-file-styles) | |
| 594 | |
|
62641
27b53b1903b6
2005-05-23 Martin Stjernholm <bug-cc-mode@gnu.org>
Martin Stjernholm <mast@lysator.liu.se>
parents:
62046
diff
changeset
|
595 (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
|
596 ;; 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
|
597 ;; 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
|
598 (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
|
599 `(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
|
600 `(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
|
601 |
| 36920 | 602 |
| 603 ;; Support for C | |
| 604 | |
|
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
605 ;;;###autoload |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
606 (defvar c-mode-syntax-table nil |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
607 "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
|
608 (or c-mode-syntax-table |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
609 (setq c-mode-syntax-table |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
610 (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
|
611 |
| 36920 | 612 (defvar c-mode-abbrev-table nil |
| 613 "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
|
614 (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
|
615 '(("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
|
616 ("while" "while" c-electric-continued-statement 0))) |
| 36920 | 617 |
| 618 (defvar c-mode-map () | |
| 619 "Keymap used in c-mode buffers.") | |
| 620 (if c-mode-map | |
| 621 nil | |
| 622 (setq c-mode-map (c-make-inherited-keymap)) | |
| 623 ;; add bindings which are only useful for C | |
| 624 (define-key c-mode-map "\C-c\C-e" 'c-macro-expand) | |
| 625 ) | |
| 626 | |
| 627 (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
|
628 (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
|
629 |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
630 ;; 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
|
631 ;; `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
|
632 ;; 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
|
633 ;; 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
|
634 ;; 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
|
635 |
|
b4fb79bf98ba
Fixed some autoload problems: Try to ensure that the entry for ".c"
Martin Stjernholm <mast@lysator.liu.se>
parents:
51714
diff
changeset
|
636 ;; 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
|
637 ;; 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
|
638 ;; 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
|
639 ;; 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
|
640 ;; 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
|
641 ;; 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
|
642 ;;;###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
|
643 ;;;###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
|
644 ;;;###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
|
645 |
|
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
646 ;;;###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
|
647 |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
648 ;; 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
|
649 ;; 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
|
650 ;; 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
|
651 ;;;###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
|
652 ;;;###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
|
653 |
| 18720 | 654 ;;;###autoload |
| 655 (defun c-mode () | |
| 656 "Major mode for editing K&R and ANSI C code. | |
| 657 To submit a problem report, enter `\\[c-submit-bug-report]' from a | |
| 658 c-mode buffer. This automatically sets up a mail buffer with version | |
| 659 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
|
660 problem, including a reproducible test case, and send the message. |
| 18720 | 661 |
| 662 To see what version of CC Mode you are running, enter `\\[c-version]'. | |
| 663 | |
|
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
664 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
|
665 initialization, then `c-mode-hook'. |
| 18720 | 666 |
| 667 Key bindings: | |
| 668 \\{c-mode-map}" | |
| 669 (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
|
670 (kill-all-local-variables) |
|
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
671 (c-initialize-cc-mode t) |
| 18720 | 672 (set-syntax-table c-mode-syntax-table) |
| 673 (setq major-mode 'c-mode | |
| 674 mode-name "C" | |
| 36920 | 675 local-abbrev-table c-mode-abbrev-table |
| 676 abbrev-mode t) | |
| 18720 | 677 (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
|
678 (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
|
679 (c-common-init 'c-mode) |
|
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
680 (easy-menu-add c-c-menu) |
| 26817 | 681 (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
|
682 (c-run-mode-hooks 'c-mode-common-hook 'c-mode-hook) |
| 18720 | 683 (c-update-modeline)) |
| 684 | |
| 685 | |
| 36920 | 686 ;; Support for C++ |
| 687 | |
|
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
688 ;;;###autoload |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
689 (defvar c++-mode-syntax-table nil |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
690 "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
|
691 (or c++-mode-syntax-table |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
692 (setq c++-mode-syntax-table |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
693 (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
|
694 |
| 36920 | 695 (defvar c++-mode-abbrev-table nil |
| 696 "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
|
697 (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
|
698 '(("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
|
699 ("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
|
700 ("catch" "catch" c-electric-continued-statement 0))) |
| 36920 | 701 |
| 702 (defvar c++-mode-map () | |
| 703 "Keymap used in c++-mode buffers.") | |
| 704 (if c++-mode-map | |
| 705 nil | |
| 706 (setq c++-mode-map (c-make-inherited-keymap)) | |
| 707 ;; add bindings which are only useful for C++ | |
| 708 (define-key c++-mode-map "\C-c\C-e" 'c-macro-expand) | |
| 709 (define-key c++-mode-map "\C-c:" 'c-scope-operator) | |
| 710 (define-key c++-mode-map "<" 'c-electric-lt-gt) | |
| 711 (define-key c++-mode-map ">" 'c-electric-lt-gt)) | |
| 712 | |
| 713 (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
|
714 (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
|
715 |
| 18720 | 716 ;;;###autoload |
| 717 (defun c++-mode () | |
| 718 "Major mode for editing C++ code. | |
| 719 To submit a problem report, enter `\\[c-submit-bug-report]' from a | |
| 720 c++-mode buffer. This automatically sets up a mail buffer with | |
| 721 version information already added. You just need to add a description | |
| 722 of the problem, including a reproducible test case, and send the | |
| 723 message. | |
| 724 | |
| 725 To see what version of CC Mode you are running, enter `\\[c-version]'. | |
| 726 | |
|
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
727 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
|
728 initialization, then `c++-mode-hook'. |
| 18720 | 729 |
| 730 Key bindings: | |
| 731 \\{c++-mode-map}" | |
| 732 (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
|
733 (kill-all-local-variables) |
|
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
734 (c-initialize-cc-mode t) |
| 18720 | 735 (set-syntax-table c++-mode-syntax-table) |
| 736 (setq major-mode 'c++-mode | |
| 737 mode-name "C++" | |
| 36920 | 738 local-abbrev-table c++-mode-abbrev-table |
| 739 abbrev-mode t) | |
| 18720 | 740 (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
|
741 (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
|
742 (c-common-init 'c++-mode) |
|
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
743 (easy-menu-add c-c++-menu) |
| 26817 | 744 (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
|
745 (c-run-mode-hooks 'c-mode-common-hook 'c++-mode-hook) |
| 18720 | 746 (c-update-modeline)) |
| 747 | |
| 748 | |
| 36920 | 749 ;; Support for Objective-C |
| 750 | |
|
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
751 ;;;###autoload |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
752 (defvar objc-mode-syntax-table nil |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
753 "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
|
754 (or objc-mode-syntax-table |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
755 (setq objc-mode-syntax-table |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
756 (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
|
757 |
| 36920 | 758 (defvar objc-mode-abbrev-table nil |
| 759 "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
|
760 (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
|
761 '(("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
|
762 ("while" "while" c-electric-continued-statement 0))) |
| 36920 | 763 |
| 764 (defvar objc-mode-map () | |
| 765 "Keymap used in objc-mode buffers.") | |
| 766 (if objc-mode-map | |
| 767 nil | |
| 768 (setq objc-mode-map (c-make-inherited-keymap)) | |
| 769 ;; add bindings which are only useful for Objective-C | |
| 770 (define-key objc-mode-map "\C-c\C-e" 'c-macro-expand)) | |
| 771 | |
| 772 (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
|
773 (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
|
774 |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
775 ;;;###autoload (add-to-list 'auto-mode-alist '("\\.m\\'" . objc-mode)) |
| 36920 | 776 |
| 18720 | 777 ;;;###autoload |
| 778 (defun objc-mode () | |
| 779 "Major mode for editing Objective C code. | |
| 780 To submit a problem report, enter `\\[c-submit-bug-report]' from an | |
| 781 objc-mode buffer. This automatically sets up a mail buffer with | |
| 782 version information already added. You just need to add a description | |
| 783 of the problem, including a reproducible test case, and send the | |
| 784 message. | |
| 785 | |
| 786 To see what version of CC Mode you are running, enter `\\[c-version]'. | |
| 787 | |
|
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
788 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
|
789 initialization, then `objc-mode-hook'. |
| 18720 | 790 |
| 791 Key bindings: | |
| 792 \\{objc-mode-map}" | |
| 793 (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
|
794 (kill-all-local-variables) |
|
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
795 (c-initialize-cc-mode t) |
| 18720 | 796 (set-syntax-table objc-mode-syntax-table) |
| 797 (setq major-mode 'objc-mode | |
| 798 mode-name "ObjC" | |
| 36920 | 799 local-abbrev-table objc-mode-abbrev-table |
| 800 abbrev-mode t) | |
|
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
801 ;; The `c-type' text property with `c-decl-end' is used to mark the |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
802 ;; end of the @-style directives. |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
803 (setq c-type-decl-end-used t) |
| 18720 | 804 (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
|
805 (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
|
806 (c-common-init 'objc-mode) |
|
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
807 (easy-menu-add c-objc-menu) |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
808 (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
|
809 (c-run-mode-hooks 'c-mode-common-hook 'objc-mode-hook) |
| 18720 | 810 (c-update-modeline)) |
| 811 | |
| 812 | |
| 36920 | 813 ;; Support for Java |
| 814 | |
|
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
815 ;;;###autoload |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
816 (defvar java-mode-syntax-table nil |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
817 "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
|
818 (or java-mode-syntax-table |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
819 (setq java-mode-syntax-table |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
820 (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
|
821 |
| 36920 | 822 (defvar java-mode-abbrev-table nil |
| 823 "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
|
824 (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
|
825 '(("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
|
826 ("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
|
827 ("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
|
828 ("finally" "finally" c-electric-continued-statement 0))) |
| 36920 | 829 |
| 830 (defvar java-mode-map () | |
| 831 "Keymap used in java-mode buffers.") | |
| 832 (if java-mode-map | |
| 833 nil | |
| 834 (setq java-mode-map (c-make-inherited-keymap)) | |
| 835 ;; add bindings which are only useful for Java | |
| 836 ) | |
| 837 | |
|
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
838 ;; 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
|
839 ;; 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
|
840 ;; 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
|
841 ;; 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
|
842 (defconst c-Java-defun-prompt-regexp |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
843 "^[ \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
|
844 |
| 36920 | 845 (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
|
846 (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
|
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 '("\\.java\\'" . java-mode)) |
| 36920 | 849 |
| 18720 | 850 ;;;###autoload |
| 851 (defun java-mode () | |
| 852 "Major mode for editing Java code. | |
|
20135
ecb78a6ccd8d
(objc-mode): Bind imenu-create-index-function
Karl Heuer <kwzh@gnu.org>
parents:
19808
diff
changeset
|
853 To submit a problem report, enter `\\[c-submit-bug-report]' from a |
| 18720 | 854 java-mode buffer. This automatically sets up a mail buffer with |
| 855 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
|
856 of the problem, including a reproducible test case, and send the |
| 18720 | 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 `java-mode-hook'. |
| 18720 | 863 |
| 864 Key bindings: | |
| 865 \\{java-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 java-mode-syntax-table) |
| 870 (setq major-mode 'java-mode | |
| 871 mode-name "Java" | |
|
30401
b85ee58b24ec
(c-initialize-cc-mode): Handling of obsolete
Gerd Moellmann <gerd@gnu.org>
parents:
26817
diff
changeset
|
872 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
|
873 abbrev-mode t) |
| 18720 | 874 (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
|
875 (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
|
876 (c-common-init 'java-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-java-menu) |
| 26817 | 878 (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
|
879 (c-run-mode-hooks 'c-mode-common-hook 'java-mode-hook) |
| 18720 | 880 (c-update-modeline)) |
| 881 | |
| 882 | |
| 36920 | 883 ;; Support for CORBA's IDL language |
| 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 idl-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 idl-mode buffers.") |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
888 (or idl-mode-syntax-table |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
889 (setq idl-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 idl)))) |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
891 |
| 36920 | 892 (defvar idl-mode-abbrev-table nil |
| 893 "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
|
894 (c-define-abbrev-table 'idl-mode-abbrev-table nil) |
| 36920 | 895 |
| 896 (defvar idl-mode-map () | |
| 897 "Keymap used in idl-mode buffers.") | |
| 898 (if idl-mode-map | |
| 899 nil | |
| 900 (setq idl-mode-map (c-make-inherited-keymap)) | |
| 901 ;; add bindings which are only useful for IDL | |
| 902 ) | |
| 903 | |
| 904 (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
|
905 (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
|
906 |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
907 ;;;###autoload (add-to-list 'auto-mode-alist '("\\.idl\\'" . idl-mode)) |
| 36920 | 908 |
|
19253
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
909 ;;;###autoload |
|
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
910 (defun idl-mode () |
|
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
911 "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
|
912 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
|
913 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
|
914 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
|
915 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
|
916 message. |
|
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
917 |
|
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
918 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
|
919 |
|
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
920 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
|
921 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
|
922 |
|
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
923 Key bindings: |
|
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
924 \\{idl-mode-map}" |
|
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
925 (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
|
926 (kill-all-local-variables) |
|
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
927 (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
|
928 (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
|
929 (setq major-mode 'idl-mode |
|
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
930 mode-name "IDL" |
|
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
931 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
|
932 (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
|
933 (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
|
934 (c-common-init 'idl-mode) |
|
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
935 (easy-menu-add c-idl-menu) |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
936 ;;(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
|
937 (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
|
938 (c-update-modeline)) |
|
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
939 |
|
2bda7e07f25d
(idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents:
18847
diff
changeset
|
940 |
| 36920 | 941 ;; Support for Pike |
| 942 | |
|
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
943 ;;;###autoload |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
944 (defvar pike-mode-syntax-table nil |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
945 "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
|
946 (or pike-mode-syntax-table |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
947 (setq pike-mode-syntax-table |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
948 (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
|
949 |
| 36920 | 950 (defvar pike-mode-abbrev-table nil |
| 951 "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
|
952 (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
|
953 '(("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
|
954 ("while" "while" c-electric-continued-statement 0))) |
| 36920 | 955 |
| 956 (defvar pike-mode-map () | |
| 957 "Keymap used in pike-mode buffers.") | |
| 958 (if pike-mode-map | |
| 959 nil | |
| 960 (setq pike-mode-map (c-make-inherited-keymap)) | |
| 961 ;; additional bindings | |
| 962 (define-key pike-mode-map "\C-c\C-e" 'c-macro-expand)) | |
| 963 | |
| 964 (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
|
965 (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
|
966 |
|
51747
b4fb79bf98ba
Fixed some autoload problems: Try to ensure that the entry for ".c"
Martin Stjernholm <mast@lysator.liu.se>
parents:
51714
diff
changeset
|
967 ;;;###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
|
968 ;;;###autoload (add-to-list 'interpreter-mode-alist '("pike" . pike-mode)) |
| 36920 | 969 |
| 24282 | 970 ;;;###autoload |
| 971 (defun pike-mode () | |
| 972 "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
|
973 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
|
974 pike-mode buffer. This automatically sets up a mail buffer with |
| 24282 | 975 version information already added. You just need to add a description |
| 976 of the problem, including a reproducible test case, and send the | |
| 977 message. | |
| 978 | |
| 979 To see what version of CC Mode you are running, enter `\\[c-version]'. | |
| 980 | |
|
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
981 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
|
982 initialization, then `pike-mode-hook'. |
| 24282 | 983 |
| 984 Key bindings: | |
| 985 \\{pike-mode-map}" | |
| 986 (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
|
987 (kill-all-local-variables) |
|
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
988 (c-initialize-cc-mode t) |
| 24282 | 989 (set-syntax-table pike-mode-syntax-table) |
| 990 (setq major-mode 'pike-mode | |
| 991 mode-name "Pike" | |
| 36920 | 992 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
|
993 abbrev-mode t) |
| 24282 | 994 (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
|
995 (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
|
996 (c-common-init 'pike-mode) |
|
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
997 (easy-menu-add c-pike-menu) |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
998 ;;(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
|
999 (c-run-mode-hooks 'c-mode-common-hook 'pike-mode-hook) |
| 24282 | 1000 (c-update-modeline)) |
| 1001 | |
| 1002 | |
|
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1003 ;; Support for awk. This is purposely disabled for older (X)Emacsen which |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1004 ;; don't support syntax-table properties. |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1005 |
|
51747
b4fb79bf98ba
Fixed some autoload problems: Try to ensure that the entry for ".c"
Martin Stjernholm <mast@lysator.liu.se>
parents:
51714
diff
changeset
|
1006 ;;;###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
|
1007 ;;;###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
|
1008 ;;;###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
|
1009 ;;;###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
|
1010 ;;;###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
|
1011 |
|
b4fb79bf98ba
Fixed some autoload problems: Try to ensure that the entry for ".c"
Martin Stjernholm <mast@lysator.liu.se>
parents:
51714
diff
changeset
|
1012 ;;; 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
|
1013 ;;; autoload form instead. |
|
58747
e3dfd80003ea
(awk-mode autoload): Supply t meaning interactive function.
Richard M. Stallman <rms@gnu.org>
parents:
58198
diff
changeset
|
1014 ;;;###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
|
1015 |
|
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1016 (if (not (memq 'syntax-properties c-emacs-features)) |
|
51747
b4fb79bf98ba
Fixed some autoload problems: Try to ensure that the entry for ".c"
Martin Stjernholm <mast@lysator.liu.se>
parents:
51714
diff
changeset
|
1017 (autoload 'awk-mode "awk-mode" "Major mode for editing AWK code." t) |
|
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1018 |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1019 (defvar awk-mode-abbrev-table nil |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1020 "Abbreviation table used in awk-mode buffers.") |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1021 (c-define-abbrev-table 'awk-mode-abbrev-table |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1022 '(("else" "else" c-electric-continued-statement 0) |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1023 ("while" "while" c-electric-continued-statement 0))) |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1024 |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1025 (defvar awk-mode-map () |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1026 "Keymap used in awk-mode buffers.") |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1027 (if awk-mode-map |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1028 nil |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1029 (setq awk-mode-map (c-make-inherited-keymap)) |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1030 ;; add bindings which are only useful for awk. |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1031 (define-key awk-mode-map "#" 'self-insert-command) |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1032 (define-key awk-mode-map "/" 'self-insert-command) |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1033 (define-key awk-mode-map "*" 'self-insert-command) |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1034 (define-key awk-mode-map "\C-c\C-n" 'undefined) ; #if doesn't exist in awk. |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1035 (define-key awk-mode-map "\C-c\C-p" 'undefined) |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1036 (define-key awk-mode-map "\C-c\C-u" 'undefined) |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1037 (define-key awk-mode-map "\M-a" 'undefined) ; c-awk-beginning-of-statement isn't yet implemented. |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1038 (define-key awk-mode-map "\M-e" 'undefined) ; c-awk-end-of-statement isn't yet implemented. |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1039 (define-key awk-mode-map "\C-\M-a" 'c-awk-beginning-of-defun) |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1040 (define-key awk-mode-map "\C-\M-e" 'c-awk-end-of-defun)) |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1041 |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1042 (easy-menu-define c-awk-menu awk-mode-map "AWK Mode Commands" |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1043 (cons "AWK" (c-lang-const c-mode-menu awk))) |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1044 |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1045 (defun awk-mode () |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1046 "Major mode for editing AWK code. |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1047 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
|
1048 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
|
1049 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
|
1050 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
|
1051 |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1052 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
|
1053 |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1054 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
|
1055 initialization, then `awk-mode-hook'. |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1056 |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1057 Key bindings: |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1058 \\{awk-mode-map}" |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1059 (interactive) |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1060 (require 'cc-awk) ; Added 2003/6/10. |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1061 (kill-all-local-variables) |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1062 (c-initialize-cc-mode t) |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1063 (set-syntax-table awk-mode-syntax-table) |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1064 (setq major-mode 'awk-mode |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1065 mode-name "AWK" |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1066 local-abbrev-table awk-mode-abbrev-table |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1067 abbrev-mode t) |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1068 (use-local-map awk-mode-map) |
|
52108
5a4fdabed57e
2003-08-03 Martin Stjernholm <bug-cc-mode@gnu.org>
Martin Stjernholm <mast@lysator.liu.se>
parents:
51747
diff
changeset
|
1069 (c-init-language-vars-for 'awk-mode) |
|
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1070 (c-common-init 'awk-mode) |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1071 ;; The rest of CC Mode does not (yet) use `font-lock-syntactic-keywords', |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1072 ;; so it's not set by `c-font-lock-init'. |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1073 (make-local-variable 'font-lock-syntactic-keywords) |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1074 (setq font-lock-syntactic-keywords |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1075 '((c-awk-set-syntax-table-properties |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1076 0 (0) ; Everything on this line is a dummy. |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1077 nil t))) |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1078 (c-awk-unstick-NL-prop) |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1079 (add-hook 'before-change-functions 'c-awk-before-change nil t) |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1080 (add-hook 'after-change-functions 'c-awk-after-change nil t) |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1081 (c-save-buffer-state nil |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1082 (save-restriction |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1083 (widen) |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1084 (c-awk-clear-NL-props (point-min) (point-max)) |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1085 (c-awk-after-change (point-min) (point-max) 0))) ; Set syntax-table props. |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1086 |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1087 ;; Prevent Xemacs's buffer-syntactic-context being used. See the comment |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1088 ;; in cc-engine.el, just before (defun c-fast-in-literal ... |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1089 (defalias 'c-in-literal 'c-slow-in-literal) |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1090 |
|
62641
27b53b1903b6
2005-05-23 Martin Stjernholm <bug-cc-mode@gnu.org>
Martin Stjernholm <mast@lysator.liu.se>
parents:
62046
diff
changeset
|
1091 (c-run-mode-hooks 'c-mode-common-hook 'awk-mode-hook) |
|
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1092 (c-update-modeline)) |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1093 ) ;; closes the (if (not (memq 'syntax-properties c-emacs-features)) |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1094 |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1095 |
| 20146 | 1096 ;; bug reporting |
| 18720 | 1097 |
| 1098 (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
|
1099 "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
|
1100 "Address(es) for CC Mode bug reports.") |
| 18720 | 1101 |
| 1102 (defun c-version () | |
| 1103 "Echo the current version of CC Mode in the minibuffer." | |
| 1104 (interactive) | |
| 1105 (message "Using CC Mode version %s" c-version) | |
| 1106 (c-keep-region-active)) | |
| 1107 | |
| 36920 | 1108 (defvar c-prepare-bug-report-hooks nil) |
| 1109 | |
| 1110 ;; Dynamic variables used by reporter. | |
| 1111 (defvar reporter-prompt-for-summary-p) | |
| 1112 (defvar reporter-dont-compact-list) | |
| 1113 | |
| 18720 | 1114 (defun c-submit-bug-report () |
| 1115 "Submit via mail a bug report on CC Mode." | |
| 1116 (interactive) | |
|
20917
c6e2c4d9a305
(c-mode, c++-mode, objc-mode, java-mode): Set
Richard M. Stallman <rms@gnu.org>
parents:
20459
diff
changeset
|
1117 (require 'reporter) |
| 18720 | 1118 ;; load in reporter |
| 1119 (let ((reporter-prompt-for-summary-p t) | |
| 1120 (reporter-dont-compact-list '(c-offsets-alist)) | |
| 1121 (style c-indentation-style) | |
| 1122 (c-features c-emacs-features)) | |
| 1123 (and | |
| 1124 (if (y-or-n-p "Do you want to submit a report on CC Mode? ") | |
| 1125 t (message "") nil) | |
| 1126 (reporter-submit-bug-report | |
| 1127 c-mode-help-address | |
|
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1128 (concat "CC Mode " c-version " (" mode-name ")") |
| 26817 | 1129 (let ((vars (append |
| 1130 c-style-variables | |
|
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1131 '(c-buffer-is-cc-mode |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1132 c-tab-always-indent |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1133 c-syntactic-indentation |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1134 c-syntactic-indentation-in-macros |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1135 c-ignore-auto-fill |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1136 c-auto-align-backslashes |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1137 c-backspace-function |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1138 c-delete-function |
| 26817 | 1139 c-electric-pound-behavior |
|
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1140 c-default-style |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1141 c-enable-xemacs-performance-kludge-p |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1142 c-old-style-variable-behavior |
| 26817 | 1143 defun-prompt-regexp |
| 1144 tab-width | |
| 1145 comment-column | |
| 1146 parse-sexp-ignore-comments | |
|
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1147 parse-sexp-lookup-properties |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1148 lookup-syntax-properties |
| 26817 | 1149 ;; A brain-damaged XEmacs only variable that, if |
| 1150 ;; set to nil can cause all kinds of chaos. | |
| 1151 signal-error-on-buffer-boundary | |
| 1152 ;; 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
|
1153 auto-fill-mode |
|
30401
b85ee58b24ec
(c-initialize-cc-mode): Handling of obsolete
Gerd Moellmann <gerd@gnu.org>
parents:
26817
diff
changeset
|
1154 auto-fill-function |
| 26817 | 1155 filladapt-mode |
| 1156 comment-multi-line | |
| 1157 comment-start-skip | |
| 1158 fill-prefix | |
|
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1159 fill-column |
| 26817 | 1160 paragraph-start |
| 1161 adaptive-fill-mode | |
| 1162 adaptive-fill-regexp) | |
| 1163 nil))) | |
|
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1164 (mapcar (lambda (var) (unless (boundp var) |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1165 (setq vars (delq var vars)))) |
|
30401
b85ee58b24ec
(c-initialize-cc-mode): Handling of obsolete
Gerd Moellmann <gerd@gnu.org>
parents:
26817
diff
changeset
|
1166 '(signal-error-on-buffer-boundary |
|
b85ee58b24ec
(c-initialize-cc-mode): Handling of obsolete
Gerd Moellmann <gerd@gnu.org>
parents:
26817
diff
changeset
|
1167 filladapt-mode |
|
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1168 defun-prompt-regexp |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1169 font-lock-mode |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1170 font-lock-maximum-decoration |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1171 parse-sexp-lookup-properties |
|
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
51620
diff
changeset
|
1172 lookup-syntax-properties)) |
| 26817 | 1173 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
|
1174 (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
|
1175 (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
|
1176 (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
|
1177 style c-features))))))) |
| 18720 | 1178 |
| 1179 | |
| 36920 | 1180 (cc-provide 'cc-mode) |
| 52401 | 1181 |
| 1182 ;;; arch-tag: 7825e5c4-fd09-439f-a04d-4c13208ba3d7 | |
| 18720 | 1183 ;;; cc-mode.el ends here |
