annotate lisp/cc-mode/cc-langs.el @ 189:489f57a838ef r20-3b21

Import from CVS: tag r20-3b21
author cvs
date Mon, 13 Aug 2007 09:57:07 +0200
parents b405438285a2
children 850242ba4a81
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-langs.el --- specific language support for CC Mode
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: 22-Apr-1997 (split from cc-mode.el)
189
489f57a838ef Import from CVS: tag r20-3b21
cvs
parents: 187
diff changeset
10 ;; Version: 5.18
165
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 ;; This file is part of GNU Emacs.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
14
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
15 ;; GNU Emacs is free software; you can redistribute it and/or modify
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
16 ;; it under the terms of the GNU General Public License as published by
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
17 ;; the Free Software Foundation; either version 2, or (at your option)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
18 ;; any later version.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
19
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
20 ;; GNU Emacs is distributed in the hope that it will be useful,
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
21 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
22 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
23 ;; GNU General Public License for more details.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
24
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
25 ;; You should have received a copy of the GNU General Public License
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
26 ;; along with GNU Emacs; see the file COPYING. If not, write to the
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
27 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
28 ;; Boston, MA 02111-1307, USA.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
29
175
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 171
diff changeset
30 (require 'cc-defs)
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 171
diff changeset
31
165
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
32
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
33 ;; Regular expressions and other values which must be parameterized on
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
34 ;; a per-language basis.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
35
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
36 ;; Keywords defining protection levels
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
37 (defconst c-protection-key "\\<\\(public\\|protected\\|private\\)\\>")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
38
175
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 171
diff changeset
39 ;; Regex describing a `symbol' in all languages. We cannot use just
165
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
40 ;; `word' syntax class since `_' cannot be in word class. Putting
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
41 ;; underscore in word class breaks forward word movement behavior that
175
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 171
diff changeset
42 ;; users are familiar with. Besides, this runs counter to Emacs
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 171
diff changeset
43 ;; convention.
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 171
diff changeset
44 ;;
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 171
diff changeset
45 ;; I suspect this definition isn't correct in light of Java's
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 171
diff changeset
46 ;; definition of a symbol as being Unicode. I know so little about
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 171
diff changeset
47 ;; I18N (except how to sound cool and say I18N :-) that I'm willing to
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 171
diff changeset
48 ;; punt on this for now.
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 171
diff changeset
49
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 171
diff changeset
50 (defconst c-symbol-key "[_a-zA-Z]\\(\\w\\|\\s_\\)*")
165
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
51
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
52
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
53 ;; keywords introducing class definitions. language specific
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
54 (defconst c-C-class-key "\\(struct\\|union\\)")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
55 (defconst c-C++-class-key "\\(class\\|struct\\|union\\)")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
56
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
57 (defconst c-ObjC-class-key
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
58 (concat
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
59 "@\\(interface\\|implementation\\)\\s +"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
60 c-symbol-key ;name of the class
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
61 "\\(\\s *:\\s *" c-symbol-key "\\)?" ;maybe followed by the superclass
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
62 "\\(\\s *<[^>]+>\\)?" ;and maybe the adopted protocols list
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
63 ))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
64
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
65 (defconst c-Java-class-key
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
66 (concat
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
67 "\\(" c-protection-key "\\s +\\)?"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
68 "\\(interface\\|class\\)\\s +"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
69 c-symbol-key ;name of the class
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
70 "\\(\\s *extends\\s *" c-symbol-key "\\)?" ;maybe followed by superclass
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
71 ;;"\\(\\s *implements *[^{]+{\\)?" ;maybe the adopted protocols list
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
72 ))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
73
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
74 (defvar c-class-key c-C-class-key)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
75 (make-variable-buffer-local 'c-class-key)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
76
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
77
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
78 ;; regexp describing access protection clauses. language specific
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
79 (defvar c-access-key nil)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
80 (make-variable-buffer-local 'c-access-key)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
81 (defconst c-C++-access-key (concat c-protection-key "[ \t]*:"))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
82 (defconst c-ObjC-access-key (concat "@" c-protection-key))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
83 (defconst c-Java-access-key nil)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
84
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
85
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
86 ;; keywords introducing conditional blocks
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
87 (defconst c-C-conditional-key nil)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
88 (defconst c-C++-conditional-key nil)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
89 (defconst c-Java-conditional-key nil)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
90
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
91 (let ((all-kws "for\\|if\\|do\\|else\\|while\\|switch")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
92 (exc-kws "\\|try\\|catch")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
93 (thr-kws "\\|finally\\|synchronized")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
94 (front "\\b\\(")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
95 (back "\\)\\b[^_]"))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
96 (setq c-C-conditional-key (concat front all-kws back)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
97 c-C++-conditional-key (concat front all-kws exc-kws back)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
98 c-Java-conditional-key (concat front all-kws exc-kws thr-kws back)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
99
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
100 (defvar c-conditional-key c-C-conditional-key)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
101 (make-variable-buffer-local 'c-conditional-key)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
102
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
103
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
104 ;; keywords describing method definition introductions
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
105 (defvar c-method-key nil)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
106 (make-variable-buffer-local 'c-method-key)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
107
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
108 (defconst c-ObjC-method-key
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
109 (concat
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
110 "^\\s *[+-]\\s *"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
111 "\\(([^)]*)\\)?" ; return type
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
112 ;; \\s- in objc syntax table does not include \n
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
113 ;; since it is considered the end of //-comments.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
114 "[ \t\n]*" c-symbol-key))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
115
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
116 (defconst c-Java-method-key
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
117 (concat
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
118 "^\\s *[+-]\\s *"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
119 "\\(([^)]*)\\)?" ; return type
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
120 ;; \\s- in java syntax table does not include \n
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
121 ;; since it is considered the end of //-comments.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
122 "[ \t\n]*" c-symbol-key))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
123
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
124
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
125 ;; comment starter definitions for various languages. language specific
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
126 (defconst c-C++-comment-start-regexp "/[/*]")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
127 ;; We need to match all 3 Java style comments
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
128 ;; 1) Traditional C block; 2) javadoc /** ...; 3) C++ style
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
129 (defconst c-Java-comment-start-regexp "/\\(/\\|[*][*]?\\)")
181
bfd6434d15b3 Import from CVS: tag r20-3b17
cvs
parents: 177
diff changeset
130 (defvar c-comment-start-regexp c-C++-comment-start-regexp)
165
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
131 (make-variable-buffer-local 'c-comment-start-regexp)
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
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
135 ;; Regexp describing a switch's case or default label for all languages
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
136 (defconst c-switch-label-key "\\(\\(case[( \t]+\\S .*\\)\\|default[ \t]*\\):")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
137 ;; Regexp describing any label.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
138 (defconst c-label-key (concat c-symbol-key ":\\([^:]\\|$\\)"))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
139
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
140 ;; Regexp describing class inheritance declarations. TBD: this should
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
141 ;; be language specific, and only makes sense for C++
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
142 (defconst c-inher-key
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
143 (concat "\\(\\<static\\>\\s +\\)?"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
144 c-C++-class-key "[ \t]+" c-symbol-key
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
145 "\\([ \t]*:[ \t]*\\)\\s *[^;]"))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
146
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
147 ;; Regexp describing C++ base classes in a derived class definition.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
148 ;; TBD: this should be language specific, and only makes sense for C++
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
149 (defvar c-baseclass-key
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
150 (concat
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
151 ":?[ \t]*\\(virtual[ \t]+\\)?\\("
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
152 c-protection-key "[ \t]+\\)" c-symbol-key))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
153 (make-variable-buffer-local 'c-baseclass-key)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
154
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
155 ;; Regexp describing friend declarations in C++ classes.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
156 (defconst c-C++-friend-key
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
157 "friend[ \t]+\\|template[ \t]*<.+>[ \t]*friend[ \t]+")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
158
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
159 ;; Regexp describing Java inheritance and throws clauses.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
160 (defconst c-Java-special-key "\\(implements\\|extends\\|throws\\)[^_]")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
161
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
162 ;; Regexp describing the beginning of a Java top-level definition.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
163 (defconst c-Java-defun-prompt-regexp
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
164 "^[ \t]*\\(\\(\\(public\\|protected\\|private\\|const\\|abstract\\|synchronized\\|final\\|static\\|threadsafe\\|transient\\|native\\|volatile\\)\\s-+\\)*\\(\\(\\([[a-zA-Z][][_$.a-zA-Z0-9]*[][_$.a-zA-Z0-9]+\\|[[a-zA-Z]\\)\\s-*\\)\\s-+\\)\\)?\\(\\([[a-zA-Z][][_$.a-zA-Z0-9]*\\s-+\\)\\s-*\\)?\\([_a-zA-Z][^][ \t:;.,{}()=]*\\|\\([_$a-zA-Z][_$.a-zA-Z0-9]*\\)\\)\\s-*\\(([^);{}]*)\\)?\\([] \t]*\\)\\(\\s-*\\<throws\\>\\s-*\\(\\([_$a-zA-Z][_$.a-zA-Z0-9]*\\)[, \t\n\r\f]*\\)+\\)?\\s-*")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
165
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
166
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
167
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
168 ;; internal state variables
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
169
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
170 ;; Internal state of hungry delete key feature
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
171 (defvar c-hungry-delete-key nil)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
172 (make-variable-buffer-local 'c-hungry-delete-key)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
173
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
174 ;; Internal state of auto newline feature.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
175 (defvar c-auto-newline nil)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
176 (make-variable-buffer-local 'c-auto-newline)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
177
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
178 ;; Internal auto-newline/hungry-delete designation string for mode line.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
179 (defvar c-auto-hungry-string nil)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
180 (make-variable-buffer-local 'c-auto-hungry-string)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
181
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
182 ;; Non-nil means K&R style argument declarations are valid.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
183 (defvar c-recognize-knr-p t)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
184 (make-variable-buffer-local 'c-recognize-knr-p)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
185
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
186
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
187
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
188 (defun c-use-java-style ()
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
189 "Institutes `java' indentation style.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
190 For use with the variable `java-mode-hook'."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
191 (c-set-style "java"))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
192
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
193 (defun c-common-init ()
171
929b76928fce Import from CVS: tag r20-3b12
cvs
parents: 167
diff changeset
194 ;; Common initializations for all modes.
165
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
195 ;; these variables should always be buffer local; they do not affect
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
196 ;; indentation style.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
197 (make-local-variable 'paragraph-start)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
198 (make-local-variable 'paragraph-separate)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
199 (make-local-variable 'paragraph-ignore-fill-prefix)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
200 (make-local-variable 'require-final-newline)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
201 (make-local-variable 'parse-sexp-ignore-comments)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
202 (make-local-variable 'indent-line-function)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
203 (make-local-variable 'indent-region-function)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
204 (make-local-variable 'comment-start)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
205 (make-local-variable 'comment-end)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
206 (make-local-variable 'comment-column)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
207 (make-local-variable 'comment-start-skip)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
208 (make-local-variable 'comment-multi-line)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
209 (make-local-variable 'outline-regexp)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
210 (make-local-variable 'outline-level)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
211 (make-local-variable 'adaptive-fill-regexp)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
212 (make-local-variable 'imenu-generic-expression) ;set in the mode functions
181
bfd6434d15b3 Import from CVS: tag r20-3b17
cvs
parents: 177
diff changeset
213 ;; X/Emacs 20 only
bfd6434d15b3 Import from CVS: tag r20-3b17
cvs
parents: 177
diff changeset
214 (and (boundp 'comment-line-break-function)
bfd6434d15b3 Import from CVS: tag r20-3b17
cvs
parents: 177
diff changeset
215 (make-local-variable 'comment-line-break-function))
165
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
216 ;; Emacs 19.30 and beyond only, AFAIK
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
217 (if (boundp 'fill-paragraph-function)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
218 (progn
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
219 (make-local-variable 'fill-paragraph-function)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
220 (setq fill-paragraph-function 'c-fill-paragraph)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
221 ;; now set their values
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
222 (setq paragraph-start (concat page-delimiter "\\|$")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
223 paragraph-separate paragraph-start
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
224 paragraph-ignore-fill-prefix t
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
225 require-final-newline t
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
226 parse-sexp-ignore-comments t
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
227 indent-line-function 'c-indent-line
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
228 indent-region-function 'c-indent-region
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
229 outline-regexp "[^#\n\^M]"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
230 outline-level 'c-outline-level
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
231 comment-column 32
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
232 comment-start-skip "/\\*+ *\\|// *"
181
bfd6434d15b3 Import from CVS: tag r20-3b17
cvs
parents: 177
diff changeset
233 comment-multi-line nil
bfd6434d15b3 Import from CVS: tag r20-3b17
cvs
parents: 177
diff changeset
234 comment-line-break-function 'c-comment-line-break-function
165
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
235 adaptive-fill-regexp nil)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
236 ;; we have to do something special for c-offsets-alist so that the
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
237 ;; buffer local value has its own alist structure.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
238 (setq c-offsets-alist (copy-alist c-offsets-alist))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
239 ;; setup the comment indent variable in a Emacs version portable way
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
240 ;; ignore any byte compiler warnings you might get here
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
241 (make-local-variable 'comment-indent-function)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
242 (setq comment-indent-function 'c-comment-indent)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
243 ;; add menus to menubar
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
244 (easy-menu-add (c-mode-menu mode-name))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
245 ;; put auto-hungry designators onto minor-mode-alist, but only once
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
246 (or (assq 'c-auto-hungry-string minor-mode-alist)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
247 (setq minor-mode-alist
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
248 (cons '(c-auto-hungry-string c-auto-hungry-string)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
249 minor-mode-alist))))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
250
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
251 (defun c-postprocess-file-styles ()
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
252 "Function that post processes relevant file local variables.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
253 Currently, this function simply applies any style and offset settings
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
254 found in the file's Local Variable list. It first applies any style
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
255 setting found in `c-file-style', then it applies any offset settings
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
256 it finds in `c-file-offsets'."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
257 ;; apply file styles and offsets
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
258 (and c-file-style
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
259 (c-set-style c-file-style))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
260 (and c-file-offsets
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
261 (mapcar
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
262 (function
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
263 (lambda (langentry)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
264 (let ((langelem (car langentry))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
265 (offset (cdr langentry)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
266 (c-set-offset langelem offset)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
267 )))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
268 c-file-offsets)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
269
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
270 (add-hook 'hack-local-variables-hook 'c-postprocess-file-styles)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
271
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
272
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
273 ;; Common routines
175
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 171
diff changeset
274 (defun c-make-inherited-keymap ()
165
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
275 (let ((map (make-sparse-keymap)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
276 (cond
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
277 ;; XEmacs 19 & 20
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
278 ((fboundp 'set-keymap-parents)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
279 (set-keymap-parents map c-mode-base-map))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
280 ;; Emacs 19
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
281 ((fboundp 'set-keymap-parent)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
282 (set-keymap-parent map c-mode-base-map))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
283 ;; incompatible
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
284 (t (error "CC Mode is incompatible with this version of Emacs")))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
285 map))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
286
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
287 (defun c-populate-syntax-table (table)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
288 ;; Populate the syntax TABLE
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
289 ;; DO NOT TRY TO SET _ (UNDERSCORE) TO WORD CLASS!
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
290 (modify-syntax-entry ?_ "_" table)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
291 (modify-syntax-entry ?\\ "\\" table)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
292 (modify-syntax-entry ?+ "." table)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
293 (modify-syntax-entry ?- "." table)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
294 (modify-syntax-entry ?= "." table)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
295 (modify-syntax-entry ?% "." table)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
296 (modify-syntax-entry ?< "." table)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
297 (modify-syntax-entry ?> "." table)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
298 (modify-syntax-entry ?& "." table)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
299 (modify-syntax-entry ?| "." table)
181
bfd6434d15b3 Import from CVS: tag r20-3b17
cvs
parents: 177
diff changeset
300 (modify-syntax-entry ?\' "\"" table)
bfd6434d15b3 Import from CVS: tag r20-3b17
cvs
parents: 177
diff changeset
301 ;; Set up block and line oriented comments. The new C standard
bfd6434d15b3 Import from CVS: tag r20-3b17
cvs
parents: 177
diff changeset
302 ;; mandates both comment styles even in C, so since all languages
bfd6434d15b3 Import from CVS: tag r20-3b17
cvs
parents: 177
diff changeset
303 ;; now require dual comments, we make this the default.
165
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
304 (cond
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
305 ;; XEmacs 19 & 20
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
306 ((memq '8-bit c-emacs-features)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
307 (modify-syntax-entry ?/ ". 1456" table)
181
bfd6434d15b3 Import from CVS: tag r20-3b17
cvs
parents: 177
diff changeset
308 (modify-syntax-entry ?* ". 23" table))
bfd6434d15b3 Import from CVS: tag r20-3b17
cvs
parents: 177
diff changeset
309 ;; Emacs 19 & 20
165
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
310 ((memq '1-bit c-emacs-features)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
311 (modify-syntax-entry ?/ ". 124b" table)
181
bfd6434d15b3 Import from CVS: tag r20-3b17
cvs
parents: 177
diff changeset
312 (modify-syntax-entry ?* ". 23" table))
165
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
313 ;; incompatible
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
314 (t (error "CC Mode is incompatible with this version of Emacs"))
181
bfd6434d15b3 Import from CVS: tag r20-3b17
cvs
parents: 177
diff changeset
315 )
bfd6434d15b3 Import from CVS: tag r20-3b17
cvs
parents: 177
diff changeset
316 (modify-syntax-entry ?\n "> b" table)
bfd6434d15b3 Import from CVS: tag r20-3b17
cvs
parents: 177
diff changeset
317 ;; Give CR the same syntax as newline, for selective-display
bfd6434d15b3 Import from CVS: tag r20-3b17
cvs
parents: 177
diff changeset
318 (modify-syntax-entry ?\^m "> b" table))
bfd6434d15b3 Import from CVS: tag r20-3b17
cvs
parents: 177
diff changeset
319
165
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
320
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
321 (defvar c-mode-base-map ()
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
322 "Keymap shared by all CC Mode related modes.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
323
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
324 (if c-mode-base-map
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
325 nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
326 ;; TBD: should we even worry about naming this keymap. My vote: no,
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
327 ;; because Emacs and XEmacs do it differently.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
328 (setq c-mode-base-map (make-sparse-keymap))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
329 ;; put standard keybindings into MAP
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
330 ;; the following mappings correspond more or less directly to BOCM
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
331 (define-key c-mode-base-map "{" 'c-electric-brace)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
332 (define-key c-mode-base-map "}" 'c-electric-brace)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
333 (define-key c-mode-base-map ";" 'c-electric-semi&comma)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
334 (define-key c-mode-base-map "#" 'c-electric-pound)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
335 (define-key c-mode-base-map ":" 'c-electric-colon)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
336 ;; Lucid Emacs 19.9 defined these two, the second of which was
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
337 ;; commented out...
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
338 ;; (define-key c-mode-base-map "\e{" 'c-insert-braces)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
339 ;; Commented out electric square brackets because nobody likes them.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
340 ;; (define-key c-mode-base-map "[" 'c-insert-brackets)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
341 (define-key c-mode-base-map "\C-c\C-m" 'c-mark-function)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
342 (define-key c-mode-base-map "\e\C-q" 'c-indent-exp)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
343 (define-key c-mode-base-map "\ea" 'c-beginning-of-statement)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
344 (define-key c-mode-base-map "\ee" 'c-end-of-statement)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
345 (define-key c-mode-base-map "\C-c\C-n" 'c-forward-conditional)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
346 (define-key c-mode-base-map "\C-c\C-p" 'c-backward-conditional)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
347 (define-key c-mode-base-map "\C-c\C-u" 'c-up-conditional)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
348 (define-key c-mode-base-map "\t" 'c-indent-command)
171
929b76928fce Import from CVS: tag r20-3b12
cvs
parents: 167
diff changeset
349 ;; Caution! Enter here at your own risk. We are trying to support
929b76928fce Import from CVS: tag r20-3b12
cvs
parents: 167
diff changeset
350 ;; several behaviors and it gets disgusting. :-(
929b76928fce Import from CVS: tag r20-3b12
cvs
parents: 167
diff changeset
351 ;;
929b76928fce Import from CVS: tag r20-3b12
cvs
parents: 167
diff changeset
352 ;; In XEmacs 19, Emacs 19, and Emacs 20, we use this to bind
929b76928fce Import from CVS: tag r20-3b12
cvs
parents: 167
diff changeset
353 ;; backwards deletion behavior to DEL, which both Delete and
929b76928fce Import from CVS: tag r20-3b12
cvs
parents: 167
diff changeset
354 ;; Backspace get translated to. There's no way to separate this
929b76928fce Import from CVS: tag r20-3b12
cvs
parents: 167
diff changeset
355 ;; behavior in a clean way, so deal with it! Besides, it's been
929b76928fce Import from CVS: tag r20-3b12
cvs
parents: 167
diff changeset
356 ;; this way since the dawn of BOCM.
929b76928fce Import from CVS: tag r20-3b12
cvs
parents: 167
diff changeset
357 (if (not (boundp 'delete-key-deletes-forward))
929b76928fce Import from CVS: tag r20-3b12
cvs
parents: 167
diff changeset
358 (define-key c-mode-base-map "\177" 'c-electric-backspace)
929b76928fce Import from CVS: tag r20-3b12
cvs
parents: 167
diff changeset
359 ;; However, XEmacs 20 actually achieved enlightenment. It is
929b76928fce Import from CVS: tag r20-3b12
cvs
parents: 167
diff changeset
360 ;; possible to sanely define both backward and forward deletion
929b76928fce Import from CVS: tag r20-3b12
cvs
parents: 167
diff changeset
361 ;; behavior under X separately (TTYs are forever beyond hope, but
929b76928fce Import from CVS: tag r20-3b12
cvs
parents: 167
diff changeset
362 ;; who cares? XEmacs 20 does the right thing with these too).
929b76928fce Import from CVS: tag r20-3b12
cvs
parents: 167
diff changeset
363 (define-key c-mode-base-map [delete] 'c-electric-delete)
929b76928fce Import from CVS: tag r20-3b12
cvs
parents: 167
diff changeset
364 (define-key c-mode-base-map [backspace] 'c-electric-backspace))
165
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
365 ;; these are new keybindings, with no counterpart to BOCM
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
366 (define-key c-mode-base-map "," 'c-electric-semi&comma)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
367 (define-key c-mode-base-map "*" 'c-electric-star)
181
bfd6434d15b3 Import from CVS: tag r20-3b17
cvs
parents: 177
diff changeset
368 (define-key c-mode-base-map "/" 'c-electric-slash)
165
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
369 (define-key c-mode-base-map "\C-c\C-q" 'c-indent-defun)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
370 (define-key c-mode-base-map "\C-c\C-\\" 'c-backslash-region)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
371 ;; TBD: where if anywhere, to put c-backward|forward-into-nomenclature
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
372 (define-key c-mode-base-map "\C-c\C-a" 'c-toggle-auto-state)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
373 (define-key c-mode-base-map "\C-c\C-b" 'c-submit-bug-report)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
374 (define-key c-mode-base-map "\C-c\C-c" 'comment-region)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
375 (define-key c-mode-base-map "\C-c\C-d" 'c-toggle-hungry-state)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
376 (define-key c-mode-base-map "\C-c\C-o" 'c-set-offset)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
377 (define-key c-mode-base-map "\C-c\C-s" 'c-show-syntactic-information)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
378 (define-key c-mode-base-map "\C-c\C-t" 'c-toggle-auto-hungry-state)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
379 (define-key c-mode-base-map "\C-c." 'c-set-style)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
380 ;; conflicts with OOBR
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
381 ;;(define-key c-mode-base-map "\C-c\C-v" 'c-version)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
382 )
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
383
171
929b76928fce Import from CVS: tag r20-3b12
cvs
parents: 167
diff changeset
384 ;; menu support for both XEmacs and Emacs. If you don't have easymenu
929b76928fce Import from CVS: tag r20-3b12
cvs
parents: 167
diff changeset
385 ;; with your version of Emacs, you are incompatible!
929b76928fce Import from CVS: tag r20-3b12
cvs
parents: 167
diff changeset
386 (require 'easymenu)
929b76928fce Import from CVS: tag r20-3b12
cvs
parents: 167
diff changeset
387
929b76928fce Import from CVS: tag r20-3b12
cvs
parents: 167
diff changeset
388 (defvar c-c-menu nil)
929b76928fce Import from CVS: tag r20-3b12
cvs
parents: 167
diff changeset
389 (defvar c-c++-menu nil)
929b76928fce Import from CVS: tag r20-3b12
cvs
parents: 167
diff changeset
390 (defvar c-objc-menu nil)
929b76928fce Import from CVS: tag r20-3b12
cvs
parents: 167
diff changeset
391 (defvar c-java-menu nil)
929b76928fce Import from CVS: tag r20-3b12
cvs
parents: 167
diff changeset
392
929b76928fce Import from CVS: tag r20-3b12
cvs
parents: 167
diff changeset
393 (defun c-mode-menu (modestr)
929b76928fce Import from CVS: tag r20-3b12
cvs
parents: 167
diff changeset
394 (let ((m
929b76928fce Import from CVS: tag r20-3b12
cvs
parents: 167
diff changeset
395 '(["Comment Out Region" comment-region (mark)]
175
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 171
diff changeset
396 ["Uncomment Region"
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 171
diff changeset
397 (comment-region (region-beginning) (region-end) '(4))
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 171
diff changeset
398 (mark)]
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 171
diff changeset
399 ["Fill Comment Paragraph" c-fill-paragraph t]
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 171
diff changeset
400 "---"
171
929b76928fce Import from CVS: tag r20-3b12
cvs
parents: 167
diff changeset
401 ["Indent Expression" c-indent-exp
929b76928fce Import from CVS: tag r20-3b12
cvs
parents: 167
diff changeset
402 (memq (char-after) '(?\( ?\[ ?\{))]
929b76928fce Import from CVS: tag r20-3b12
cvs
parents: 167
diff changeset
403 ["Indent Line" c-indent-command t]
929b76928fce Import from CVS: tag r20-3b12
cvs
parents: 167
diff changeset
404 ["Up Conditional" c-up-conditional t]
929b76928fce Import from CVS: tag r20-3b12
cvs
parents: 167
diff changeset
405 ["Backward Conditional" c-backward-conditional t]
929b76928fce Import from CVS: tag r20-3b12
cvs
parents: 167
diff changeset
406 ["Forward Conditional" c-forward-conditional t]
929b76928fce Import from CVS: tag r20-3b12
cvs
parents: 167
diff changeset
407 ["Backward Statement" c-beginning-of-statement t]
929b76928fce Import from CVS: tag r20-3b12
cvs
parents: 167
diff changeset
408 ["Forward Statement" c-end-of-statement t]
175
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 171
diff changeset
409 "---"
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 171
diff changeset
410 ["Macro Expand Region" c-macro-expand (mark)]
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 171
diff changeset
411 ["Backslashify" c-backslash-region (mark)]
171
929b76928fce Import from CVS: tag r20-3b12
cvs
parents: 167
diff changeset
412 )))
929b76928fce Import from CVS: tag r20-3b12
cvs
parents: 167
diff changeset
413 (cons modestr m)))
929b76928fce Import from CVS: tag r20-3b12
cvs
parents: 167
diff changeset
414
165
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
415
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
416
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
417 ;; Support for C
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
418
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
419 (defvar c-mode-abbrev-table nil
177
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 175
diff changeset
420 "Abbreviation table used in c-mode buffers.")
165
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
421 (define-abbrev-table 'c-mode-abbrev-table ())
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
422
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
423 (defvar c-mode-map ()
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
424 "Keymap used in c-mode buffers.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
425 (if c-mode-map
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
426 nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
427 (setq c-mode-map (c-make-inherited-keymap))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
428 ;; add bindings which are only useful for C
187
b405438285a2 Import from CVS: tag r20-3b20
cvs
parents: 183
diff changeset
429 (define-key c-mode-map "\C-c\C-e" 'c-macro-expand)
165
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
430 )
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
431
167
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents: 165
diff changeset
432 ;;;###autoload
165
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
433 (defvar c-mode-syntax-table nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
434 "Syntax table used in c-mode buffers.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
435 (if c-mode-syntax-table
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
436 ()
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
437 (setq c-mode-syntax-table (make-syntax-table))
181
bfd6434d15b3 Import from CVS: tag r20-3b17
cvs
parents: 177
diff changeset
438 (c-populate-syntax-table c-mode-syntax-table))
165
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
439
171
929b76928fce Import from CVS: tag r20-3b12
cvs
parents: 167
diff changeset
440 (easy-menu-define c-c-menu c-mode-map "C Mode Commands"
929b76928fce Import from CVS: tag r20-3b12
cvs
parents: 167
diff changeset
441 (c-mode-menu "C"))
165
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
442
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
443
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
444 ;; Support for C++
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
445
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
446 (defvar c++-mode-abbrev-table nil
177
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 175
diff changeset
447 "Abbreviation table used in c++-mode buffers.")
165
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
448 (define-abbrev-table 'c++-mode-abbrev-table ())
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
449
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
450 (defvar c++-mode-map ()
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
451 "Keymap used in c++-mode buffers.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
452 (if c++-mode-map
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
453 nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
454 (setq c++-mode-map (c-make-inherited-keymap))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
455 ;; add bindings which are only useful for C++
187
b405438285a2 Import from CVS: tag r20-3b20
cvs
parents: 183
diff changeset
456 (define-key c++-mode-map "\C-c\C-e" 'c-macro-expand)
b405438285a2 Import from CVS: tag r20-3b20
cvs
parents: 183
diff changeset
457 (define-key c++-mode-map "\C-c:" 'c-scope-operator)
b405438285a2 Import from CVS: tag r20-3b20
cvs
parents: 183
diff changeset
458 (define-key c++-mode-map "<" 'c-electric-lt-gt)
b405438285a2 Import from CVS: tag r20-3b20
cvs
parents: 183
diff changeset
459 (define-key c++-mode-map ">" 'c-electric-lt-gt))
165
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
460
181
bfd6434d15b3 Import from CVS: tag r20-3b17
cvs
parents: 177
diff changeset
461 ;;;###autoload
165
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
462 (defvar c++-mode-syntax-table nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
463 "Syntax table used in c++-mode buffers.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
464 (if c++-mode-syntax-table
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
465 ()
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
466 (setq c++-mode-syntax-table (make-syntax-table))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
467 (c-populate-syntax-table c++-mode-syntax-table)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
468 ;; TBD: does it make sense for colon to be symbol class in C++?
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
469 ;; I'm not so sure, since c-label-key is busted on lines like:
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
470 ;; Foo::bar( i );
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
471 ;; maybe c-label-key should be fixed instead of commenting this out,
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
472 ;; but it also bothers me that this only seems appropriate for C++
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
473 ;; and not C.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
474 ;;(modify-syntax-entry ?: "_" c++-mode-syntax-table)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
475 )
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
476
171
929b76928fce Import from CVS: tag r20-3b12
cvs
parents: 167
diff changeset
477 (easy-menu-define c-c++-menu c++-mode-map "C++ Mode Commands"
929b76928fce Import from CVS: tag r20-3b12
cvs
parents: 167
diff changeset
478 (c-mode-menu "C++"))
165
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
479
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
480
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
481 ;; Support for Objective-C
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
482
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
483 (defvar objc-mode-abbrev-table nil
177
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 175
diff changeset
484 "Abbreviation table used in objc-mode buffers.")
165
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
485 (define-abbrev-table 'objc-mode-abbrev-table ())
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
486
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
487 (defvar objc-mode-map ()
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
488 "Keymap used in objc-mode buffers.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
489 (if objc-mode-map
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
490 nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
491 (setq objc-mode-map (c-make-inherited-keymap))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
492 ;; add bindings which are only useful for Objective-C
187
b405438285a2 Import from CVS: tag r20-3b20
cvs
parents: 183
diff changeset
493 (define-key objc-mode-map "\C-c\C-e" 'c-macro-expand))
165
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
494
181
bfd6434d15b3 Import from CVS: tag r20-3b17
cvs
parents: 177
diff changeset
495 ;;;###autoload
165
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
496 (defvar objc-mode-syntax-table nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
497 "Syntax table used in objc-mode buffers.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
498 (if objc-mode-syntax-table
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
499 ()
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
500 (setq objc-mode-syntax-table (make-syntax-table))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
501 (c-populate-syntax-table objc-mode-syntax-table)
181
bfd6434d15b3 Import from CVS: tag r20-3b17
cvs
parents: 177
diff changeset
502 ;; add extra Objective-C only syntax
bfd6434d15b3 Import from CVS: tag r20-3b17
cvs
parents: 177
diff changeset
503 (modify-syntax-entry ?@ "_" objc-mode-syntax-table))
165
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
504
171
929b76928fce Import from CVS: tag r20-3b12
cvs
parents: 167
diff changeset
505 (easy-menu-define c-objc-menu objc-mode-map "ObjC Mode Commands"
929b76928fce Import from CVS: tag r20-3b12
cvs
parents: 167
diff changeset
506 (c-mode-menu "ObjC"))
165
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
507
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
508
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
509 ;; Support for Java
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
510
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
511 (defvar java-mode-abbrev-table nil
177
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 175
diff changeset
512 "Abbreviation table used in java-mode buffers.")
165
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
513 (define-abbrev-table 'java-mode-abbrev-table ())
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
514
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
515 (defvar java-mode-map ()
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
516 "Keymap used in java-mode buffers.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
517 (if java-mode-map
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
518 nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
519 (setq java-mode-map (c-make-inherited-keymap))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
520 ;; add bindings which are only useful for Java
187
b405438285a2 Import from CVS: tag r20-3b20
cvs
parents: 183
diff changeset
521 )
165
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
522
181
bfd6434d15b3 Import from CVS: tag r20-3b17
cvs
parents: 177
diff changeset
523 ;;;###autoload
165
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
524 (defvar java-mode-syntax-table nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
525 "Syntax table used in java-mode buffers.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
526 (if java-mode-syntax-table
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
527 ()
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
528 (setq java-mode-syntax-table (make-syntax-table))
181
bfd6434d15b3 Import from CVS: tag r20-3b17
cvs
parents: 177
diff changeset
529 (c-populate-syntax-table java-mode-syntax-table))
165
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
530
171
929b76928fce Import from CVS: tag r20-3b12
cvs
parents: 167
diff changeset
531 (easy-menu-define c-java-menu java-mode-map "Java Mode Commands"
929b76928fce Import from CVS: tag r20-3b12
cvs
parents: 167
diff changeset
532 (c-mode-menu "Java"))
165
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
533
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
534
177
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 175
diff changeset
535 ;; Support for CORBA's IDL language
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 175
diff changeset
536
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 175
diff changeset
537 (defvar idl-mode-abbrev-table nil
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 175
diff changeset
538 "Abbreviation table used in idl-mode buffers.")
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 175
diff changeset
539 (define-abbrev-table 'idl-mode-abbrev-table ())
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 175
diff changeset
540
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 175
diff changeset
541 (defvar idl-mode-map ()
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 175
diff changeset
542 "Keymap used in idl-mode buffers.")
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 175
diff changeset
543 (if idl-mode-map
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 175
diff changeset
544 nil
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 175
diff changeset
545 (setq idl-mode-map (c-make-inherited-keymap))
187
b405438285a2 Import from CVS: tag r20-3b20
cvs
parents: 183
diff changeset
546 ;; add bindings which are only useful for IDL
b405438285a2 Import from CVS: tag r20-3b20
cvs
parents: 183
diff changeset
547 )
177
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 175
diff changeset
548
181
bfd6434d15b3 Import from CVS: tag r20-3b17
cvs
parents: 177
diff changeset
549 ;;;###autoload
177
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 175
diff changeset
550 (defvar idl-mode-syntax-table nil
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 175
diff changeset
551 "Syntax table used in idl-mode buffers.")
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 175
diff changeset
552 (if idl-mode-syntax-table
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 175
diff changeset
553 nil
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 175
diff changeset
554 (setq idl-mode-syntax-table (make-syntax-table))
181
bfd6434d15b3 Import from CVS: tag r20-3b17
cvs
parents: 177
diff changeset
555 (c-populate-syntax-table idl-mode-syntax-table))
177
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 175
diff changeset
556
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 175
diff changeset
557 (easy-menu-define c-idl-menu idl-mode-map "IDL Mode Commands"
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 175
diff changeset
558 (c-mode-menu "IDL"))
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 175
diff changeset
559
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 175
diff changeset
560
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 175
diff changeset
561
165
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
562 (provide 'cc-langs)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
563 ;;; cc-langs.el ends here