annotate lisp/cc-mode/cc-mode.el @ 165:5a88923fcbfe r20-3b9

Import from CVS: tag r20-3b9
author cvs
date Mon, 13 Aug 2007 09:44:42 +0200
parents
children 929b76928fce
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
165
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1 ;;; cc-mode.el --- major mode for editing C, C++, Objective-C, and Java code
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3 ;; Copyright (C) 1985,87,92,93,94,95,96,97 Free Software Foundation, Inc.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
4
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
5 ;; Authors: 1992-1997 Barry A. Warsaw
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
6 ;; 1987 Dave Detlefs and Stewart Clamen
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
7 ;; 1985 Richard M. Stallman
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
8 ;; Maintainer: cc-mode-help@python.org
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
9 ;; Created: a long, long, time ago. adapted from the original c-mode.el
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
10 ;; Version: 5.11
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
11 ;; Keywords: c languages oop
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
12
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
13 ;; NOTE: Read the commentary below for the right way to submit bug reports!
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
14 ;; NOTE: See the accompanying texinfo manual for details on using this mode!
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
15
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
16 ;; This file is part of GNU Emacs.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
17
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
18 ;; GNU Emacs is free software; you can redistribute it and/or modify
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
19 ;; it under the terms of the GNU General Public License as published by
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
20 ;; the Free Software Foundation; either version 2, or (at your option)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
21 ;; any later version.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
22
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
23 ;; GNU Emacs is distributed in the hope that it will be useful,
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
24 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
25 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
26 ;; GNU General Public License for more details.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
27
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
28 ;; You should have received a copy of the GNU General Public License
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
29 ;; along with GNU Emacs; see the file COPYING. If not, write to the
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
30 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
31 ;; Boston, MA 02111-1307, USA.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
32
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
33 ;;; Commentary:
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
34
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
35 ;; This package provides GNU Emacs major modes for editing C, C++,
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
36 ;; Objective-C, and Java code. As of the latest Emacs and XEmacs
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
37 ;; releases, it is the default package for editing these languages.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
38 ;; This package is called "CC Mode", and should be spelled exactly
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
39 ;; this way. It supports K&R and ANSI C, ANSI C++, Objective-C, and
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
40 ;; Java, with a consistent indentation model across all modes. This
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
41 ;; indentation model is intuitive and very flexible, so that almost
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
42 ;; any desired style of indentation can be supported. Installation,
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
43 ;; usage, and programming details are contained in an accompanying
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
44 ;; texinfo manual.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
45
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
46 ;; CC Mode's immediate ancestors were, c++-mode.el, cplus-md.el, and
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
47 ;; cplus-md1.el..
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
48
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
49 ;; NOTE: This mode does not perform font-locking (a.k.a syntactic
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
50 ;; coloring, keyword highlighting, etc.) for any of the supported
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
51 ;; modes. Typically this is done by a package called font-lock.el
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
52 ;; which I do *not* maintain. You should contact the Emacs
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
53 ;; maintainers for questions about coloring or highlighting in any
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
54 ;; language mode.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
55
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
56 ;; To submit bug reports, type "C-c C-b". These will be sent to
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
57 ;; bug-gnu-emacs@prep.ai.mit.edu as well as cc-mode-help@python.org,
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
58 ;; and I'll read about them there (the former is mirrored as the
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
59 ;; Usenet newsgroup gnu.emacs.bug). Questions can sent to
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
60 ;; help-gnu-emacs@prep.ai.mit.edu (mirrored as gnu.emacs.help) and/or
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
61 ;; cc-mode-help@python.org. Please do not send bugs or questions to
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
62 ;; my personal account.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
63
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
64 ;; YOU CAN IGNORE ALL BYTE-COMPILER WARNINGS. They are the result of
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
65 ;; the cross-Emacsen support. GNU Emacs 19 (from the FSF), GNU XEmacs
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
66 ;; 19 (formerly Lucid Emacs), and GNU Emacs 18 all do things
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
67 ;; differently and there's no way to shut the byte-compiler up at the
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
68 ;; necessary granularity. Let me say this again: YOU CAN IGNORE ALL
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
69 ;; BYTE-COMPILER WARNINGS (you'd be surprised at how many people don't
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
70 ;; follow this advice :-).
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
71
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
72 ;; Many, many thanks go out to all the folks on the beta test list.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
73 ;; Without their patience, testing, insight, code contributions, and
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
74 ;; encouragement CC Mode would be a far inferior package.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
75
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
76 ;; You can get the latest version of CC Mode, including PostScript
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
77 ;; documentation and separate individual files from:
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
78 ;;
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
79 ;; http://www.python.org/ftp/emacs/
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
80
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
81 ;; Or if you don't have access to the World Wide Web, through
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
82 ;; anonymous ftp from:
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
83 ;;
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
84 ;; ftp://ftp.python.org/pub/emacs
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
85
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
86 ;;; Code:
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
87
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
88
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
89
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
90 ;; Figure out what features this Emacs has
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
91 (defconst c-emacs-features
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
92 (let ((infodock-p (boundp 'infodock-version))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
93 (comments
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
94 ;; XEmacs 19 and beyond use 8-bit modify-syntax-entry flags.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
95 ;; Emacs 19 uses a 1-bit flag. We will have to set up our
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
96 ;; syntax tables differently to handle this.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
97 (let ((table (copy-syntax-table))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
98 entry)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
99 (modify-syntax-entry ?a ". 12345678" table)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
100 (cond
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
101 ;; XEmacs 19, and beyond Emacs 19.34
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
102 ((arrayp table)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
103 (setq entry (aref table ?a))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
104 ;; In Emacs, table entries are cons cells
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
105 (if (consp entry) (setq entry (car entry))))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
106 ;; XEmacs 20
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
107 ((fboundp 'get-char-table) (setq entry (get-char-table ?a table)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
108 ;; before and including Emacs 19.34
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
109 ((and (fboundp 'char-table-p)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
110 (char-table-p table))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
111 (setq entry (car (char-table-range table [?a]))))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
112 ;; incompatible
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
113 (t (error "CC Mode is incompatible with this version of Emacs")))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
114 (if (= (logand (lsh entry -16) 255) 255)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
115 '8-bit
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
116 '1-bit))))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
117 (if infodock-p
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
118 (list comments 'infodock)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
119 (list comments)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
120 "A list of features extant in the Emacs you are using.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
121 There are many flavors of Emacs out there, each with different
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
122 features supporting those needed by CC Mode. Here's the current
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
123 supported list, along with the values for this variable:
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
124
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
125 XEmacs 19: (8-bit)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
126 XEmacs 20: (8-bit)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
127 Emacs 19: (1-bit)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
128
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
129 Infodock (based on XEmacs) has an additional symbol on this list:
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
130 'infodock.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
131
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
132
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
133
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
134 ;; important macros and subroutines
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
135 (defsubst c-point (position)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
136 ;; Returns the value of point at certain commonly referenced POSITIONs.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
137 ;; POSITION can be one of the following symbols:
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
138 ;;
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
139 ;; bol -- beginning of line
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
140 ;; eol -- end of line
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
141 ;; bod -- beginning of defun
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
142 ;; boi -- back to indentation
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
143 ;; ionl -- indentation of next line
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
144 ;; iopl -- indentation of previous line
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
145 ;; bonl -- beginning of next line
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
146 ;; bopl -- beginning of previous line
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
147 ;;
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
148 ;; This function does not modify point or mark.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
149 (let ((here (point)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
150 (cond
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
151 ((eq position 'bol) (beginning-of-line))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
152 ((eq position 'eol) (end-of-line))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
153 ((eq position 'bod)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
154 (beginning-of-defun)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
155 ;; if defun-prompt-regexp is non-nil, b-o-d won't leave us at
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
156 ;; the open brace.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
157 (and defun-prompt-regexp
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
158 (looking-at defun-prompt-regexp)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
159 (goto-char (match-end 0)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
160 )
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
161 ((eq position 'boi) (back-to-indentation))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
162 ((eq position 'bonl) (forward-line 1))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
163 ((eq position 'bopl) (forward-line -1))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
164 ((eq position 'iopl)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
165 (forward-line -1)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
166 (back-to-indentation))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
167 ((eq position 'ionl)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
168 (forward-line 1)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
169 (back-to-indentation))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
170 (t (error "unknown buffer position requested: %s" position))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
171 )
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
172 (prog1
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
173 (point)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
174 (goto-char here))))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
175
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
176 (defmacro c-safe (&rest body)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
177 ;; safely execute BODY, return nil if an error occurred
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
178 (` (condition-case nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
179 (progn (,@ body))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
180 (error nil))))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
181
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
182 (defsubst c-keep-region-active ()
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
183 ;; Do whatever is necessary to keep the region active in XEmacs.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
184 ;; Ignore byte-compiler warnings you might see. This is not needed
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
185 ;; for Emacs.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
186 (and (boundp 'zmacs-region-stays)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
187 (setq zmacs-region-stays t)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
188
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
189
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
190
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
191 (defsubst c-load-all ()
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
192 ;; make sure all necessary components of CC Mode are loaded in.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
193 (require 'cc-vars)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
194 (require 'cc-engine)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
195 (require 'cc-langs)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
196 (require 'cc-menus)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
197 (require 'cc-align)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
198 (require 'cc-styles)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
199 (require 'cc-cmds))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
200
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
201
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
202 ;;;###autoload
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
203 (defun c-mode ()
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
204 "Major mode for editing K&R and ANSI C code.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
205 To submit a problem report, enter `\\[c-submit-bug-report]' from a
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
206 c-mode buffer. This automatically sets up a mail buffer with version
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
207 information already added. You just need to add a description of the
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
208 problem, including a reproducible test case and send the message.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
209
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
210 To see what version of CC Mode you are running, enter `\\[c-version]'.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
211
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
212 The hook variable `c-mode-hook' is run with no args, if that value is
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
213 bound and has a non-nil value. Also the hook `c-mode-common-hook' is
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
214 run first.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
215
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
216 Key bindings:
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
217 \\{c-mode-map}"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
218 (interactive)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
219 (c-load-all)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
220 (kill-all-local-variables)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
221 (set-syntax-table c-mode-syntax-table)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
222 (setq major-mode 'c-mode
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
223 mode-name "C"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
224 local-abbrev-table c-mode-abbrev-table)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
225 (use-local-map c-mode-map)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
226 (c-common-init)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
227 (setq comment-start "/* "
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
228 comment-end " */"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
229 comment-multi-line t
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
230 c-conditional-key c-C-conditional-key
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
231 c-class-key c-C-class-key
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
232 c-baseclass-key nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
233 c-comment-start-regexp c-C-comment-start-regexp
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
234 imenu-generic-expression cc-imenu-c-generic-expression)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
235 (run-hooks 'c-mode-common-hook)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
236 (run-hooks 'c-mode-hook)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
237 (c-update-modeline))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
238
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
239
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
240 ;;;###autoload
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
241 (defun c++-mode ()
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
242 "Major mode for editing C++ code.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
243 To submit a problem report, enter `\\[c-submit-bug-report]' from a
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
244 c++-mode buffer. This automatically sets up a mail buffer with
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
245 version information already added. You just need to add a description
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
246 of the problem, including a reproducible test case, and send the
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
247 message.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
248
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
249 To see what version of CC Mode you are running, enter `\\[c-version]'.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
250
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
251 The hook variable `c++-mode-hook' is run with no args, if that
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
252 variable is bound and has a non-nil value. Also the hook
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
253 `c-mode-common-hook' is run first.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
254
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
255 Key bindings:
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
256 \\{c++-mode-map}"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
257 (interactive)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
258 (c-load-all)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
259 (kill-all-local-variables)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
260 (set-syntax-table c++-mode-syntax-table)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
261 (setq major-mode 'c++-mode
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
262 mode-name "C++"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
263 local-abbrev-table c++-mode-abbrev-table)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
264 (use-local-map c++-mode-map)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
265 (c-common-init)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
266 (setq comment-start "// "
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
267 comment-end ""
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
268 comment-multi-line nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
269 c-conditional-key c-C++-conditional-key
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
270 c-comment-start-regexp c-C++-comment-start-regexp
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
271 c-class-key c-C++-class-key
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
272 c-access-key c-C++-access-key
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
273 c-double-slash-is-comments-p t
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
274 c-recognize-knr-p nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
275 imenu-generic-expression cc-imenu-c++-generic-expression)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
276 (run-hooks 'c-mode-common-hook)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
277 (run-hooks 'c++-mode-hook)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
278 (c-update-modeline))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
279
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
280
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
281 ;;;###autoload
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
282 (defun objc-mode ()
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
283 "Major mode for editing Objective C code.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
284 To submit a problem report, enter `\\[c-submit-bug-report]' from an
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
285 objc-mode buffer. This automatically sets up a mail buffer with
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
286 version information already added. You just need to add a description
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
287 of the problem, including a reproducible test case, and send the
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
288 message.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
289
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
290 To see what version of CC Mode you are running, enter `\\[c-version]'.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
291
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
292 The hook variable `objc-mode-hook' is run with no args, if that value
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
293 is bound and has a non-nil value. Also the hook `c-mode-common-hook'
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
294 is run first.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
295
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
296 Key bindings:
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
297 \\{objc-mode-map}"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
298 (interactive)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
299 (c-load-all)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
300 (kill-all-local-variables)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
301 (set-syntax-table objc-mode-syntax-table)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
302 (setq major-mode 'objc-mode
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
303 mode-name "ObjC"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
304 local-abbrev-table objc-mode-abbrev-table)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
305 (use-local-map objc-mode-map)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
306 (c-common-init)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
307 (setq comment-start "// "
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
308 comment-end ""
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
309 comment-multi-line nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
310 c-conditional-key c-C-conditional-key
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
311 c-comment-start-regexp c-C++-comment-start-regexp
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
312 c-class-key c-ObjC-class-key
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
313 c-baseclass-key nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
314 c-access-key c-ObjC-access-key
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
315 c-double-slash-is-comments-p t
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
316 c-method-key c-ObjC-method-key)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
317 (run-hooks 'c-mode-common-hook)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
318 (run-hooks 'objc-mode-hook)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
319 (c-update-modeline))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
320
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
321
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
322 ;;;###autoload
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
323 (defun java-mode ()
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
324 "Major mode for editing Java code.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
325 To submit a problem report, enter `\\[c-submit-bug-report]' from an
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
326 java-mode buffer. This automatically sets up a mail buffer with
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
327 version information already added. You just need to add a description
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
328 of the problem, including a reproducible test case and send the
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
329 message.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
330
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
331 To see what version of CC Mode you are running, enter `\\[c-version]'.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
332
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
333 The hook variable `java-mode-hook' is run with no args, if that value
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
334 is bound and has a non-nil value. Also the common hook
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
335 `c-mode-common-hook' is run first. Note that this mode automatically
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
336 sets the \"java\" style before calling any hooks so be careful if you
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
337 set styles in `c-mode-common-hook'.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
338
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
339 Key bindings:
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
340 \\{java-mode-map}"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
341 (interactive)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
342 (c-load-all)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
343 (kill-all-local-variables)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
344 (set-syntax-table java-mode-syntax-table)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
345 (setq major-mode 'java-mode
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
346 mode-name "Java"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
347 local-abbrev-table java-mode-abbrev-table)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
348 (use-local-map java-mode-map)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
349 (c-common-init)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
350 (setq comment-start "// "
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
351 comment-end ""
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
352 comment-multi-line nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
353 c-conditional-key c-Java-conditional-key
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
354 c-comment-start-regexp c-Java-comment-start-regexp
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
355 c-class-key c-Java-class-key
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
356 c-method-key c-Java-method-key
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
357 c-double-slash-is-comments-p t
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
358 c-baseclass-key nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
359 c-recognize-knr-p nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
360 c-access-key c-Java-access-key
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
361 ;defun-prompt-regexp c-Java-defun-prompt-regexp
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
362 imenu-generic-expression cc-imenu-java-generic-expression
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
363 )
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
364 (c-set-style "java")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
365 (run-hooks 'c-mode-common-hook)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
366 (run-hooks 'java-mode-hook)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
367 (c-update-modeline))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
368
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
369
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
370 ;; defuns for submitting bug reports
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
371 (defconst c-version "5.11"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
372 "CC Mode version number.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
373
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
374 (defconst c-mode-help-address
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
375 "bug-gnu-emacs@prep.ai.mit.edu, cc-mode-help@python.org"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
376 "Address for CC Mode bug reports.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
377
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
378 (defun c-version ()
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
379 "Echo the current version of CC Mode in the minibuffer."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
380 (interactive)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
381 (message "Using CC Mode version %s" c-version)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
382 (c-keep-region-active))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
383
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
384 ;; Get reporter-submit-bug-report when byte-compiling
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
385 (eval-when-compile
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
386 (require 'reporter))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
387
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
388 (defun c-submit-bug-report ()
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
389 "Submit via mail a bug report on CC Mode."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
390 (interactive)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
391 (require 'cc-vars)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
392 ;; load in reporter
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
393 (let ((reporter-prompt-for-summary-p t)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
394 (reporter-dont-compact-list '(c-offsets-alist))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
395 (style c-indentation-style)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
396 (hook c-special-indent-hook)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
397 (c-features c-emacs-features))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
398 (and
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
399 (if (y-or-n-p "Do you want to submit a report on CC Mode? ")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
400 t (message "") nil)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
401 (require 'reporter)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
402 (reporter-submit-bug-report
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
403 c-mode-help-address
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
404 (concat "CC Mode " c-version " ("
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
405 (cond ((eq major-mode 'c++-mode) "C++")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
406 ((eq major-mode 'c-mode) "C")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
407 ((eq major-mode 'objc-mode) "ObjC")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
408 ((eq major-mode 'java-mode) "Java")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
409 )
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
410 ")")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
411 (let ((vars (list
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
412 ;; report only the vars that affect indentation
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
413 'c-basic-offset
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
414 'c-offsets-alist
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
415 'c-cleanup-list
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
416 'c-comment-only-line-offset
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
417 'c-backslash-column
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
418 'c-delete-function
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
419 'c-electric-pound-behavior
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
420 'c-hanging-braces-alist
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
421 'c-hanging-colons-alist
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
422 'c-hanging-comment-starter-p
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
423 'c-hanging-comment-ender-p
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
424 'c-indent-comments-syntactically-p
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
425 'c-tab-always-indent
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
426 'c-recognize-knr-p
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
427 'c-label-minimum-indentation
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
428 'defun-prompt-regexp
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
429 'tab-width
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
430 )))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
431 (if (not (boundp 'defun-prompt-regexp))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
432 (delq 'defun-prompt-regexp vars)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
433 vars))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
434 (function
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
435 (lambda ()
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
436 (insert
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
437 "Buffer Style: " style "\n\n"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
438 (if hook
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
439 (concat "\n@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
440 "c-special-indent-hook is set to '"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
441 (format "%s" hook)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
442 ".\nPerhaps this is your problem?\n"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
443 "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n\n")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
444 "\n")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
445 (format "c-emacs-features: %s\n" c-features)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
446 )))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
447 nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
448 "Dear Barry,"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
449 ))))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
450
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
451
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
452 (provide 'cc-mode)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
453 ;;; cc-mode.el ends here