annotate lisp/progmodes/cc-mode.el @ 62001:1650d8cea39e

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