annotate lisp/progmodes/cc-langs.el @ 32799:8c6128d7324f

*** empty log message ***
author Kenichi Handa <handa@m17n.org>
date Tue, 24 Oct 2000 04:38:25 +0000
parents cc4564c9cd55
children 9e4506dd912e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1 ;;; cc-langs.el --- specific language support for CC Mode
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2
30402
cc4564c9cd55 (c-append-paragraph-start): New variable used by
Gerd Moellmann <gerd@gnu.org>
parents: 26817
diff changeset
3 ;; Copyright (C) 1985,1987,1992-2000 Free Software Foundation, Inc.
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4
30402
cc4564c9cd55 (c-append-paragraph-start): New variable used by
Gerd Moellmann <gerd@gnu.org>
parents: 26817
diff changeset
5 ;; Authors: 2000- Martin Stjernholm
cc4564c9cd55 (c-append-paragraph-start): New variable used by
Gerd Moellmann <gerd@gnu.org>
parents: 26817
diff changeset
6 ;; 1998-1999 Barry A. Warsaw and Martin Stjernholm
24282
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 22423
diff changeset
7 ;; 1992-1997 Barry A. Warsaw
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8 ;; 1987 Dave Detlefs and Stewart Clamen
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9 ;; 1985 Richard M. Stallman
24282
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 22423
diff changeset
10 ;; Maintainer: bug-cc-mode@gnu.org
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11 ;; Created: 22-Apr-1997 (split from cc-mode.el)
20141
1a85b213eb6d Remove version number.
Karl Heuer <kwzh@gnu.org>
parents: 20138
diff changeset
12 ;; Version: See cc-mode.el
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13 ;; Keywords: c languages oop
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15 ;; This file is part of GNU Emacs.
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
17 ;; GNU Emacs is free software; you can redistribute it and/or modify
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
18 ;; it under the terms of the GNU General Public License as published by
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
19 ;; the Free Software Foundation; either version 2, or (at your option)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
20 ;; any later version.
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
21
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
22 ;; GNU Emacs is distributed in the hope that it will be useful,
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
23 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
24 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
25 ;; GNU General Public License for more details.
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
26
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
27 ;; You should have received a copy of the GNU General Public License
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
28 ;; along with GNU Emacs; see the file COPYING. If not, write to the
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
29 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
30 ;; Boston, MA 02111-1307, USA.
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
31
26817
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
32 (eval-when-compile
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
33 (let ((load-path
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
34 (if (and (boundp 'byte-compile-current-file)
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
35 (stringp byte-compile-current-file))
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
36 (cons (file-name-directory byte-compile-current-file)
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
37 load-path)
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
38 load-path)))
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
39 (load "cc-defs" nil t)))
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
40 (require 'cc-styles)
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
41
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
42 ;; Pull in some other packages.
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
43 (eval-when-compile
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
44 (condition-case nil
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
45 ;; Not required and only needed during compilation to shut up
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
46 ;; the compiler.
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
47 (require 'outline)
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
48 (error nil)))
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
49 ;; menu support for both XEmacs and Emacs. If you don't have easymenu
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
50 ;; with your version of Emacs, you are incompatible!
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
51 (require 'easymenu)
18842
72c2475ece1c Require 'cc-defs for the definition of c-emacs-features.
Richard M. Stallman <rms@gnu.org>
parents: 18772
diff changeset
52
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
53
26817
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
54 (defvar c-buffer-is-cc-mode nil
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
55 "Non-nil for all buffers with a `major-mode' derived from CC Mode.
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
56 Otherwise, this variable is nil. I.e. this variable is non-nil for
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
57 `c-mode', `c++-mode', `objc-mode', `java-mode', `idl-mode',
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
58 `pike-mode', and any other non-CC Mode mode that calls
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
59 `c-initialize-cc-mode' (e.g. `awk-mode').")
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
60 (make-variable-buffer-local 'c-buffer-is-cc-mode)
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
61 (put 'c-buffer-is-cc-mode 'permanent-local t)
18772
d8ccd2413041 Require cc-defs.
Richard M. Stallman <rms@gnu.org>
parents: 18720
diff changeset
62
26817
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
63
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
64 ;; Regular expressions and other values which must be parameterized on
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
65 ;; a per-language basis.
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
66
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
67 ;; Keywords defining protection levels
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
68 (defconst c-protection-key "\\<\\(public\\|protected\\|private\\)\\>")
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
69
18842
72c2475ece1c Require 'cc-defs for the definition of c-emacs-features.
Richard M. Stallman <rms@gnu.org>
parents: 18772
diff changeset
70 ;; Regex describing a `symbol' in all languages. We cannot use just
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
71 ;; `word' syntax class since `_' cannot be in word class. Putting
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
72 ;; underscore in word class breaks forward word movement behavior that
18842
72c2475ece1c Require 'cc-defs for the definition of c-emacs-features.
Richard M. Stallman <rms@gnu.org>
parents: 18772
diff changeset
73 ;; users are familiar with. Besides, this runs counter to Emacs
72c2475ece1c Require 'cc-defs for the definition of c-emacs-features.
Richard M. Stallman <rms@gnu.org>
parents: 18772
diff changeset
74 ;; convention.
72c2475ece1c Require 'cc-defs for the definition of c-emacs-features.
Richard M. Stallman <rms@gnu.org>
parents: 18772
diff changeset
75 ;;
72c2475ece1c Require 'cc-defs for the definition of c-emacs-features.
Richard M. Stallman <rms@gnu.org>
parents: 18772
diff changeset
76 ;; I suspect this definition isn't correct in light of Java's
72c2475ece1c Require 'cc-defs for the definition of c-emacs-features.
Richard M. Stallman <rms@gnu.org>
parents: 18772
diff changeset
77 ;; definition of a symbol as being Unicode. I know so little about
72c2475ece1c Require 'cc-defs for the definition of c-emacs-features.
Richard M. Stallman <rms@gnu.org>
parents: 18772
diff changeset
78 ;; I18N (except how to sound cool and say I18N :-) that I'm willing to
72c2475ece1c Require 'cc-defs for the definition of c-emacs-features.
Richard M. Stallman <rms@gnu.org>
parents: 18772
diff changeset
79 ;; punt on this for now.
72c2475ece1c Require 'cc-defs for the definition of c-emacs-features.
Richard M. Stallman <rms@gnu.org>
parents: 18772
diff changeset
80
72c2475ece1c Require 'cc-defs for the definition of c-emacs-features.
Richard M. Stallman <rms@gnu.org>
parents: 18772
diff changeset
81 (defconst c-symbol-key "[_a-zA-Z]\\(\\w\\|\\s_\\)*")
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
82
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
83
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
84 ;; keywords introducing class definitions. language specific
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
85 (defconst c-C-class-key "\\(struct\\|union\\)")
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
86 (defconst c-C++-class-key "\\(class\\|struct\\|union\\)")
26817
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
87 (defconst c-IDL-class-key "\\(interface\\|struct\\|union\\|valuetype\\)")
24282
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 22423
diff changeset
88 (defconst c-C-extra-toplevel-key "\\(extern\\)")
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 22423
diff changeset
89 (defconst c-C++-extra-toplevel-key "\\(extern\\|namespace\\)")
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 22423
diff changeset
90 (defconst c-IDL-extra-toplevel-key "\\(module\\)")
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
91
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
92 (defconst c-ObjC-class-key
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
93 (concat
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
94 "@\\(interface\\|implementation\\)\\s +"
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
95 c-symbol-key ;name of the class
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
96 "\\(\\s *:\\s *" c-symbol-key "\\)?" ;maybe followed by the superclass
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
97 "\\(\\s *<[^>]+>\\)?" ;and maybe the adopted protocols list
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
98 ))
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
99
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
100 (defconst c-Java-class-key
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
101 (concat
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
102 "\\(" c-protection-key "\\s +\\)?"
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
103 "\\(interface\\|class\\)\\s +"
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
104 c-symbol-key ;name of the class
24282
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 22423
diff changeset
105 "\\(\\s *extends\\s *" c-symbol-key "\\)?" ;maybe followed by superclass
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
106 ;;"\\(\\s *implements *[^{]+{\\)?" ;maybe the adopted protocols list
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
107 ))
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
108
24282
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 22423
diff changeset
109 (defconst c-Pike-class-key "class")
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 22423
diff changeset
110
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
111 (defvar c-class-key c-C-class-key)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
112 (make-variable-buffer-local 'c-class-key)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
113
20915
c746c93c9c95 (c-postprocess-file-styles): If a file style or file offsets are set,
Richard M. Stallman <rms@gnu.org>
parents: 20141
diff changeset
114 (defvar c-extra-toplevel-key c-C-extra-toplevel-key)
c746c93c9c95 (c-postprocess-file-styles): If a file style or file offsets are set,
Richard M. Stallman <rms@gnu.org>
parents: 20141
diff changeset
115 (make-variable-buffer-local 'c-extra-toplevel-key)
c746c93c9c95 (c-postprocess-file-styles): If a file style or file offsets are set,
Richard M. Stallman <rms@gnu.org>
parents: 20141
diff changeset
116
26817
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
117 ;; Keywords that can introduce bitfields in the languages that supports that.
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
118 (defconst c-C-bitfield-key "\\(char\\|int\\|long\\|signed\\|unsigned\\)")
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
119
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
120 (defvar c-bitfield-key nil)
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
121 (make-variable-buffer-local 'c-bitfield-key)
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
122
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
123
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
124 ;; regexp describing access protection clauses. language specific
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
125 (defvar c-access-key nil)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
126 (make-variable-buffer-local 'c-access-key)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
127 (defconst c-C++-access-key (concat c-protection-key "[ \t]*:"))
26817
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
128 (defconst c-IDL-access-key nil)
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
129 (defconst c-ObjC-access-key (concat "@" c-protection-key))
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
130 (defconst c-Java-access-key nil)
24282
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 22423
diff changeset
131 (defconst c-Pike-access-key nil)
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
132
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
133
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
134 ;; keywords introducing conditional blocks
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
135 (defconst c-C-conditional-key nil)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
136 (defconst c-C++-conditional-key nil)
26817
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
137 (defconst c-IDL-conditional-key nil)
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
138 (defconst c-ObjC-conditional-key nil)
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
139 (defconst c-Java-conditional-key nil)
24282
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 22423
diff changeset
140 (defconst c-Pike-conditional-key nil)
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
141
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
142 (let ((all-kws "for\\|if\\|do\\|else\\|while\\|switch")
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
143 (exc-kws "\\|try\\|catch")
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
144 (thr-kws "\\|finally\\|synchronized")
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
145 (front "\\b\\(")
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
146 (back "\\)\\b[^_]"))
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
147 (setq c-C-conditional-key (concat front all-kws back)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
148 c-C++-conditional-key (concat front all-kws exc-kws back)
26817
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
149 ;; c-IDL-conditional-key is nil.
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
150 c-ObjC-conditional-key c-C-conditional-key
24282
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 22423
diff changeset
151 c-Java-conditional-key (concat front all-kws exc-kws thr-kws back)
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 22423
diff changeset
152 c-Pike-conditional-key (concat front all-kws "\\|foreach" back)))
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
153
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
154 (defvar c-conditional-key c-C-conditional-key)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
155 (make-variable-buffer-local 'c-conditional-key)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
156
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
157
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
158 ;; keywords describing method definition introductions
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
159 (defvar c-method-key nil)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
160 (make-variable-buffer-local 'c-method-key)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
161
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
162 (defconst c-ObjC-method-key
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
163 (concat
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
164 "^\\s *[+-]\\s *"
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
165 "\\(([^)]*)\\)?" ; return type
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
166 ;; \\s- in objc syntax table does not include \n
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
167 ;; since it is considered the end of //-comments.
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
168 "[ \t\n]*" c-symbol-key))
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
169
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
170
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
171
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
172 ;; comment starter definitions for various languages. language specific
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
173 (defconst c-C++-comment-start-regexp "/[/*]")
26817
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
174 (defconst c-C-comment-start-regexp c-C++-comment-start-regexp)
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
175 (defconst c-IDL-comment-start-regexp c-C++-comment-start-regexp)
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
176 (defconst c-ObjC-comment-start-regexp c-C++-comment-start-regexp)
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
177 (defconst c-Pike-comment-start-regexp c-C++-comment-start-regexp)
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
178 ;; We need to match all 3 Java style comments
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
179 ;; 1) Traditional C block; 2) javadoc /** ...; 3) C++ style
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
180 (defconst c-Java-comment-start-regexp "/\\(/\\|[*][*]?\\)")
19300
b07fa43938cc (c-mode-base-map, c++-mode-map):
Richard M. Stallman <rms@gnu.org>
parents: 19250
diff changeset
181 (defvar c-comment-start-regexp c-C++-comment-start-regexp)
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
182 (make-variable-buffer-local 'c-comment-start-regexp)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
183
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
184
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
185
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
186 ;; Regexp describing a switch's case or default label for all languages
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
187 (defconst c-switch-label-key "\\(\\(case[( \t]+\\S .*\\)\\|default[ \t]*\\):")
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
188 ;; Regexp describing any label.
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
189 (defconst c-label-key (concat c-symbol-key ":\\([^:]\\|$\\)"))
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
190
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
191 ;; Regexp describing class inheritance declarations. TBD: this should
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
192 ;; be language specific, and only makes sense for C++
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
193 (defconst c-inher-key
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
194 (concat "\\(\\<static\\>\\s +\\)?"
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
195 c-C++-class-key "[ \t]+" c-symbol-key
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
196 "\\([ \t]*:[ \t]*\\)\\s *[^;]"))
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
197
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
198 ;; Regexp describing C++ base classes in a derived class definition.
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
199 ;; TBD: this should be language specific, and only makes sense for C++
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
200 (defvar c-baseclass-key
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
201 (concat
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
202 ":?[ \t]*\\(virtual[ \t]+\\)?\\("
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
203 c-protection-key "[ \t]+\\)" c-symbol-key))
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
204 (make-variable-buffer-local 'c-baseclass-key)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
205
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
206 ;; Regexp describing friend declarations in C++ classes.
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
207 (defconst c-C++-friend-key
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
208 "friend[ \t]+\\|template[ \t]*<.+>[ \t]*friend[ \t]+")
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
209
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
210 ;; Regexp describing Java inheritance and throws clauses.
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
211 (defconst c-Java-special-key "\\(implements\\|extends\\|throws\\)[^_]")
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
212
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
213 ;; Regexp describing the beginning of a Java top-level definition.
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
214 (defconst c-Java-defun-prompt-regexp
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
215 "^[ \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-*")
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
216
30402
cc4564c9cd55 (c-append-paragraph-start): New variable used by
Gerd Moellmann <gerd@gnu.org>
parents: 26817
diff changeset
217 ;; Regexp describing regexp to append to paragraph-start
cc4564c9cd55 (c-append-paragraph-start): New variable used by
Gerd Moellmann <gerd@gnu.org>
parents: 26817
diff changeset
218 (defvar c-append-paragraph-start "$")
cc4564c9cd55 (c-append-paragraph-start): New variable used by
Gerd Moellmann <gerd@gnu.org>
parents: 26817
diff changeset
219 (make-variable-buffer-local 'c-append-paragraph-start)
21108
e3c68a6888f9 (c-Java-javadoc-paragraph-start): New variable for use in c-fill-paragraph.
Richard M. Stallman <rms@gnu.org>
parents: 20915
diff changeset
220 (defconst c-Java-javadoc-paragraph-start
30402
cc4564c9cd55 (c-append-paragraph-start): New variable used by
Gerd Moellmann <gerd@gnu.org>
parents: 26817
diff changeset
221 (concat "\\("
cc4564c9cd55 (c-append-paragraph-start): New variable used by
Gerd Moellmann <gerd@gnu.org>
parents: 26817
diff changeset
222 "@\\(author\\|deprecated\\|exception\\|param\\|return\\|"
cc4564c9cd55 (c-append-paragraph-start): New variable used by
Gerd Moellmann <gerd@gnu.org>
parents: 26817
diff changeset
223 "s\\(e\\(e\\|rial\\(\\|Data\\|Field\\)\\)\\|ince\\)\\|"
cc4564c9cd55 (c-append-paragraph-start): New variable used by
Gerd Moellmann <gerd@gnu.org>
parents: 26817
diff changeset
224 "throws\\|version\\)"
cc4564c9cd55 (c-append-paragraph-start): New variable used by
Gerd Moellmann <gerd@gnu.org>
parents: 26817
diff changeset
225 "\\|$\\)"))
21108
e3c68a6888f9 (c-Java-javadoc-paragraph-start): New variable for use in c-fill-paragraph.
Richard M. Stallman <rms@gnu.org>
parents: 20915
diff changeset
226
24282
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 22423
diff changeset
227 ;; Regexp that starts lambda constructs.
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 22423
diff changeset
228 (defvar c-lambda-key nil)
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 22423
diff changeset
229 (make-variable-buffer-local 'c-lambda-key)
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 22423
diff changeset
230 (defconst c-Pike-lambda-key "\\<lambda\\>")
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 22423
diff changeset
231
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 22423
diff changeset
232 ;; Regexp that are followed by a statement block in expressions.
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 22423
diff changeset
233 (defvar c-inexpr-block-key nil)
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 22423
diff changeset
234 (make-variable-buffer-local 'c-inexpr-block-key)
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 22423
diff changeset
235 (defconst c-Pike-inexpr-block-key "\\<\\(catch\\|gauge\\)\\>")
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 22423
diff changeset
236
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 22423
diff changeset
237 ;; Regexp that may be followed by an anonymous class in expressions.
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 22423
diff changeset
238 (defvar c-inexpr-class-key nil)
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 22423
diff changeset
239 (make-variable-buffer-local 'c-inexpr-class-key)
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 22423
diff changeset
240 (defconst c-Java-inexpr-class-key "\\<new\\>")
30402
cc4564c9cd55 (c-append-paragraph-start): New variable used by
Gerd Moellmann <gerd@gnu.org>
parents: 26817
diff changeset
241 (defconst c-Pike-inexpr-class-key "\\<class\\>")
24282
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 22423
diff changeset
242
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 22423
diff changeset
243 ;; List of open- and close-chars that makes up a pike-style brace
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 22423
diff changeset
244 ;; list, ie for a `([ ])' list there should be a cons (?\[ . ?\]) in
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 22423
diff changeset
245 ;; this list.
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 22423
diff changeset
246 (defvar c-special-brace-lists nil)
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 22423
diff changeset
247 (make-variable-buffer-local 'c-special-brace-lists)
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 22423
diff changeset
248 (defconst c-Pike-special-brace-lists '((?{ . ?})
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 22423
diff changeset
249 (?\[ . ?\])
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 22423
diff changeset
250 (?< . ?>)))
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 22423
diff changeset
251
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
252
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
253
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
254 ;; internal state variables
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
255
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
256 ;; Internal state of hungry delete key feature
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
257 (defvar c-hungry-delete-key nil)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
258 (make-variable-buffer-local 'c-hungry-delete-key)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
259
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
260 ;; Internal state of auto newline feature.
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
261 (defvar c-auto-newline nil)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
262 (make-variable-buffer-local 'c-auto-newline)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
263
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
264 ;; Internal auto-newline/hungry-delete designation string for mode line.
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
265 (defvar c-auto-hungry-string nil)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
266 (make-variable-buffer-local 'c-auto-hungry-string)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
267
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
268 ;; Non-nil means K&R style argument declarations are valid.
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
269 (defvar c-recognize-knr-p t)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
270 (make-variable-buffer-local 'c-recognize-knr-p)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
271
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
272
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
273
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
274 (defun c-common-init ()
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
275 ;; Common initializations for all modes.
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
276 ;; these variables should always be buffer local; they do not affect
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
277 ;; indentation style.
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
278 (make-local-variable 'require-final-newline)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
279 (make-local-variable 'parse-sexp-ignore-comments)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
280 (make-local-variable 'indent-line-function)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
281 (make-local-variable 'indent-region-function)
26817
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
282 (make-local-variable 'outline-regexp)
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
283 (make-local-variable 'outline-level)
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
284 (make-local-variable 'normal-auto-fill-function)
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
285 (make-local-variable 'comment-start)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
286 (make-local-variable 'comment-end)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
287 (make-local-variable 'comment-column)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
288 (make-local-variable 'comment-start-skip)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
289 (make-local-variable 'comment-multi-line)
26817
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
290 (make-local-variable 'paragraph-start)
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
291 (make-local-variable 'paragraph-separate)
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
292 (make-local-variable 'paragraph-ignore-fill-prefix)
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
293 (make-local-variable 'adaptive-fill-mode)
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
294 (make-local-variable 'adaptive-fill-regexp)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
295 (make-local-variable 'imenu-generic-expression) ;set in the mode functions
19300
b07fa43938cc (c-mode-base-map, c++-mode-map):
Richard M. Stallman <rms@gnu.org>
parents: 19250
diff changeset
296 ;; X/Emacs 20 only
b07fa43938cc (c-mode-base-map, c++-mode-map):
Richard M. Stallman <rms@gnu.org>
parents: 19250
diff changeset
297 (and (boundp 'comment-line-break-function)
26817
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
298 (progn
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
299 (make-local-variable 'comment-line-break-function)
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
300 (setq comment-line-break-function
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
301 'c-indent-new-comment-line)))
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
302 ;; now set their values
26817
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
303 (setq require-final-newline t
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
304 parse-sexp-ignore-comments t
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
305 indent-line-function 'c-indent-line
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
306 indent-region-function 'c-indent-region
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
307 outline-regexp "[^#\n\^M]"
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
308 outline-level 'c-outline-level
26817
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
309 normal-auto-fill-function 'c-do-auto-fill
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
310 comment-column 32
26817
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
311 comment-start-skip "/\\*+ *\\|//+ *"
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
312 comment-multi-line t)
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
313 ;; now set the mode style based on c-default-style
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
314 (let ((style (if (stringp c-default-style)
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
315 (if (c-major-mode-is 'java-mode)
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
316 "java"
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
317 c-default-style)
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
318 (or (cdr (assq major-mode c-default-style))
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
319 (cdr (assq 'other c-default-style))
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
320 "gnu"))))
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
321 ;; Override style variables if `c-old-style-variable-behavior' is
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
322 ;; set. Also override if we are using global style variables,
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
323 ;; have already initialized a style once, and are switching to a
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
324 ;; different style. (It's doubtful whether this is desirable, but
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
325 ;; the whole situation with nonlocal style variables is a bit
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
326 ;; awkward. It's at least the most compatible way with the old
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
327 ;; style init procedure.)
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
328 (c-set-style style (not (or c-old-style-variable-behavior
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
329 (and (not c-style-variables-are-local-p)
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
330 c-indentation-style
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
331 (not (string-equal c-indentation-style
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
332 style)))))))
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
333 ;; Fix things up for paragraph recognition and filling inside
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
334 ;; comments by using c-comment-prefix-regexp in the relevant places.
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
335 ;; We use adaptive filling for this to make it possible to use
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
336 ;; filladapt or some other fancy package.
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
337 (let ((comment-line-prefix
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
338 (concat "[ \t]*\\(" c-comment-prefix-regexp "\\)?[ \t]*")))
30402
cc4564c9cd55 (c-append-paragraph-start): New variable used by
Gerd Moellmann <gerd@gnu.org>
parents: 26817
diff changeset
339 (setq paragraph-start (concat comment-line-prefix
cc4564c9cd55 (c-append-paragraph-start): New variable used by
Gerd Moellmann <gerd@gnu.org>
parents: 26817
diff changeset
340 c-append-paragraph-start
cc4564c9cd55 (c-append-paragraph-start): New variable used by
Gerd Moellmann <gerd@gnu.org>
parents: 26817
diff changeset
341 "\\|"
26817
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
342 page-delimiter)
30402
cc4564c9cd55 (c-append-paragraph-start): New variable used by
Gerd Moellmann <gerd@gnu.org>
parents: 26817
diff changeset
343 paragraph-separate (concat comment-line-prefix "$"
cc4564c9cd55 (c-append-paragraph-start): New variable used by
Gerd Moellmann <gerd@gnu.org>
parents: 26817
diff changeset
344 "\\|"
cc4564c9cd55 (c-append-paragraph-start): New variable used by
Gerd Moellmann <gerd@gnu.org>
parents: 26817
diff changeset
345 page-delimiter)
26817
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
346 paragraph-ignore-fill-prefix t
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
347 adaptive-fill-mode t
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
348 adaptive-fill-regexp
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
349 (concat comment-line-prefix
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
350 (if adaptive-fill-regexp
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
351 (concat "\\(" adaptive-fill-regexp "\\)")
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
352 "")))
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
353 (when (boundp 'adaptive-fill-first-line-regexp)
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
354 ;; XEmacs (20.x) adaptive fill mode doesn't have this.
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
355 (make-local-variable 'adaptive-fill-first-line-regexp)
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
356 (setq adaptive-fill-first-line-regexp
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
357 (concat "\\`" comment-line-prefix
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
358 ;; Maybe we should incorporate the old value here,
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
359 ;; but then we have to do all sorts of kludges to
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
360 ;; deal with the \` and \' it probably contains.
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
361 "\\'"))))
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
362 ;; we have to do something special for c-offsets-alist so that the
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
363 ;; buffer local value has its own alist structure.
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
364 (setq c-offsets-alist (copy-alist c-offsets-alist))
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
365 ;; setup the comment indent variable in a Emacs version portable way
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
366 ;; ignore any byte compiler warnings you might get here
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
367 (make-local-variable 'comment-indent-function)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
368 (setq comment-indent-function 'c-comment-indent)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
369 ;; add menus to menubar
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
370 (easy-menu-add (c-mode-menu mode-name))
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
371 ;; put auto-hungry designators onto minor-mode-alist, but only once
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
372 (or (assq 'c-auto-hungry-string minor-mode-alist)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
373 (setq minor-mode-alist
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
374 (cons '(c-auto-hungry-string c-auto-hungry-string)
24282
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 22423
diff changeset
375 minor-mode-alist)))
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 22423
diff changeset
376 )
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 22423
diff changeset
377
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
378
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
379 (defun c-postprocess-file-styles ()
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
380 "Function that post processes relevant file local variables.
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
381 Currently, this function simply applies any style and offset settings
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
382 found in the file's Local Variable list. It first applies any style
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
383 setting found in `c-file-style', then it applies any offset settings
20915
c746c93c9c95 (c-postprocess-file-styles): If a file style or file offsets are set,
Richard M. Stallman <rms@gnu.org>
parents: 20141
diff changeset
384 it finds in `c-file-offsets'.
c746c93c9c95 (c-postprocess-file-styles): If a file style or file offsets are set,
Richard M. Stallman <rms@gnu.org>
parents: 20141
diff changeset
385
c746c93c9c95 (c-postprocess-file-styles): If a file style or file offsets are set,
Richard M. Stallman <rms@gnu.org>
parents: 20141
diff changeset
386 Note that the style variables are always made local to the buffer."
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
387 ;; apply file styles and offsets
20915
c746c93c9c95 (c-postprocess-file-styles): If a file style or file offsets are set,
Richard M. Stallman <rms@gnu.org>
parents: 20141
diff changeset
388 (if (or c-file-style c-file-offsets)
c746c93c9c95 (c-postprocess-file-styles): If a file style or file offsets are set,
Richard M. Stallman <rms@gnu.org>
parents: 20141
diff changeset
389 (c-make-styles-buffer-local t))
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
390 (and c-file-style
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
391 (c-set-style c-file-style))
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
392 (and c-file-offsets
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
393 (mapcar
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
394 (function
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
395 (lambda (langentry)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
396 (let ((langelem (car langentry))
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
397 (offset (cdr langentry)))
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
398 (c-set-offset langelem offset)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
399 )))
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
400 c-file-offsets)))
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
401
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
402 (add-hook 'hack-local-variables-hook 'c-postprocess-file-styles)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
403
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
404
24282
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 22423
diff changeset
405 (defvar c-mode-base-map ()
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 22423
diff changeset
406 "Keymap shared by all CC Mode related modes.")
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 22423
diff changeset
407
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
408 ;; Common routines
18842
72c2475ece1c Require 'cc-defs for the definition of c-emacs-features.
Richard M. Stallman <rms@gnu.org>
parents: 18772
diff changeset
409 (defun c-make-inherited-keymap ()
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
410 (let ((map (make-sparse-keymap)))
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
411 (cond
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
412 ;; XEmacs 19 & 20
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
413 ((fboundp 'set-keymap-parents)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
414 (set-keymap-parents map c-mode-base-map))
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
415 ;; Emacs 19
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
416 ((fboundp 'set-keymap-parent)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
417 (set-keymap-parent map c-mode-base-map))
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
418 ;; incompatible
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
419 (t (error "CC Mode is incompatible with this version of Emacs")))
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
420 map))
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
421
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
422 (defun c-populate-syntax-table (table)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
423 ;; Populate the syntax TABLE
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
424 ;; DO NOT TRY TO SET _ (UNDERSCORE) TO WORD CLASS!
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
425 (modify-syntax-entry ?_ "_" table)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
426 (modify-syntax-entry ?\\ "\\" table)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
427 (modify-syntax-entry ?+ "." table)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
428 (modify-syntax-entry ?- "." table)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
429 (modify-syntax-entry ?= "." table)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
430 (modify-syntax-entry ?% "." table)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
431 (modify-syntax-entry ?< "." table)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
432 (modify-syntax-entry ?> "." table)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
433 (modify-syntax-entry ?& "." table)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
434 (modify-syntax-entry ?| "." table)
19300
b07fa43938cc (c-mode-base-map, c++-mode-map):
Richard M. Stallman <rms@gnu.org>
parents: 19250
diff changeset
435 (modify-syntax-entry ?\' "\"" table)
b07fa43938cc (c-mode-base-map, c++-mode-map):
Richard M. Stallman <rms@gnu.org>
parents: 19250
diff changeset
436 ;; Set up block and line oriented comments. The new C standard
b07fa43938cc (c-mode-base-map, c++-mode-map):
Richard M. Stallman <rms@gnu.org>
parents: 19250
diff changeset
437 ;; mandates both comment styles even in C, so since all languages
b07fa43938cc (c-mode-base-map, c++-mode-map):
Richard M. Stallman <rms@gnu.org>
parents: 19250
diff changeset
438 ;; now require dual comments, we make this the default.
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
439 (cond
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
440 ;; XEmacs 19 & 20
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
441 ((memq '8-bit c-emacs-features)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
442 (modify-syntax-entry ?/ ". 1456" table)
19300
b07fa43938cc (c-mode-base-map, c++-mode-map):
Richard M. Stallman <rms@gnu.org>
parents: 19250
diff changeset
443 (modify-syntax-entry ?* ". 23" table))
b07fa43938cc (c-mode-base-map, c++-mode-map):
Richard M. Stallman <rms@gnu.org>
parents: 19250
diff changeset
444 ;; Emacs 19 & 20
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
445 ((memq '1-bit c-emacs-features)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
446 (modify-syntax-entry ?/ ". 124b" table)
19300
b07fa43938cc (c-mode-base-map, c++-mode-map):
Richard M. Stallman <rms@gnu.org>
parents: 19250
diff changeset
447 (modify-syntax-entry ?* ". 23" table))
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
448 ;; incompatible
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
449 (t (error "CC Mode is incompatible with this version of Emacs"))
19300
b07fa43938cc (c-mode-base-map, c++-mode-map):
Richard M. Stallman <rms@gnu.org>
parents: 19250
diff changeset
450 )
b07fa43938cc (c-mode-base-map, c++-mode-map):
Richard M. Stallman <rms@gnu.org>
parents: 19250
diff changeset
451 (modify-syntax-entry ?\n "> b" table)
b07fa43938cc (c-mode-base-map, c++-mode-map):
Richard M. Stallman <rms@gnu.org>
parents: 19250
diff changeset
452 ;; Give CR the same syntax as newline, for selective-display
b07fa43938cc (c-mode-base-map, c++-mode-map):
Richard M. Stallman <rms@gnu.org>
parents: 19250
diff changeset
453 (modify-syntax-entry ?\^m "> b" table))
b07fa43938cc (c-mode-base-map, c++-mode-map):
Richard M. Stallman <rms@gnu.org>
parents: 19250
diff changeset
454
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
455
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
456 (if c-mode-base-map
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
457 nil
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
458 ;; TBD: should we even worry about naming this keymap. My vote: no,
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
459 ;; because Emacs and XEmacs do it differently.
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
460 (setq c-mode-base-map (make-sparse-keymap))
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
461 ;; put standard keybindings into MAP
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
462 ;; the following mappings correspond more or less directly to BOCM
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
463 (define-key c-mode-base-map "{" 'c-electric-brace)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
464 (define-key c-mode-base-map "}" 'c-electric-brace)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
465 (define-key c-mode-base-map ";" 'c-electric-semi&comma)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
466 (define-key c-mode-base-map "#" 'c-electric-pound)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
467 (define-key c-mode-base-map ":" 'c-electric-colon)
24282
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 22423
diff changeset
468 (define-key c-mode-base-map "(" 'c-electric-paren)
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 22423
diff changeset
469 (define-key c-mode-base-map ")" 'c-electric-paren)
20915
c746c93c9c95 (c-postprocess-file-styles): If a file style or file offsets are set,
Richard M. Stallman <rms@gnu.org>
parents: 20141
diff changeset
470 ;; Separate M-BS from C-M-h. The former should remain
c746c93c9c95 (c-postprocess-file-styles): If a file style or file offsets are set,
Richard M. Stallman <rms@gnu.org>
parents: 20141
diff changeset
471 ;; backward-kill-word.
c746c93c9c95 (c-postprocess-file-styles): If a file style or file offsets are set,
Richard M. Stallman <rms@gnu.org>
parents: 20141
diff changeset
472 (define-key c-mode-base-map [(control meta h)] 'c-mark-function)
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
473 (define-key c-mode-base-map "\e\C-q" 'c-indent-exp)
26817
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
474 (substitute-key-definition 'backward-sentence
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
475 'c-beginning-of-statement
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
476 c-mode-base-map global-map)
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
477 (substitute-key-definition 'forward-sentence
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
478 'c-end-of-statement
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
479 c-mode-base-map global-map)
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
480 (substitute-key-definition 'indent-new-comment-line
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
481 'c-indent-new-comment-line
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
482 c-mode-base-map global-map)
20915
c746c93c9c95 (c-postprocess-file-styles): If a file style or file offsets are set,
Richard M. Stallman <rms@gnu.org>
parents: 20141
diff changeset
483 ;; RMS says don't make these the default.
c746c93c9c95 (c-postprocess-file-styles): If a file style or file offsets are set,
Richard M. Stallman <rms@gnu.org>
parents: 20141
diff changeset
484 ;; (define-key c-mode-base-map "\e\C-a" 'c-beginning-of-defun)
c746c93c9c95 (c-postprocess-file-styles): If a file style or file offsets are set,
Richard M. Stallman <rms@gnu.org>
parents: 20141
diff changeset
485 ;; (define-key c-mode-base-map "\e\C-e" 'c-end-of-defun)
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
486 (define-key c-mode-base-map "\C-c\C-n" 'c-forward-conditional)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
487 (define-key c-mode-base-map "\C-c\C-p" 'c-backward-conditional)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
488 (define-key c-mode-base-map "\C-c\C-u" 'c-up-conditional)
26817
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
489 (substitute-key-definition 'indent-for-tab-command
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
490 'c-indent-command
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
491 c-mode-base-map global-map)
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
492 ;; It doesn't suffice to put c-fill-paragraph on
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
493 ;; fill-paragraph-function due to the way it works.
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
494 (substitute-key-definition 'fill-paragraph 'c-fill-paragraph
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
495 c-mode-base-map global-map)
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
496 ;; In XEmacs the default fill function is called
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
497 ;; fill-paragraph-or-region.
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
498 (substitute-key-definition 'fill-paragraph-or-region 'c-fill-paragraph
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
499 c-mode-base-map global-map)
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
500 ;; Caution! Enter here at your own risk. We are trying to support
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
501 ;; several behaviors and it gets disgusting. :-(
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
502 ;;
26817
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
503 (if (boundp 'delete-key-deletes-forward)
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
504 (progn
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
505 ;; In XEmacs 20 it is possible to sanely define both backward
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
506 ;; and forward deletion behavior under X separately (TTYs are
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
507 ;; forever beyond hope, but who cares? XEmacs 20 does the
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
508 ;; right thing with these too).
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
509 (define-key c-mode-base-map [delete] 'c-electric-delete)
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
510 (define-key c-mode-base-map [backspace] 'c-electric-backspace))
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
511 ;; In XEmacs 19, Emacs 19, and Emacs 20, we use this to bind
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
512 ;; backwards deletion behavior to DEL, which both Delete and
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
513 ;; Backspace get translated to. There's no way to separate this
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
514 ;; behavior in a clean way, so deal with it! Besides, it's been
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
515 ;; this way since the dawn of BOCM.
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
516 (define-key c-mode-base-map "\177" 'c-electric-backspace))
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
517 ;; these are new keybindings, with no counterpart to BOCM
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
518 (define-key c-mode-base-map "," 'c-electric-semi&comma)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
519 (define-key c-mode-base-map "*" 'c-electric-star)
19300
b07fa43938cc (c-mode-base-map, c++-mode-map):
Richard M. Stallman <rms@gnu.org>
parents: 19250
diff changeset
520 (define-key c-mode-base-map "/" 'c-electric-slash)
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
521 (define-key c-mode-base-map "\C-c\C-q" 'c-indent-defun)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
522 (define-key c-mode-base-map "\C-c\C-\\" 'c-backslash-region)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
523 ;; TBD: where if anywhere, to put c-backward|forward-into-nomenclature
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
524 (define-key c-mode-base-map "\C-c\C-a" 'c-toggle-auto-state)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
525 (define-key c-mode-base-map "\C-c\C-b" 'c-submit-bug-report)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
526 (define-key c-mode-base-map "\C-c\C-c" 'comment-region)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
527 (define-key c-mode-base-map "\C-c\C-d" 'c-toggle-hungry-state)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
528 (define-key c-mode-base-map "\C-c\C-o" 'c-set-offset)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
529 (define-key c-mode-base-map "\C-c\C-s" 'c-show-syntactic-information)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
530 (define-key c-mode-base-map "\C-c\C-t" 'c-toggle-auto-hungry-state)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
531 (define-key c-mode-base-map "\C-c." 'c-set-style)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
532 ;; conflicts with OOBR
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
533 ;;(define-key c-mode-base-map "\C-c\C-v" 'c-version)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
534 )
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
535
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
536 (defvar c-c-menu nil)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
537 (defvar c-c++-menu nil)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
538 (defvar c-objc-menu nil)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
539 (defvar c-java-menu nil)
24282
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 22423
diff changeset
540 (defvar c-pike-menu nil)
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
541
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
542 (defun c-mode-menu (modestr)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
543 (let ((m
24282
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 22423
diff changeset
544 '(["Comment Out Region" comment-region (c-region-is-active-p)]
18842
72c2475ece1c Require 'cc-defs for the definition of c-emacs-features.
Richard M. Stallman <rms@gnu.org>
parents: 18772
diff changeset
545 ["Uncomment Region"
72c2475ece1c Require 'cc-defs for the definition of c-emacs-features.
Richard M. Stallman <rms@gnu.org>
parents: 18772
diff changeset
546 (comment-region (region-beginning) (region-end) '(4))
24282
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 22423
diff changeset
547 (c-region-is-active-p)]
18842
72c2475ece1c Require 'cc-defs for the definition of c-emacs-features.
Richard M. Stallman <rms@gnu.org>
parents: 18772
diff changeset
548 ["Fill Comment Paragraph" c-fill-paragraph t]
72c2475ece1c Require 'cc-defs for the definition of c-emacs-features.
Richard M. Stallman <rms@gnu.org>
parents: 18772
diff changeset
549 "---"
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
550 ["Indent Expression" c-indent-exp
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
551 (memq (char-after) '(?\( ?\[ ?\{))]
24282
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 22423
diff changeset
552 ["Indent Line or Region" c-indent-line-or-region t]
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
553 ["Up Conditional" c-up-conditional t]
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
554 ["Backward Conditional" c-backward-conditional t]
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
555 ["Forward Conditional" c-forward-conditional t]
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
556 ["Backward Statement" c-beginning-of-statement t]
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
557 ["Forward Statement" c-end-of-statement t]
18842
72c2475ece1c Require 'cc-defs for the definition of c-emacs-features.
Richard M. Stallman <rms@gnu.org>
parents: 18772
diff changeset
558 "---"
24282
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 22423
diff changeset
559 ["Macro Expand Region" c-macro-expand (c-region-is-active-p)]
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 22423
diff changeset
560 ["Backslashify" c-backslash-region (c-region-is-active-p)]
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
561 )))
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
562 (cons modestr m)))
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
563
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
564
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
565
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
566 ;; Support for C
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
567
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
568 (defvar c-mode-abbrev-table nil
19250
23f71af4d504 (c-symbol-key):
Richard M. Stallman <rms@gnu.org>
parents: 18842
diff changeset
569 "Abbreviation table used in c-mode buffers.")
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
570 (define-abbrev-table 'c-mode-abbrev-table ())
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
571
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
572 (defvar c-mode-map ()
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
573 "Keymap used in c-mode buffers.")
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
574 (if c-mode-map
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
575 nil
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
576 (setq c-mode-map (c-make-inherited-keymap))
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
577 ;; add bindings which are only useful for C
19805
e804ac04eec1 (c-mode-base-map): Don't define C-c C-e here.
Richard M. Stallman <rms@gnu.org>
parents: 19381
diff changeset
578 (define-key c-mode-map "\C-c\C-e" 'c-macro-expand)
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
579 )
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
580
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
581 ;;;###autoload
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
582 (defvar c-mode-syntax-table nil
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
583 "Syntax table used in c-mode buffers.")
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
584 (if c-mode-syntax-table
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
585 ()
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
586 (setq c-mode-syntax-table (make-syntax-table))
19300
b07fa43938cc (c-mode-base-map, c++-mode-map):
Richard M. Stallman <rms@gnu.org>
parents: 19250
diff changeset
587 (c-populate-syntax-table c-mode-syntax-table))
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
588
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
589 (easy-menu-define c-c-menu c-mode-map "C Mode Commands"
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
590 (c-mode-menu "C"))
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
591
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
592
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
593 ;; Support for C++
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
594
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
595 (defvar c++-mode-abbrev-table nil
19250
23f71af4d504 (c-symbol-key):
Richard M. Stallman <rms@gnu.org>
parents: 18842
diff changeset
596 "Abbreviation table used in c++-mode buffers.")
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
597 (define-abbrev-table 'c++-mode-abbrev-table ())
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
598
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
599 (defvar c++-mode-map ()
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
600 "Keymap used in c++-mode buffers.")
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
601 (if c++-mode-map
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
602 nil
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
603 (setq c++-mode-map (c-make-inherited-keymap))
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
604 ;; add bindings which are only useful for C++
19805
e804ac04eec1 (c-mode-base-map): Don't define C-c C-e here.
Richard M. Stallman <rms@gnu.org>
parents: 19381
diff changeset
605 (define-key c++-mode-map "\C-c\C-e" 'c-macro-expand)
e804ac04eec1 (c-mode-base-map): Don't define C-c C-e here.
Richard M. Stallman <rms@gnu.org>
parents: 19381
diff changeset
606 (define-key c++-mode-map "\C-c:" 'c-scope-operator)
e804ac04eec1 (c-mode-base-map): Don't define C-c C-e here.
Richard M. Stallman <rms@gnu.org>
parents: 19381
diff changeset
607 (define-key c++-mode-map "<" 'c-electric-lt-gt)
e804ac04eec1 (c-mode-base-map): Don't define C-c C-e here.
Richard M. Stallman <rms@gnu.org>
parents: 19381
diff changeset
608 (define-key c++-mode-map ">" 'c-electric-lt-gt))
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
609
19300
b07fa43938cc (c-mode-base-map, c++-mode-map):
Richard M. Stallman <rms@gnu.org>
parents: 19250
diff changeset
610 ;;;###autoload
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
611 (defvar c++-mode-syntax-table nil
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
612 "Syntax table used in c++-mode buffers.")
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
613 (if c++-mode-syntax-table
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
614 ()
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
615 (setq c++-mode-syntax-table (make-syntax-table))
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
616 (c-populate-syntax-table c++-mode-syntax-table)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
617 ;; TBD: does it make sense for colon to be symbol class in C++?
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
618 ;; I'm not so sure, since c-label-key is busted on lines like:
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
619 ;; Foo::bar( i );
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
620 ;; maybe c-label-key should be fixed instead of commenting this out,
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
621 ;; but it also bothers me that this only seems appropriate for C++
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
622 ;; and not C.
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
623 ;;(modify-syntax-entry ?: "_" c++-mode-syntax-table)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
624 )
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
625
26817
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
626 (defvar c++-template-syntax-table nil
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
627 "A variant of `c++-mode-syntax-table' that defines `<' and `>' as
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
628 parenthesis characters. Used temporarily when template argument lists
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
629 are parsed.")
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
630 (if c++-template-syntax-table
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
631 ()
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
632 (setq c++-template-syntax-table
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
633 (copy-syntax-table c++-mode-syntax-table))
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
634 (modify-syntax-entry ?< "(>" c++-template-syntax-table)
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
635 (modify-syntax-entry ?> ")<" c++-template-syntax-table))
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
636
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
637 (easy-menu-define c-c++-menu c++-mode-map "C++ Mode Commands"
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
638 (c-mode-menu "C++"))
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
639
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
640
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
641 ;; Support for Objective-C
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
642
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
643 (defvar objc-mode-abbrev-table nil
19250
23f71af4d504 (c-symbol-key):
Richard M. Stallman <rms@gnu.org>
parents: 18842
diff changeset
644 "Abbreviation table used in objc-mode buffers.")
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
645 (define-abbrev-table 'objc-mode-abbrev-table ())
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
646
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
647 (defvar objc-mode-map ()
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
648 "Keymap used in objc-mode buffers.")
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
649 (if objc-mode-map
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
650 nil
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
651 (setq objc-mode-map (c-make-inherited-keymap))
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
652 ;; add bindings which are only useful for Objective-C
19805
e804ac04eec1 (c-mode-base-map): Don't define C-c C-e here.
Richard M. Stallman <rms@gnu.org>
parents: 19381
diff changeset
653 (define-key objc-mode-map "\C-c\C-e" 'c-macro-expand))
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
654
19300
b07fa43938cc (c-mode-base-map, c++-mode-map):
Richard M. Stallman <rms@gnu.org>
parents: 19250
diff changeset
655 ;;;###autoload
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
656 (defvar objc-mode-syntax-table nil
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
657 "Syntax table used in objc-mode buffers.")
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
658 (if objc-mode-syntax-table
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
659 ()
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
660 (setq objc-mode-syntax-table (make-syntax-table))
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
661 (c-populate-syntax-table objc-mode-syntax-table)
19300
b07fa43938cc (c-mode-base-map, c++-mode-map):
Richard M. Stallman <rms@gnu.org>
parents: 19250
diff changeset
662 ;; add extra Objective-C only syntax
b07fa43938cc (c-mode-base-map, c++-mode-map):
Richard M. Stallman <rms@gnu.org>
parents: 19250
diff changeset
663 (modify-syntax-entry ?@ "_" objc-mode-syntax-table))
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
664
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
665 (easy-menu-define c-objc-menu objc-mode-map "ObjC Mode Commands"
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
666 (c-mode-menu "ObjC"))
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
667
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
668
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
669 ;; Support for Java
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
670
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
671 (defvar java-mode-abbrev-table nil
19250
23f71af4d504 (c-symbol-key):
Richard M. Stallman <rms@gnu.org>
parents: 18842
diff changeset
672 "Abbreviation table used in java-mode buffers.")
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
673 (define-abbrev-table 'java-mode-abbrev-table ())
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
674
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
675 (defvar java-mode-map ()
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
676 "Keymap used in java-mode buffers.")
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
677 (if java-mode-map
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
678 nil
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
679 (setq java-mode-map (c-make-inherited-keymap))
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
680 ;; add bindings which are only useful for Java
19805
e804ac04eec1 (c-mode-base-map): Don't define C-c C-e here.
Richard M. Stallman <rms@gnu.org>
parents: 19381
diff changeset
681 )
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
682
19300
b07fa43938cc (c-mode-base-map, c++-mode-map):
Richard M. Stallman <rms@gnu.org>
parents: 19250
diff changeset
683 ;;;###autoload
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
684 (defvar java-mode-syntax-table nil
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
685 "Syntax table used in java-mode buffers.")
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
686 (if java-mode-syntax-table
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
687 ()
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
688 (setq java-mode-syntax-table (make-syntax-table))
19300
b07fa43938cc (c-mode-base-map, c++-mode-map):
Richard M. Stallman <rms@gnu.org>
parents: 19250
diff changeset
689 (c-populate-syntax-table java-mode-syntax-table))
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
690
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
691 (easy-menu-define c-java-menu java-mode-map "Java Mode Commands"
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
692 (c-mode-menu "Java"))
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
693
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
694
19250
23f71af4d504 (c-symbol-key):
Richard M. Stallman <rms@gnu.org>
parents: 18842
diff changeset
695 ;; Support for CORBA's IDL language
23f71af4d504 (c-symbol-key):
Richard M. Stallman <rms@gnu.org>
parents: 18842
diff changeset
696
23f71af4d504 (c-symbol-key):
Richard M. Stallman <rms@gnu.org>
parents: 18842
diff changeset
697 (defvar idl-mode-abbrev-table nil
23f71af4d504 (c-symbol-key):
Richard M. Stallman <rms@gnu.org>
parents: 18842
diff changeset
698 "Abbreviation table used in idl-mode buffers.")
23f71af4d504 (c-symbol-key):
Richard M. Stallman <rms@gnu.org>
parents: 18842
diff changeset
699 (define-abbrev-table 'idl-mode-abbrev-table ())
23f71af4d504 (c-symbol-key):
Richard M. Stallman <rms@gnu.org>
parents: 18842
diff changeset
700
23f71af4d504 (c-symbol-key):
Richard M. Stallman <rms@gnu.org>
parents: 18842
diff changeset
701 (defvar idl-mode-map ()
23f71af4d504 (c-symbol-key):
Richard M. Stallman <rms@gnu.org>
parents: 18842
diff changeset
702 "Keymap used in idl-mode buffers.")
23f71af4d504 (c-symbol-key):
Richard M. Stallman <rms@gnu.org>
parents: 18842
diff changeset
703 (if idl-mode-map
23f71af4d504 (c-symbol-key):
Richard M. Stallman <rms@gnu.org>
parents: 18842
diff changeset
704 nil
23f71af4d504 (c-symbol-key):
Richard M. Stallman <rms@gnu.org>
parents: 18842
diff changeset
705 (setq idl-mode-map (c-make-inherited-keymap))
19805
e804ac04eec1 (c-mode-base-map): Don't define C-c C-e here.
Richard M. Stallman <rms@gnu.org>
parents: 19381
diff changeset
706 ;; add bindings which are only useful for IDL
e804ac04eec1 (c-mode-base-map): Don't define C-c C-e here.
Richard M. Stallman <rms@gnu.org>
parents: 19381
diff changeset
707 )
19250
23f71af4d504 (c-symbol-key):
Richard M. Stallman <rms@gnu.org>
parents: 18842
diff changeset
708
19300
b07fa43938cc (c-mode-base-map, c++-mode-map):
Richard M. Stallman <rms@gnu.org>
parents: 19250
diff changeset
709 ;;;###autoload
19250
23f71af4d504 (c-symbol-key):
Richard M. Stallman <rms@gnu.org>
parents: 18842
diff changeset
710 (defvar idl-mode-syntax-table nil
23f71af4d504 (c-symbol-key):
Richard M. Stallman <rms@gnu.org>
parents: 18842
diff changeset
711 "Syntax table used in idl-mode buffers.")
23f71af4d504 (c-symbol-key):
Richard M. Stallman <rms@gnu.org>
parents: 18842
diff changeset
712 (if idl-mode-syntax-table
23f71af4d504 (c-symbol-key):
Richard M. Stallman <rms@gnu.org>
parents: 18842
diff changeset
713 nil
23f71af4d504 (c-symbol-key):
Richard M. Stallman <rms@gnu.org>
parents: 18842
diff changeset
714 (setq idl-mode-syntax-table (make-syntax-table))
19300
b07fa43938cc (c-mode-base-map, c++-mode-map):
Richard M. Stallman <rms@gnu.org>
parents: 19250
diff changeset
715 (c-populate-syntax-table idl-mode-syntax-table))
19250
23f71af4d504 (c-symbol-key):
Richard M. Stallman <rms@gnu.org>
parents: 18842
diff changeset
716
23f71af4d504 (c-symbol-key):
Richard M. Stallman <rms@gnu.org>
parents: 18842
diff changeset
717 (easy-menu-define c-idl-menu idl-mode-map "IDL Mode Commands"
23f71af4d504 (c-symbol-key):
Richard M. Stallman <rms@gnu.org>
parents: 18842
diff changeset
718 (c-mode-menu "IDL"))
23f71af4d504 (c-symbol-key):
Richard M. Stallman <rms@gnu.org>
parents: 18842
diff changeset
719
24282
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 22423
diff changeset
720
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 22423
diff changeset
721 ;; Support for Pike
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 22423
diff changeset
722
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 22423
diff changeset
723 (defvar pike-mode-abbrev-table nil
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 22423
diff changeset
724 "Abbreviation table used in pike-mode buffers.")
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 22423
diff changeset
725 (define-abbrev-table 'pike-mode-abbrev-table ())
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 22423
diff changeset
726
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 22423
diff changeset
727 (defvar pike-mode-map ()
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 22423
diff changeset
728 "Keymap used in pike-mode buffers.")
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 22423
diff changeset
729 (if pike-mode-map
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 22423
diff changeset
730 nil
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 22423
diff changeset
731 (setq pike-mode-map (c-make-inherited-keymap))
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 22423
diff changeset
732 ;; additional bindings
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 22423
diff changeset
733 (define-key pike-mode-map "\C-c\C-e" 'c-macro-expand))
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 22423
diff changeset
734
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 22423
diff changeset
735 ;;;###autoload
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 22423
diff changeset
736 (defvar pike-mode-syntax-table nil
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 22423
diff changeset
737 "Syntax table used in pike-mode buffers.")
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 22423
diff changeset
738 (if pike-mode-syntax-table
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 22423
diff changeset
739 ()
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 22423
diff changeset
740 (setq pike-mode-syntax-table (make-syntax-table))
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 22423
diff changeset
741 (c-populate-syntax-table pike-mode-syntax-table)
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 22423
diff changeset
742 (modify-syntax-entry ?@ "." pike-mode-syntax-table))
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 22423
diff changeset
743
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 22423
diff changeset
744 (easy-menu-define c-pike-menu pike-mode-map "Pike Mode Commands"
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 22423
diff changeset
745 (c-mode-menu "Pike"))
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 22423
diff changeset
746
19250
23f71af4d504 (c-symbol-key):
Richard M. Stallman <rms@gnu.org>
parents: 18842
diff changeset
747
23f71af4d504 (c-symbol-key):
Richard M. Stallman <rms@gnu.org>
parents: 18842
diff changeset
748
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
749 (provide 'cc-langs)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
750 ;;; cc-langs.el ends here