annotate lisp/progmodes/cc-mode.el @ 43789:5e0ca4ec865c

Change Maintainer to FSF.
author Andreas Schwab <schwab@suse.de>
date Fri, 08 Mar 2002 19:31:06 +0000
parents 36edcfb696f9
children 7a3ac6c387fe
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1 ;;; cc-mode.el --- major mode for editing C, C++, Objective-C, and Java code
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2
36920
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
3 ;; Copyright (C) 1985,1987,1992-2001 Free Software Foundation, Inc.
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4
30401
b85ee58b24ec (c-initialize-cc-mode): Handling of obsolete
Gerd Moellmann <gerd@gnu.org>
parents: 26817
diff changeset
5 ;; Authors: 2000- Martin Stjernholm
b85ee58b24ec (c-initialize-cc-mode): Handling of obsolete
Gerd Moellmann <gerd@gnu.org>
parents: 26817
diff changeset
6 ;; 1998-1999 Barry A. Warsaw and Martin Stjernholm
24282
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 21109
diff changeset
7 ;; 1992-1997 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
36920
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
27 ;; along with this program; see the file COPYING. If not, write to
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
36920
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
31 (defconst c-version "5.28"
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
32 "CC Mode version number.")
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
33
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
34 ;; 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
35 ;; NOTE: See the accompanying texinfo manual for details on using this mode!
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
36
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
37 ;;; Commentary:
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
38
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
39 ;; This package provides GNU Emacs major modes for editing C, C++,
24282
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 21109
diff changeset
40 ;; Objective-C, Java, IDL and Pike code. As of the latest Emacs and
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 21109
diff changeset
41 ;; XEmacs releases, it is the default package for editing these
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 21109
diff changeset
42 ;; languages. This package is called "CC Mode", and should be spelled
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 21109
diff changeset
43 ;; exactly this way.
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 21109
diff changeset
44
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 21109
diff changeset
45 ;; CC Mode supports K&R and ANSI C, ANSI C++, Objective-C, Java,
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 21109
diff changeset
46 ;; CORBA's IDL, and Pike with a consistent indentation model across
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 21109
diff changeset
47 ;; all modes. This indentation model is intuitive and very flexible,
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 21109
diff changeset
48 ;; so that almost any desired style of indentation can be supported.
19253
2bda7e07f25d (idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents: 18847
diff changeset
49 ;; Installation, usage, and programming details are contained in an
2bda7e07f25d (idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents: 18847
diff changeset
50 ;; accompanying texinfo manual.
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
51
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
52 ;; 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
53 ;; cplus-md1.el..
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
54
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
55 ;; NOTE: This mode does not perform font-locking (a.k.a syntactic
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
56 ;; coloring, keyword highlighting, etc.) for any of the supported
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
57 ;; modes. Typically this is done by a package called font-lock.el
24282
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 21109
diff changeset
58 ;; which we do *not* maintain. You should contact the Emacs or XEmacs
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
59 ;; maintainers for questions about coloring or highlighting in any
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
60 ;; language mode.
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
61
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
62 ;; 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
63 ;; 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
64 ;; 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
65 ;; 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
66 ;; 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
67 ;; 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
68 ;; personal accounts; we reserve the right to ignore such email!
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
69
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
70 ;; 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
71 ;; Without their patience, testing, insight, code contributions, and
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
72 ;; encouragement CC Mode would be a far inferior package.
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
73
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
74 ;; You can get the latest version of CC Mode, including PostScript
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
75 ;; documentation and separate individual files from:
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
76 ;;
30401
b85ee58b24ec (c-initialize-cc-mode): Handling of obsolete
Gerd Moellmann <gerd@gnu.org>
parents: 26817
diff changeset
77 ;; http://cc-mode.sourceforge.net/
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
78 ;;
24282
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 21109
diff changeset
79 ;; 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
80 ;; visiting
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 21109
diff changeset
81 ;;
30401
b85ee58b24ec (c-initialize-cc-mode): Handling of obsolete
Gerd Moellmann <gerd@gnu.org>
parents: 26817
diff changeset
82 ;; http://lists.sourceforge.net/mailman/listinfo/cc-mode-announce
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
83
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
84 ;;; Code:
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
85
26817
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
86 (eval-when-compile
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
87 (let ((load-path
36920
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
88 (if (and (boundp 'byte-compile-dest-file)
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
89 (stringp byte-compile-dest-file))
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
90 (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
91 load-path)))
36920
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
92 (require 'cc-bytecomp)))
21109
a0eda86dd0be (c-initialize-cc-mode): Moved require's to top level.
Richard M. Stallman <rms@gnu.org>
parents: 20917
diff changeset
93
36920
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
94 (cc-require 'cc-defs)
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
95 (cc-require 'cc-menus)
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
96 (cc-require 'cc-vars)
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
97 (cc-require 'cc-langs)
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
98 (cc-require 'cc-styles)
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
99 (cc-require 'cc-engine)
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
100 (cc-require 'cc-cmds)
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
101 (cc-require 'cc-align)
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
102
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
103 ;; Silence the compiler.
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
104 (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
105 (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
106 (cc-bytecomp-defun set-keymap-parents) ; XEmacs
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
107
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
108 ;; 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
109 ;; with your version of Emacs, you are incompatible!
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
110 (require 'easymenu)
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
111
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
112
18847
dd7615d21a97 (c-initialize-cc-mode): New function.
Richard M. Stallman <rms@gnu.org>
parents: 18720
diff changeset
113 ;; 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
114 ;; 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
115 ;; use:
dd7615d21a97 (c-initialize-cc-mode): New function.
Richard M. Stallman <rms@gnu.org>
parents: 18720
diff changeset
116 ;;
dd7615d21a97 (c-initialize-cc-mode): New function.
Richard M. Stallman <rms@gnu.org>
parents: 18720
diff changeset
117 ;; (require 'cc-mode)
dd7615d21a97 (c-initialize-cc-mode): New function.
Richard M. Stallman <rms@gnu.org>
parents: 18720
diff changeset
118 ;; (c-initialize-cc-mode)
dd7615d21a97 (c-initialize-cc-mode): New function.
Richard M. Stallman <rms@gnu.org>
parents: 18720
diff changeset
119
19253
2bda7e07f25d (idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents: 18847
diff changeset
120 ;;;###autoload
24282
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 21109
diff changeset
121 (defun c-initialize-cc-mode ()
19299
7cd7373cc021 (c-initialize-cc-mode): Set c-buffer-is-cc-mode to t.
Richard M. Stallman <rms@gnu.org>
parents: 19253
diff changeset
122 (setq c-buffer-is-cc-mode t)
24282
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 21109
diff changeset
123 (let ((initprop 'cc-mode-is-initialized)
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 21109
diff changeset
124 c-initialization-ok)
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 21109
diff changeset
125 (unless (get 'c-initialize-cc-mode initprop)
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 21109
diff changeset
126 (unwind-protect
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 21109
diff changeset
127 (progn
26817
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
128 (put 'c-initialize-cc-mode initprop t)
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
129 (c-initialize-builtin-style)
24282
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 21109
diff changeset
130 (run-hooks 'c-initialization-hook)
26817
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
131 ;; Fix obsolete variables.
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
132 (if (boundp 'c-comment-continuation-stars)
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
133 (setq c-block-comment-prefix c-comment-continuation-stars))
24282
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 21109
diff changeset
134 (setq c-initialization-ok t))
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 21109
diff changeset
135 ;; Will try initialization hooks again if they failed.
26817
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
136 (put 'c-initialize-cc-mode initprop c-initialization-ok)))
19253
2bda7e07f25d (idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents: 18847
diff changeset
137 ))
18847
dd7615d21a97 (c-initialize-cc-mode): New function.
Richard M. Stallman <rms@gnu.org>
parents: 18720
diff changeset
138
dd7615d21a97 (c-initialize-cc-mode): New function.
Richard M. Stallman <rms@gnu.org>
parents: 18720
diff changeset
139
36920
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
140 ;; Common routines
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
141 (defvar c-mode-base-map ()
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
142 "Keymap shared by all CC Mode related modes.")
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
143
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
144 (defun c-make-inherited-keymap ()
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
145 (let ((map (make-sparse-keymap)))
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
146 (cond
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
147 ;; XEmacs 19 & 20
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
148 ((fboundp 'set-keymap-parents)
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
149 (set-keymap-parents map c-mode-base-map))
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
150 ;; Emacs 19
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
151 ((fboundp 'set-keymap-parent)
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
152 (set-keymap-parent map c-mode-base-map))
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
153 ;; incompatible
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
154 (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
155 map))
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
156
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
157 (if c-mode-base-map
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
158 nil
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
159 ;; 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
160 ;; because Emacs and XEmacs do it differently.
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
161 (setq c-mode-base-map (make-sparse-keymap))
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
162 ;; put standard keybindings into MAP
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
163 ;; 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
164 (define-key c-mode-base-map "{" 'c-electric-brace)
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
165 (define-key c-mode-base-map "}" 'c-electric-brace)
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
166 (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
167 (define-key c-mode-base-map "#" 'c-electric-pound)
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
168 (define-key c-mode-base-map ":" 'c-electric-colon)
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
169 (define-key c-mode-base-map "(" 'c-electric-paren)
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
170 (define-key c-mode-base-map ")" 'c-electric-paren)
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
171 ;; 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
172 ;; backward-kill-word.
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
173 (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
174 (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
175 (substitute-key-definition 'backward-sentence
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
176 'c-beginning-of-statement
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
177 c-mode-base-map global-map)
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
178 (substitute-key-definition 'forward-sentence
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
179 'c-end-of-statement
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
180 c-mode-base-map global-map)
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
181 (substitute-key-definition 'indent-new-comment-line
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
182 'c-indent-new-comment-line
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
183 c-mode-base-map global-map)
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
184 ;; RMS says don't make these the default.
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
185 ;; (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
186 ;; (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
187 (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
188 (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
189 (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
190 (substitute-key-definition 'indent-for-tab-command
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
191 'c-indent-command
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
192 c-mode-base-map global-map)
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
193 ;; It doesn't suffice to put c-fill-paragraph on
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
194 ;; fill-paragraph-function due to the way it works.
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
195 (substitute-key-definition 'fill-paragraph 'c-fill-paragraph
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
196 c-mode-base-map global-map)
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
197 ;; In XEmacs the default fill function is called
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
198 ;; fill-paragraph-or-region.
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
199 (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
200 c-mode-base-map global-map)
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
201 ;; 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
202 ;; 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
203 ;; 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
204 ;; 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
205 (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
206 (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
207 (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
208 ;; 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
209 ;; 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
210 ;; [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
211 ;; `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
212 (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
213 (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
214 ;; these are new keybindings, with no counterpart to BOCM
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
215 (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
216 (define-key c-mode-base-map "*" 'c-electric-star)
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
217 (define-key c-mode-base-map "/" 'c-electric-slash)
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
218 (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
219 (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
220 ;; TBD: where if anywhere, to put c-backward|forward-into-nomenclature
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
221 (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
222 (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
223 (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
224 (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
225 (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
226 (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
227 (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
228 (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
229 ;; conflicts with OOBR
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
230 ;;(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
231 )
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
232
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
233 (defvar c-c-menu nil)
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
234 (defvar c-c++-menu nil)
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
235 (defvar c-objc-menu nil)
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
236 (defvar c-java-menu nil)
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
237 (defvar c-pike-menu nil)
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
238
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
239 (defun c-mode-menu (modestr)
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
240 (let ((m
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
241 '(["Comment Out Region" comment-region (c-fn-region-is-active-p)]
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
242 ["Uncomment Region"
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
243 (comment-region (region-beginning) (region-end) '(4))
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
244 (c-fn-region-is-active-p)]
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
245 ["Fill Comment Paragraph" c-fill-paragraph t]
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
246 "---"
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
247 ["Indent Expression" c-indent-exp
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
248 (memq (char-after) '(?\( ?\[ ?\{))]
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
249 ["Indent Line or Region" c-indent-line-or-region t]
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
250 ["Up Conditional" c-up-conditional t]
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
251 ["Backward Conditional" c-backward-conditional t]
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
252 ["Forward Conditional" c-forward-conditional t]
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
253 ["Backward Statement" c-beginning-of-statement t]
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
254 ["Forward Statement" c-end-of-statement t]
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
255 "---"
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
256 ["Macro Expand Region" c-macro-expand (c-fn-region-is-active-p)]
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
257 ["Backslashify" c-backslash-region
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
258 (c-fn-region-is-active-p)]
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
259 )))
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
260 (cons modestr m)))
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
261
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
262 ;; 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
263 (cc-bytecomp-defvar outline-level)
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
264
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
265 (defun c-common-init ()
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
266 ;; Common initializations for all modes.
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
267 ;; 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
268 ;; indentation style.
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
269 (make-local-variable 'require-final-newline)
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
270 (make-local-variable 'parse-sexp-ignore-comments)
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
271 (make-local-variable 'indent-line-function)
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
272 (make-local-variable 'indent-region-function)
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
273 (make-local-variable 'outline-regexp)
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
274 (make-local-variable 'outline-level)
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
275 (make-local-variable 'normal-auto-fill-function)
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
276 (make-local-variable 'comment-start)
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
277 (make-local-variable 'comment-end)
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
278 (make-local-variable 'comment-column)
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
279 (make-local-variable 'comment-start-skip)
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
280 (make-local-variable 'comment-multi-line)
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
281 (make-local-variable 'paragraph-start)
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
282 (make-local-variable 'paragraph-separate)
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
283 (make-local-variable 'paragraph-ignore-fill-prefix)
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
284 (make-local-variable 'adaptive-fill-mode)
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
285 (make-local-variable 'adaptive-fill-regexp)
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
286 (make-local-variable 'imenu-generic-expression) ;set in the mode functions
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
287 ;; X/Emacs 20 only
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
288 (and (boundp 'comment-line-break-function)
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
289 (progn
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
290 (make-local-variable 'comment-line-break-function)
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
291 (setq comment-line-break-function
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
292 'c-indent-new-comment-line)))
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
293 ;; now set their values
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
294 (setq require-final-newline t
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
295 parse-sexp-ignore-comments t
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
296 indent-line-function 'c-indent-line
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
297 indent-region-function 'c-indent-region
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
298 outline-regexp "[^#\n\^M]"
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
299 outline-level 'c-outline-level
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
300 normal-auto-fill-function 'c-do-auto-fill
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
301 comment-column 32
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
302 comment-start-skip "/\\*+ *\\|//+ *"
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
303 comment-multi-line t)
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
304 ;; now set the mode style based on c-default-style
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
305 (let ((style (if (stringp c-default-style)
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
306 c-default-style
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
307 (or (cdr (assq major-mode c-default-style))
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
308 (cdr (assq 'other c-default-style))
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
309 "gnu"))))
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
310 ;; 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
311 ;; 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
312 ;; 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
313 ;; 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
314 ;; 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
315 ;; 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
316 ;; style init procedure.)
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
317 (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
318 (and (not c-style-variables-are-local-p)
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
319 c-indentation-style
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
320 (not (string-equal c-indentation-style
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
321 style)))))))
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
322 ;; Fix things up for paragraph recognition and filling inside
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
323 ;; comments by using c-current-comment-prefix in the relevant
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
324 ;; places. We use adaptive filling for this to make it possible to
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
325 ;; use filladapt or some other fancy package.
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
326 (setq c-current-comment-prefix
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
327 (if (listp c-comment-prefix-regexp)
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
328 (cdr-safe (or (assoc major-mode c-comment-prefix-regexp)
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
329 (assoc 'other c-comment-prefix-regexp)))
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
330 c-comment-prefix-regexp))
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
331 (let ((comment-line-prefix
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
332 (concat "[ \t]*\\(" c-current-comment-prefix "\\)[ \t]*")))
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
333 (setq paragraph-start (concat comment-line-prefix
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
334 c-append-paragraph-start
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
335 "\\|"
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
336 page-delimiter)
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
337 paragraph-separate (concat comment-line-prefix
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
338 c-append-paragraph-separate
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
339 "\\|"
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
340 page-delimiter)
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
341 paragraph-ignore-fill-prefix t
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
342 adaptive-fill-mode t
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
343 adaptive-fill-regexp
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
344 (concat comment-line-prefix
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
345 (if adaptive-fill-regexp
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
346 (concat "\\(" adaptive-fill-regexp "\\)")
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
347 "")))
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
348 (when (boundp 'adaptive-fill-first-line-regexp)
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
349 ;; XEmacs (20.x) adaptive fill mode doesn't have this.
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
350 (make-local-variable 'adaptive-fill-first-line-regexp)
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
351 (setq adaptive-fill-first-line-regexp
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
352 (concat "\\`" comment-line-prefix
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
353 ;; Maybe we should incorporate the old value here,
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
354 ;; but then we have to do all sorts of kludges to
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
355 ;; deal with the \` and \' it probably contains.
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
356 "\\'"))))
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
357 ;; 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
358 ;; buffer local value has its own alist structure.
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
359 (setq c-offsets-alist (copy-alist c-offsets-alist))
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
360 ;; 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
361 ;; ignore any byte compiler warnings you might get here
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
362 (make-local-variable 'comment-indent-function)
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
363 (setq comment-indent-function 'c-comment-indent)
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
364 ;; add menus to menubar
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
365 (easy-menu-add (c-mode-menu mode-name))
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
366 ;; 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
367 (or (assq 'c-auto-hungry-string minor-mode-alist)
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
368 (setq minor-mode-alist
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
369 (cons '(c-auto-hungry-string c-auto-hungry-string)
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
370 minor-mode-alist)))
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
371 )
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
372
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
373 (defun c-postprocess-file-styles ()
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
374 "Function that post processes relevant file local variables.
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
375 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
376 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
377 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
378 it finds in `c-file-offsets'.
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
379
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
380 Note that the style variables are always made local to the buffer."
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
381 ;; apply file styles and offsets
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
382 (if (or c-file-style c-file-offsets)
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
383 (c-make-styles-buffer-local t))
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
384 (and c-file-style
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
385 (c-set-style c-file-style))
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
386 (and c-file-offsets
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
387 (mapcar
41592
b89d0c514129 (c-submit-bug-report): Make sure that the arguments to `insert' are strings.
Sam Steingold <sds@gnu.org>
parents: 37563
diff changeset
388 (lambda (langentry)
b89d0c514129 (c-submit-bug-report): Make sure that the arguments to `insert' are strings.
Sam Steingold <sds@gnu.org>
parents: 37563
diff changeset
389 (let ((langelem (car langentry))
b89d0c514129 (c-submit-bug-report): Make sure that the arguments to `insert' are strings.
Sam Steingold <sds@gnu.org>
parents: 37563
diff changeset
390 (offset (cdr langentry)))
b89d0c514129 (c-submit-bug-report): Make sure that the arguments to `insert' are strings.
Sam Steingold <sds@gnu.org>
parents: 37563
diff changeset
391 (c-set-offset langelem offset)))
36920
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
392 c-file-offsets)))
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
393
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
394 (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
395
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
396
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
397 ;; Support for C
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
398
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
399 (defvar c-mode-abbrev-table nil
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
400 "Abbreviation table used in c-mode buffers.")
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
401 (define-abbrev-table 'c-mode-abbrev-table
42390
36edcfb696f9 (c-mode-abbrev-table, c++-mode-abbrev-table, objc-mode-abbrev-table)
Richard M. Stallman <rms@gnu.org>
parents: 41592
diff changeset
402 '(("else" "else" c-electric-continued-statement 0 t)
36edcfb696f9 (c-mode-abbrev-table, c++-mode-abbrev-table, objc-mode-abbrev-table)
Richard M. Stallman <rms@gnu.org>
parents: 41592
diff changeset
403 ("while" "while" c-electric-continued-statement 0 t)))
36920
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
404
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
405 (defvar c-mode-map ()
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
406 "Keymap used in c-mode buffers.")
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
407 (if c-mode-map
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
408 nil
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
409 (setq c-mode-map (c-make-inherited-keymap))
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
410 ;; add bindings which are only useful for C
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
411 (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
412 )
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
413
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
414 (easy-menu-define c-c-menu c-mode-map "C Mode Commands"
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
415 (c-mode-menu "C"))
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
416
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
417 ;;;###autoload
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
418 (defun c-mode ()
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
419 "Major mode for editing K&R and ANSI C code.
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
420 To submit a problem report, enter `\\[c-submit-bug-report]' from a
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
421 c-mode buffer. This automatically sets up a mail buffer with version
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
422 information already added. You just need to add a description of the
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
423 problem, including a reproducible test case and send the message.
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
424
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
425 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
426
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
427 The hook variable `c-mode-hook' is run with no args, if that value is
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
428 bound and has a non-nil value. Also the hook `c-mode-common-hook' is
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
429 run first.
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
430
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
431 Key bindings:
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
432 \\{c-mode-map}"
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
433 (interactive)
18847
dd7615d21a97 (c-initialize-cc-mode): New function.
Richard M. Stallman <rms@gnu.org>
parents: 18720
diff changeset
434 (c-initialize-cc-mode)
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
435 (kill-all-local-variables)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
436 (set-syntax-table c-mode-syntax-table)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
437 (setq major-mode 'c-mode
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
438 mode-name "C"
36920
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
439 local-abbrev-table c-mode-abbrev-table
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
440 abbrev-mode t)
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
441 (use-local-map c-mode-map)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
442 (c-common-init)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
443 (setq comment-start "/* "
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
444 comment-end " */"
36920
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
445 c-keywords (c-identifier-re c-C-keywords)
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
446 c-conditional-key c-C-conditional-key
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
447 c-class-key c-C-class-key
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
448 c-baseclass-key nil
26817
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
449 c-comment-start-regexp c-C-comment-start-regexp
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
450 c-bitfield-key c-C-bitfield-key
24282
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 21109
diff changeset
451 )
26817
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
452 (cc-imenu-init cc-imenu-c-generic-expression)
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
453 (run-hooks 'c-mode-common-hook)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
454 (run-hooks 'c-mode-hook)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
455 (c-update-modeline))
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
456
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
457
36920
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
458 ;; Support for C++
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
459
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
460 (defvar c++-mode-abbrev-table nil
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
461 "Abbreviation table used in c++-mode buffers.")
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
462 (define-abbrev-table 'c++-mode-abbrev-table
42390
36edcfb696f9 (c-mode-abbrev-table, c++-mode-abbrev-table, objc-mode-abbrev-table)
Richard M. Stallman <rms@gnu.org>
parents: 41592
diff changeset
463 '(("else" "else" c-electric-continued-statement 0 t)
36edcfb696f9 (c-mode-abbrev-table, c++-mode-abbrev-table, objc-mode-abbrev-table)
Richard M. Stallman <rms@gnu.org>
parents: 41592
diff changeset
464 ("while" "while" c-electric-continued-statement 0 t)
36edcfb696f9 (c-mode-abbrev-table, c++-mode-abbrev-table, objc-mode-abbrev-table)
Richard M. Stallman <rms@gnu.org>
parents: 41592
diff changeset
465 ("catch" "catch" c-electric-continued-statement 0 t)))
36920
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
466
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
467 (defvar c++-mode-map ()
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
468 "Keymap used in c++-mode buffers.")
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
469 (if c++-mode-map
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
470 nil
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
471 (setq c++-mode-map (c-make-inherited-keymap))
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
472 ;; add bindings which are only useful for C++
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
473 (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
474 (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
475 (define-key c++-mode-map "<" 'c-electric-lt-gt)
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
476 (define-key c++-mode-map ">" 'c-electric-lt-gt))
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
477
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
478 (easy-menu-define c-c++-menu c++-mode-map "C++ Mode Commands"
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
479 (c-mode-menu "C++"))
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
480
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
481 ;;;###autoload
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
482 (defun c++-mode ()
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
483 "Major mode for editing C++ code.
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
484 To submit a problem report, enter `\\[c-submit-bug-report]' from a
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
485 c++-mode buffer. This automatically sets up a mail buffer with
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
486 version information already added. You just need to add a description
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
487 of the problem, including a reproducible test case, and send the
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
488 message.
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
489
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
490 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
491
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
492 The hook variable `c++-mode-hook' is run with no args, if that
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
493 variable is bound and has a non-nil value. Also the hook
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
494 `c-mode-common-hook' is run first.
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
495
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
496 Key bindings:
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
497 \\{c++-mode-map}"
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
498 (interactive)
18847
dd7615d21a97 (c-initialize-cc-mode): New function.
Richard M. Stallman <rms@gnu.org>
parents: 18720
diff changeset
499 (c-initialize-cc-mode)
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
500 (kill-all-local-variables)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
501 (set-syntax-table c++-mode-syntax-table)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
502 (setq major-mode 'c++-mode
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
503 mode-name "C++"
36920
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
504 local-abbrev-table c++-mode-abbrev-table
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
505 abbrev-mode t)
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
506 (use-local-map c++-mode-map)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
507 (c-common-init)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
508 (setq comment-start "// "
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
509 comment-end ""
36920
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
510 c-keywords (c-identifier-re c-C++-keywords)
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
511 c-conditional-key c-C++-conditional-key
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
512 c-comment-start-regexp c-C++-comment-start-regexp
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
513 c-class-key c-C++-class-key
24282
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 21109
diff changeset
514 c-extra-toplevel-key c-C++-extra-toplevel-key
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
515 c-access-key c-C++-access-key
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
516 c-recognize-knr-p nil
26817
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
517 c-bitfield-key c-C-bitfield-key
24282
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 21109
diff changeset
518 )
26817
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
519 (cc-imenu-init cc-imenu-c++-generic-expression)
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
520 (run-hooks 'c-mode-common-hook)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
521 (run-hooks 'c++-mode-hook)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
522 (c-update-modeline))
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
523
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
524
36920
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
525 ;; Support for Objective-C
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
526
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
527 (defvar objc-mode-abbrev-table nil
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
528 "Abbreviation table used in objc-mode buffers.")
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
529 (define-abbrev-table 'objc-mode-abbrev-table
42390
36edcfb696f9 (c-mode-abbrev-table, c++-mode-abbrev-table, objc-mode-abbrev-table)
Richard M. Stallman <rms@gnu.org>
parents: 41592
diff changeset
530 '(("else" "else" c-electric-continued-statement 0 t)
36edcfb696f9 (c-mode-abbrev-table, c++-mode-abbrev-table, objc-mode-abbrev-table)
Richard M. Stallman <rms@gnu.org>
parents: 41592
diff changeset
531 ("while" "while" c-electric-continued-statement 0 t)))
36920
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
532
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
533 (defvar objc-mode-map ()
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
534 "Keymap used in objc-mode buffers.")
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
535 (if objc-mode-map
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
536 nil
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
537 (setq objc-mode-map (c-make-inherited-keymap))
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
538 ;; add bindings which are only useful for Objective-C
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
539 (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
540
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
541 (easy-menu-define c-objc-menu objc-mode-map "ObjC Mode Commands"
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
542 (c-mode-menu "ObjC"))
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
543
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
544 ;;;###autoload
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
545 (defun objc-mode ()
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
546 "Major mode for editing Objective C code.
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
547 To submit a problem report, enter `\\[c-submit-bug-report]' from an
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
548 objc-mode buffer. This automatically sets up a mail buffer with
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
549 version information already added. You just need to add a description
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
550 of the problem, including a reproducible test case, and send the
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
551 message.
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
552
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
553 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
554
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
555 The hook variable `objc-mode-hook' is run with no args, if that value
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
556 is bound and has a non-nil value. Also the hook `c-mode-common-hook'
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
557 is run first.
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
558
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
559 Key bindings:
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
560 \\{objc-mode-map}"
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
561 (interactive)
18847
dd7615d21a97 (c-initialize-cc-mode): New function.
Richard M. Stallman <rms@gnu.org>
parents: 18720
diff changeset
562 (c-initialize-cc-mode)
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
563 (kill-all-local-variables)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
564 (set-syntax-table objc-mode-syntax-table)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
565 (setq major-mode 'objc-mode
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
566 mode-name "ObjC"
36920
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
567 local-abbrev-table objc-mode-abbrev-table
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
568 abbrev-mode t)
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
569 (use-local-map objc-mode-map)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
570 (c-common-init)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
571 (setq comment-start "// "
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
572 comment-end ""
36920
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
573 c-keywords (c-identifier-re c-ObjC-keywords)
26817
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
574 c-conditional-key c-ObjC-conditional-key
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
575 c-comment-start-regexp c-ObjC-comment-start-regexp
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
576 c-class-key c-ObjC-class-key
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
577 c-baseclass-key nil
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
578 c-access-key c-ObjC-access-key
20135
ecb78a6ccd8d (objc-mode): Bind imenu-create-index-function
Karl Heuer <kwzh@gnu.org>
parents: 19808
diff changeset
579 c-method-key c-ObjC-method-key
20917
c6e2c4d9a305 (c-mode, c++-mode, objc-mode, java-mode): Set
Richard M. Stallman <rms@gnu.org>
parents: 20459
diff changeset
580 )
26817
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
581 (cc-imenu-init cc-imenu-objc-generic-expression)
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
582 (run-hooks 'c-mode-common-hook)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
583 (run-hooks 'objc-mode-hook)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
584 (c-update-modeline))
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
585
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
586
36920
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
587 ;; Support for Java
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
588
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
589 (defvar java-mode-abbrev-table nil
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
590 "Abbreviation table used in java-mode buffers.")
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
591 (define-abbrev-table 'java-mode-abbrev-table
42390
36edcfb696f9 (c-mode-abbrev-table, c++-mode-abbrev-table, objc-mode-abbrev-table)
Richard M. Stallman <rms@gnu.org>
parents: 41592
diff changeset
592 '(("else" "else" c-electric-continued-statement 0 t)
36edcfb696f9 (c-mode-abbrev-table, c++-mode-abbrev-table, objc-mode-abbrev-table)
Richard M. Stallman <rms@gnu.org>
parents: 41592
diff changeset
593 ("while" "while" c-electric-continued-statement 0 t)
36edcfb696f9 (c-mode-abbrev-table, c++-mode-abbrev-table, objc-mode-abbrev-table)
Richard M. Stallman <rms@gnu.org>
parents: 41592
diff changeset
594 ("catch" "catch" c-electric-continued-statement 0 t)
36edcfb696f9 (c-mode-abbrev-table, c++-mode-abbrev-table, objc-mode-abbrev-table)
Richard M. Stallman <rms@gnu.org>
parents: 41592
diff changeset
595 ("finally" "finally" c-electric-continued-statement 0 t)))
36920
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
596
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
597 (defvar java-mode-map ()
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
598 "Keymap used in java-mode buffers.")
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
599 (if java-mode-map
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
600 nil
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
601 (setq java-mode-map (c-make-inherited-keymap))
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
602 ;; add bindings which are only useful for Java
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
603 )
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
604
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
605 (easy-menu-define c-java-menu java-mode-map "Java Mode Commands"
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
606 (c-mode-menu "Java"))
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
607
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
608 ;;;###autoload
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
609 (defun java-mode ()
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
610 "Major mode for editing Java code.
20135
ecb78a6ccd8d (objc-mode): Bind imenu-create-index-function
Karl Heuer <kwzh@gnu.org>
parents: 19808
diff changeset
611 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
612 java-mode buffer. This automatically sets up a mail buffer with
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
613 version information already added. You just need to add a description
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
614 of the problem, including a reproducible test case and send the
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
615 message.
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
616
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
617 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
618
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
619 The hook variable `java-mode-hook' is run with no args, if that value
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
620 is bound and has a non-nil value. Also the common hook
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
621 `c-mode-common-hook' is run first. Note that this mode automatically
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
622 sets the \"java\" style before calling any hooks so be careful if you
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
623 set styles in `c-mode-common-hook'.
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
624
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
625 Key bindings:
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
626 \\{java-mode-map}"
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
627 (interactive)
18847
dd7615d21a97 (c-initialize-cc-mode): New function.
Richard M. Stallman <rms@gnu.org>
parents: 18720
diff changeset
628 (c-initialize-cc-mode)
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
629 (kill-all-local-variables)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
630 (set-syntax-table java-mode-syntax-table)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
631 (setq major-mode 'java-mode
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
632 mode-name "Java"
30401
b85ee58b24ec (c-initialize-cc-mode): Handling of obsolete
Gerd Moellmann <gerd@gnu.org>
parents: 26817
diff changeset
633 local-abbrev-table java-mode-abbrev-table
36920
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
634 abbrev-mode t
30401
b85ee58b24ec (c-initialize-cc-mode): Handling of obsolete
Gerd Moellmann <gerd@gnu.org>
parents: 26817
diff changeset
635 c-append-paragraph-start c-Java-javadoc-paragraph-start)
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
636 (use-local-map java-mode-map)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
637 (c-common-init)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
638 (setq comment-start "// "
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
639 comment-end ""
36920
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
640 c-keywords (c-identifier-re c-Java-keywords)
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
641 c-conditional-key c-Java-conditional-key
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
642 c-comment-start-regexp c-Java-comment-start-regexp
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
643 c-class-key c-Java-class-key
20917
c6e2c4d9a305 (c-mode, c++-mode, objc-mode, java-mode): Set
Richard M. Stallman <rms@gnu.org>
parents: 20459
diff changeset
644 c-method-key nil
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
645 c-baseclass-key nil
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
646 c-recognize-knr-p nil
24282
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 21109
diff changeset
647 c-inexpr-class-key c-Java-inexpr-class-key
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
648 ;defun-prompt-regexp c-Java-defun-prompt-regexp
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
649 )
26817
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
650 (cc-imenu-init cc-imenu-java-generic-expression)
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
651 (run-hooks 'c-mode-common-hook)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
652 (run-hooks 'java-mode-hook)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
653 (c-update-modeline))
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
654
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
655
36920
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
656 ;; Support for CORBA's IDL language
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
657
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
658 (defvar idl-mode-abbrev-table nil
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
659 "Abbreviation table used in idl-mode buffers.")
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
660 (define-abbrev-table 'idl-mode-abbrev-table ())
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
661
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
662 (defvar idl-mode-map ()
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
663 "Keymap used in idl-mode buffers.")
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
664 (if idl-mode-map
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
665 nil
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
666 (setq idl-mode-map (c-make-inherited-keymap))
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
667 ;; add bindings which are only useful for IDL
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
668 )
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
669
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
670 (easy-menu-define c-idl-menu idl-mode-map "IDL Mode Commands"
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
671 (c-mode-menu "IDL"))
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
672
19253
2bda7e07f25d (idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents: 18847
diff changeset
673 ;;;###autoload
2bda7e07f25d (idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents: 18847
diff changeset
674 (defun idl-mode ()
2bda7e07f25d (idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents: 18847
diff changeset
675 "Major mode for editing CORBA's IDL code.
2bda7e07f25d (idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents: 18847
diff changeset
676 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
677 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
678 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
679 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
680 message.
2bda7e07f25d (idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents: 18847
diff changeset
681
2bda7e07f25d (idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents: 18847
diff changeset
682 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
683
2bda7e07f25d (idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents: 18847
diff changeset
684 The hook variable `idl-mode-hook' is run with no args, if that
2bda7e07f25d (idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents: 18847
diff changeset
685 variable is bound and has a non-nil value. Also the hook
2bda7e07f25d (idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents: 18847
diff changeset
686 `c-mode-common-hook' is run first.
2bda7e07f25d (idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents: 18847
diff changeset
687
2bda7e07f25d (idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents: 18847
diff changeset
688 Key bindings:
2bda7e07f25d (idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents: 18847
diff changeset
689 \\{idl-mode-map}"
2bda7e07f25d (idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents: 18847
diff changeset
690 (interactive)
2bda7e07f25d (idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents: 18847
diff changeset
691 (c-initialize-cc-mode)
2bda7e07f25d (idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents: 18847
diff changeset
692 (kill-all-local-variables)
2bda7e07f25d (idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents: 18847
diff changeset
693 (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
694 (setq major-mode 'idl-mode
2bda7e07f25d (idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents: 18847
diff changeset
695 mode-name "IDL"
2bda7e07f25d (idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents: 18847
diff changeset
696 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
697 (use-local-map idl-mode-map)
2bda7e07f25d (idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents: 18847
diff changeset
698 (c-common-init)
2bda7e07f25d (idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents: 18847
diff changeset
699 (setq comment-start "// "
2bda7e07f25d (idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents: 18847
diff changeset
700 comment-end ""
36920
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
701 c-keywords (c-identifier-re c-IDL-keywords)
26817
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
702 c-conditional-key c-IDL-conditional-key
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
703 c-comment-start-regexp c-IDL-comment-start-regexp
24282
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 21109
diff changeset
704 c-class-key c-IDL-class-key
26817
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
705 c-method-key nil
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
706 c-baseclass-key nil
24282
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 21109
diff changeset
707 c-extra-toplevel-key c-IDL-extra-toplevel-key
20917
c6e2c4d9a305 (c-mode, c++-mode, objc-mode, java-mode): Set
Richard M. Stallman <rms@gnu.org>
parents: 20459
diff changeset
708 c-recognize-knr-p nil
c6e2c4d9a305 (c-mode, c++-mode, objc-mode, java-mode): Set
Richard M. Stallman <rms@gnu.org>
parents: 20459
diff changeset
709 )
26817
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
710 ;;(cc-imenu-init cc-imenu-idl-generic-expression) ;FIXME
19253
2bda7e07f25d (idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents: 18847
diff changeset
711 (run-hooks 'c-mode-common-hook)
2bda7e07f25d (idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents: 18847
diff changeset
712 (run-hooks 'idl-mode-hook)
2bda7e07f25d (idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents: 18847
diff changeset
713 (c-update-modeline))
2bda7e07f25d (idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents: 18847
diff changeset
714
2bda7e07f25d (idl-mode): Support for CORBA's IDL language.
Richard M. Stallman <rms@gnu.org>
parents: 18847
diff changeset
715
36920
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
716 ;; Support for Pike
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
717
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
718 (defvar pike-mode-abbrev-table nil
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
719 "Abbreviation table used in pike-mode buffers.")
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
720 (define-abbrev-table 'pike-mode-abbrev-table
42390
36edcfb696f9 (c-mode-abbrev-table, c++-mode-abbrev-table, objc-mode-abbrev-table)
Richard M. Stallman <rms@gnu.org>
parents: 41592
diff changeset
721 '(("else" "else" c-electric-continued-statement 0 t)
36edcfb696f9 (c-mode-abbrev-table, c++-mode-abbrev-table, objc-mode-abbrev-table)
Richard M. Stallman <rms@gnu.org>
parents: 41592
diff changeset
722 ("while" "while" c-electric-continued-statement 0 t)))
36920
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
723
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
724 (defvar pike-mode-map ()
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
725 "Keymap used in pike-mode buffers.")
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
726 (if pike-mode-map
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
727 nil
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
728 (setq pike-mode-map (c-make-inherited-keymap))
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
729 ;; additional bindings
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
730 (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
731
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
732 (easy-menu-define c-pike-menu pike-mode-map "Pike Mode Commands"
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
733 (c-mode-menu "Pike"))
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
734
24282
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 21109
diff changeset
735 ;;;###autoload
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 21109
diff changeset
736 (defun pike-mode ()
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 21109
diff changeset
737 "Major mode for editing Pike code.
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 21109
diff changeset
738 To submit a problem report, enter `\\[c-submit-bug-report]' from an
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 21109
diff changeset
739 idl-mode buffer. This automatically sets up a mail buffer with
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 21109
diff changeset
740 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
741 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
742 message.
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 21109
diff changeset
743
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 21109
diff changeset
744 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
745
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 21109
diff changeset
746 The hook variable `pike-mode-hook' is run with no args, if that value
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 21109
diff changeset
747 is bound and has a non-nil value. Also the common hook
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 21109
diff changeset
748 `c-mode-common-hook' is run first.
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 21109
diff changeset
749
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 21109
diff changeset
750 Key bindings:
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 21109
diff changeset
751 \\{pike-mode-map}"
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 21109
diff changeset
752 (interactive)
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 21109
diff changeset
753 (c-initialize-cc-mode)
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 21109
diff changeset
754 (kill-all-local-variables)
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 21109
diff changeset
755 (set-syntax-table pike-mode-syntax-table)
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 21109
diff changeset
756 (setq major-mode 'pike-mode
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 21109
diff changeset
757 mode-name "Pike"
36920
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
758 local-abbrev-table pike-mode-abbrev-table
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
759 abbrev-mode t
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
760 c-append-paragraph-start c-Pike-pikedoc-paragraph-start
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
761 c-append-paragraph-separate c-Pike-pikedoc-paragraph-separate)
24282
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 21109
diff changeset
762 (use-local-map pike-mode-map)
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 21109
diff changeset
763 (c-common-init)
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 21109
diff changeset
764 (setq comment-start "// "
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 21109
diff changeset
765 comment-end ""
36920
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
766 c-keywords (c-identifier-re c-Pike-keywords)
24282
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 21109
diff changeset
767 c-conditional-key c-Pike-conditional-key
26817
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
768 c-comment-start-regexp c-Pike-comment-start-regexp
24282
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 21109
diff changeset
769 c-class-key c-Pike-class-key
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 21109
diff changeset
770 c-method-key nil
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 21109
diff changeset
771 c-baseclass-key nil
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 21109
diff changeset
772 c-recognize-knr-p nil
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 21109
diff changeset
773 c-lambda-key c-Pike-lambda-key
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 21109
diff changeset
774 c-inexpr-block-key c-Pike-inexpr-block-key
30401
b85ee58b24ec (c-initialize-cc-mode): Handling of obsolete
Gerd Moellmann <gerd@gnu.org>
parents: 26817
diff changeset
775 c-inexpr-class-key c-Pike-inexpr-class-key
24282
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 21109
diff changeset
776 c-special-brace-lists c-Pike-special-brace-lists
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 21109
diff changeset
777 )
26817
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
778 ;;(cc-imenu-init cc-imenu-pike-generic-expression) ;FIXME
24282
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 21109
diff changeset
779 (run-hooks 'c-mode-common-hook)
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 21109
diff changeset
780 (run-hooks 'pike-mode-hook)
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 21109
diff changeset
781 (c-update-modeline))
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 21109
diff changeset
782
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 21109
diff changeset
783
36920
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
784 ;; Helper for setting up Filladapt mode. It's not used by CC Mode itself.
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
785
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
786 (cc-bytecomp-defvar filladapt-token-table)
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
787 (cc-bytecomp-defvar filladapt-token-match-table)
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
788 (cc-bytecomp-defvar filladapt-token-conversion-table)
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
789
26817
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
790 (defun c-setup-filladapt ()
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
791 "Convenience function to configure Kyle E. Jones' Filladapt mode for
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
792 CC Mode by making sure the proper entries are present on
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
793 `filladapt-token-table', `filladapt-token-match-table', and
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
794 `filladapt-token-conversion-table'. This is intended to be used on
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
795 `c-mode-common-hook' or similar."
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
796 ;; This function is intended to be used explicitly by the end user
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
797 ;; only.
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
798 ;;
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
799 ;; The default configuration already handles C++ comments, but we
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
800 ;; need to add handling of C block comments. A new filladapt token
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
801 ;; `c-comment' is added for that.
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
802 (let (p)
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
803 (setq p filladapt-token-table)
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
804 (while (and p (not (eq (car-safe (cdr-safe (car-safe p))) 'c-comment)))
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
805 (setq p (cdr-safe p)))
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
806 (if p
36920
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
807 (setcar (car p) c-current-comment-prefix)
26817
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
808 (setq filladapt-token-table
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
809 (append (list (car filladapt-token-table)
36920
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
810 (list c-current-comment-prefix 'c-comment))
26817
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
811 (cdr filladapt-token-table)))))
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
812 (unless (assq 'c-comment filladapt-token-match-table)
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
813 (setq filladapt-token-match-table
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
814 (append '((c-comment c-comment))
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
815 filladapt-token-match-table)))
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
816 (unless (assq 'c-comment filladapt-token-conversion-table)
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
817 (setq filladapt-token-conversion-table
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
818 (append '((c-comment . exact))
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
819 filladapt-token-conversion-table))))
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
820
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
821
20146
d7ea5d1fa91b (c-submit-bug-report): Remove
Karl Heuer <kwzh@gnu.org>
parents: 20135
diff changeset
822 ;; bug reporting
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
823
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
824 (defconst c-mode-help-address
24282
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 21109
diff changeset
825 "bug-gnu-emacs@gnu.org, bug-cc-mode@gnu.org"
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 21109
diff changeset
826 "Addresses for CC Mode bug reports.")
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
827
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
828 (defun c-version ()
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
829 "Echo the current version of CC Mode in the minibuffer."
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
830 (interactive)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
831 (message "Using CC Mode version %s" c-version)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
832 (c-keep-region-active))
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
833
36920
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
834 (defvar c-prepare-bug-report-hooks nil)
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
835
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
836 ;; Dynamic variables used by reporter.
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
837 (defvar reporter-prompt-for-summary-p)
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
838 (defvar reporter-dont-compact-list)
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
839
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
840 (defun c-submit-bug-report ()
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
841 "Submit via mail a bug report on CC Mode."
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
842 (interactive)
20917
c6e2c4d9a305 (c-mode, c++-mode, objc-mode, java-mode): Set
Richard M. Stallman <rms@gnu.org>
parents: 20459
diff changeset
843 (require 'reporter)
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
844 ;; load in reporter
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
845 (let ((reporter-prompt-for-summary-p t)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
846 (reporter-dont-compact-list '(c-offsets-alist))
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
847 (style c-indentation-style)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
848 (c-features c-emacs-features))
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
849 (and
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
850 (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
851 t (message "") nil)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
852 (require 'reporter)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
853 (reporter-submit-bug-report
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
854 c-mode-help-address
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
855 (concat "CC Mode " c-version " ("
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
856 (cond ((eq major-mode 'c++-mode) "C++")
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
857 ((eq major-mode 'c-mode) "C")
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
858 ((eq major-mode 'objc-mode) "ObjC")
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
859 ((eq major-mode 'java-mode) "Java")
26817
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
860 ((eq major-mode 'idl-mode) "IDL")
24282
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 21109
diff changeset
861 ((eq major-mode 'pike-mode) "Pike")
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
862 )
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
863 ")")
26817
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
864 (let ((vars (append
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
865 ;; report only the vars that affect indentation
26817
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
866 c-style-variables
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
867 '(c-delete-function
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
868 c-electric-pound-behavior
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
869 c-indent-comments-syntactically-p
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
870 c-tab-always-indent
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
871 defun-prompt-regexp
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
872 tab-width
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
873 comment-column
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
874 parse-sexp-ignore-comments
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
875 ;; A brain-damaged XEmacs only variable that, if
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
876 ;; set to nil can cause all kinds of chaos.
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
877 signal-error-on-buffer-boundary
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
878 ;; Variables that affect line breaking and comments.
30401
b85ee58b24ec (c-initialize-cc-mode): Handling of obsolete
Gerd Moellmann <gerd@gnu.org>
parents: 26817
diff changeset
879 auto-fill-function
26817
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
880 filladapt-mode
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
881 comment-multi-line
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
882 comment-start-skip
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
883 fill-prefix
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
884 paragraph-start
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
885 adaptive-fill-mode
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
886 adaptive-fill-regexp)
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
887 nil)))
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
888 (delq 'c-special-indent-hook vars)
30401
b85ee58b24ec (c-initialize-cc-mode): Handling of obsolete
Gerd Moellmann <gerd@gnu.org>
parents: 26817
diff changeset
889 (mapcar (lambda (var) (unless (boundp var) (delq var vars)))
b85ee58b24ec (c-initialize-cc-mode): Handling of obsolete
Gerd Moellmann <gerd@gnu.org>
parents: 26817
diff changeset
890 '(signal-error-on-buffer-boundary
b85ee58b24ec (c-initialize-cc-mode): Handling of obsolete
Gerd Moellmann <gerd@gnu.org>
parents: 26817
diff changeset
891 filladapt-mode
b85ee58b24ec (c-initialize-cc-mode): Handling of obsolete
Gerd Moellmann <gerd@gnu.org>
parents: 26817
diff changeset
892 defun-prompt-regexp))
26817
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
893 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
894 (lambda ()
b89d0c514129 (c-submit-bug-report): Make sure that the arguments to `insert' are strings.
Sam Steingold <sds@gnu.org>
parents: 37563
diff changeset
895 (run-hooks 'c-prepare-bug-report-hooks)
b89d0c514129 (c-submit-bug-report): Make sure that the arguments to `insert' are strings.
Sam Steingold <sds@gnu.org>
parents: 37563
diff changeset
896 (insert (format "Buffer Style: %s\n\nc-emacs-features: %s\n"
b89d0c514129 (c-submit-bug-report): Make sure that the arguments to `insert' are strings.
Sam Steingold <sds@gnu.org>
parents: 37563
diff changeset
897 style c-features)))))))
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
898
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
899
36920
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
900 (cc-provide 'cc-mode)
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
901 ;;; cc-mode.el ends here