Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
emacs
emacs
Commits
0ec8351b
Commit
0ec8351b
authored
Feb 08, 1999
by
Barry A. Warsaw
Browse files
Installed CC Mode 5.25.
parent
32348c13
Changes
10
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
1514 additions
and
613 deletions
+1514
-613
lisp/progmodes/cc-align.el
lisp/progmodes/cc-align.el
+35
-12
lisp/progmodes/cc-cmds.el
lisp/progmodes/cc-cmds.el
+313
-194
lisp/progmodes/cc-compat.el
lisp/progmodes/cc-compat.el
+4
-3
lisp/progmodes/cc-defs.el
lisp/progmodes/cc-defs.el
+61
-5
lisp/progmodes/cc-engine.el
lisp/progmodes/cc-engine.el
+691
-221
lisp/progmodes/cc-langs.el
lisp/progmodes/cc-langs.el
+92
-22
lisp/progmodes/cc-menus.el
lisp/progmodes/cc-menus.el
+20
-8
lisp/progmodes/cc-mode.el
lisp/progmodes/cc-mode.el
+116
-58
lisp/progmodes/cc-styles.el
lisp/progmodes/cc-styles.el
+108
-65
lisp/progmodes/cc-vars.el
lisp/progmodes/cc-vars.el
+74
-25
No files found.
lisp/progmodes/cc-align.el
View file @
0ec8351b
...
...
@@ -2,10 +2,11 @@
;; Copyright (C) 1985,87,92,93,94,95,96,97,98 Free Software Foundation, Inc.
;; Authors: 1992-1997 Barry A. Warsaw
;; Authors: 1998 Barry A. Warsaw and Martin Stjernholm
;; 1992-1997 Barry A. Warsaw
;; 1987 Dave Detlefs and Stewart Clamen
;; 1985 Richard M. Stallman
;; Maintainer: cc-mode
-help@python
.org
;; Maintainer:
bug-
cc-mode
@gnu
.org
;; Created: 22-Apr-1997 (split from cc-mode.el)
;; Version: See cc-mode.el
;; Keywords: c languages oop
...
...
@@ -28,6 +29,7 @@
;; Boston, MA 02111-1307, USA.
(
eval-when-compile
(
require
'cc-defs
)
(
require
'cc-vars
)
(
require
'cc-engine
)
(
require
'cc-langs
))
...
...
@@ -57,7 +59,7 @@
(
beginning-of-line
)
(
looking-at
"[ \t]*)"
))
(
progn
(
goto-char
(
match-end
0
))
(
forward-sexp
-1
)
(
c-
forward-sexp
-1
)
(
forward-char
1
)
(
c-forward-syntactic-ws
)
(
-
(
current-column
)
langelem-col
))
...
...
@@ -111,9 +113,8 @@
(
let
(
opencol
spec
)
(
beginning-of-line
)
(
backward-up-list
1
)
(
setq
spec
(
if
(
fboundp
'c-looking-at-special-brace-list
)
(
c-looking-at-special-brace-list
)))
(
if
spec
(
goto-char
(
car
spec
)))
(
setq
spec
(
c-looking-at-special-brace-list
))
(
if
spec
(
goto-char
(
car
(
car
spec
))))
(
setq
opencol
(
current-column
))
(
forward-char
1
)
(
if
spec
(
progn
...
...
@@ -194,9 +195,7 @@
(
beginning-of-line
)
(
skip-chars-forward
" \t"
)
(
if
(
and
(
eq
(
following-char
)
?{
)
(
condition-case
nil
(
progn
(
forward-sexp
)
t
)
(
error
nil
))
(
c-safe
(
progn
(
c-forward-sexp
)
t
))
(
<=
(
point
)
eol
)
(
eq
(
preceding-char
)
?}
))
c-basic-offset
...
...
@@ -291,7 +290,11 @@
(
if
(
c-in-literal
(
cdr
langelem
))
(
forward-char
1
)
(
setq
donep
t
)))
(
if
(
not
(
eq
(
char-after
)
?=
))
(
if
(
or
(
not
(
eq
(
char-after
)
?=
))
(
save-excursion
(
forward-char
1
)
(
c-forward-syntactic-ws
(
c-point
'eol
))
(
eolp
)))
;; there's no equal sign on the line
c-basic-offset
;; calculate indentation column after equals and ws, unless
...
...
@@ -324,7 +327,7 @@
(
current-column
)))
(
target-col
(
progn
(
forward-char
)
(
forward-sexp
)
(
c-
forward-sexp
)
(
skip-chars-forward
" \t"
)
(
if
(
eolp
)
(
+
open-bracket-col
c-basic-offset
)
...
...
@@ -373,6 +376,26 @@
(
+
curcol
(
-
prev-col-column
(
current-column
)))
c-basic-offset
)))))
(
defun
c-lineup-inexpr-block
(
langelem
)
;; This function lines up the block for the various constructs that
;; uses a block inside an expression. For constructs matching
;; c-lambda-key and c-inexpr-block-key, indentation to the column of
;; the beginning of the match is added. For standalone statement
;; blocks, indentation to the column of the opening brace is added.
(
save-excursion
(
back-to-indentation
)
(
let
((
res
(
or
(
c-looking-at-inexpr-block
)
(
if
(
c-safe
(
backward-up-list
1
)
(
eq
(
char-after
)
?{
))
(
c-looking-at-inexpr-block
)))))
(
if
(
not
res
)
0
(
goto-char
(
cdr
res
))
(
-
(
current-column
)
(
progn
(
back-to-indentation
)
(
current-column
)))))))
(
defun
c-lineup-dont-change
(
langelem
)
;; Do not change the indentation of the current line
(
save-excursion
...
...
@@ -394,7 +417,7 @@ ACTION associated with `block-close' syntax."
(
setq
langelem
(
assq
'block-close
c-syntactic-context
))
(
progn
(
goto-char
(
cdr
langelem
))
(
if
(
eq
(
char-after
)
?{
)
(
c-safe
(
forward-sexp
-1
)))
(
c-safe
(
c-
forward-sexp
-1
)))
(
looking-at
"\\<do\\>[^_]"
)))
'
(
before
)
'
(
before
after
)))))
...
...
lisp/progmodes/cc-cmds.el
View file @
0ec8351b
This diff is collapsed.
Click to expand it.
lisp/progmodes/cc-compat.el
View file @
0ec8351b
;;; cc-compat.el --- cc-mode compatibility with c-mode.el confusion
;; Copyright (C) 1985,87,92,93,94,95,96,97 Free Software Foundation, Inc.
;; Copyright (C) 1985,87,92,93,94,95,96,97
,98
Free Software Foundation, Inc.
;; Author: 1994-1997 Barry A. Warsaw
;; Maintainer: cc-mode
-help@python
.org
;; Maintainer:
bug-
cc-mode
@gnu
.org
;; Created: August 1994, split from cc-mode.el
;; Version: See cc-mode.el
;; Keywords: c languages oop
...
...
@@ -40,6 +40,7 @@
;;; Code:
(
eval-when-compile
(
require
'cc-defs
)
(
require
'cc-styles
)
(
require
'cc-engine
))
...
...
@@ -114,7 +115,7 @@ This is in addition to c-continued-statement-offset.")
;; line
(
progn
(
if
(
eq
(
char-before
)
?\)
)
(
forward-sexp
-1
))
(
c-
forward-sexp
-1
))
;; Get initial indentation of the line we are on.
(
current-indentation
)))))
(
-
bocm-lossage
curcol
))))
...
...
lisp/progmodes/cc-defs.el
View file @
0ec8351b
...
...
@@ -2,10 +2,11 @@
;; Copyright (C) 1985,87,92,93,94,95,96,97,98 Free Software Foundation, Inc.
;; Authors: 1992-1997 Barry A. Warsaw
;; Authors: 1998 Barry A. Warsaw and Martin Stjernholm
;; 1992-1997 Barry A. Warsaw
;; 1987 Dave Detlefs and Stewart Clamen
;; 1985 Richard M. Stallman
;; Maintainer: cc-mode
-help@python
.org
;; Maintainer:
bug-
cc-mode
@gnu
.org
;; Created: 22-Apr-1997 (split from cc-mode.el)
;; Version: See cc-mode.el
;; Keywords: c languages oop
...
...
@@ -27,6 +28,25 @@
;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
;; Boston, MA 02111-1307, USA.
;; Get all the necessary compile time definitions.
(
require
'custom
)
(
require
'cc-menus
)
(
require
'derived
)
;only necessary in Emacs 20
;; cc-mode-19.el contains compatibility macros that should be compiled
;; in if needed.
(
if
(
or
(
not
(
fboundp
'functionp
))
(
not
(
condition-case
nil
(
progn
(
char-before
)
t
)
(
error
nil
)))
(
not
(
condition-case
nil
(
progn
(
char-after
)
t
)
(
error
nil
)))
(
not
(
fboundp
'when
))
(
not
(
fboundp
'unless
)))
(
require
'cc-mode-19
))
(
defsubst
c-point
(
position
)
;; Returns the value of point at certain commonly referenced POSITIONs.
...
...
@@ -35,6 +55,7 @@
;; bol -- beginning of line
;; eol -- end of line
;; bod -- beginning of defun
;; eod -- end of defun
;; boi -- back to indentation
;; ionl -- indentation of next line
;; iopl -- indentation of previous line
...
...
@@ -55,14 +76,14 @@
((
eq
position
'ionl
)
(
forward-line
1
)
(
back-to-indentation
))
((
eq
position
'eod
)
(
c-end-of-defun
))
((
eq
position
'bod
)
(
if
(
and
(
fboundp
'buffer-syntactic-context-depth
)
c-enable-xemacs-performance-kludge-p
)
;; XEmacs only. This can improve the performance of
;; c-parse-state to between 3 and 60 times faster when
;; braces are hung. It can cause c-parse-state to be
;; slightly slower when braces are not hung, but general
;; editing appears to be still about as fast.
;; braces are hung. It can also degrade performance by
;; about as much when braces are not hung.
(
let
(
pos
)
(
while
(
not
pos
)
(
save-restriction
...
...
@@ -106,12 +127,31 @@
(
point
)
(
goto-char
here
))))
(
defmacro
c-safe
(
&rest
body
)
;; safely execute BODY, return nil if an error occurred
(
`
(
condition-case
nil
(
progn
(
,@
body
))
(
error
nil
))))
(
defmacro
c-forward-sexp
(
&optional
arg
)
;; like forward-sexp except
;; 1. this is much stripped down from the XEmacs version
;; 2. this cannot be used as a command, so we're insulated from
;; XEmacs' losing efforts to make forward-sexp more user
;; friendly
;; 3. Preserves the semantics most of CC Mode is based on
(
or
arg
(
setq
arg
1
))
`
(
goto-char
(
or
(
scan-sexps
(
point
)
,
arg
)
,
(
if
(
numberp
arg
)
(
if
(
>
arg
0
)
`
(
point-max
)
`
(
point-min
))
`
(
if
(
>
,
arg
0
)
(
point-max
)
(
point-min
))))))
(
defmacro
c-backward-sexp
(
&optional
arg
)
;; See c-forward-sexp and reverse directions
(
or
arg
(
setq
arg
1
))
`
(
c-forward-sexp
,
(
if
(
numberp
arg
)
(
-
arg
)
`
(
-
,
arg
))))
(
defmacro
c-add-syntax
(
symbol
&optional
relpos
)
;; a simple macro to append the syntax in symbol to the syntax list.
;; try to increase performance by using this macro
...
...
@@ -163,6 +203,22 @@
(
and
(
boundp
'zmacs-region-stays
)
(
setq
zmacs-region-stays
t
)))
(
defsubst
c-region-is-active-p
()
;; Return t when the region is active. The determination of region
;; activeness is different in both Emacs and XEmacs.
(
cond
;; XEmacs
((
and
(
fboundp
'region-active-p
)
zmacs-regions
)
(
region-active-p
))
;; Emacs
((
boundp
'mark-active
)
mark-active
)
;; fallback; shouldn't get here
(
t
(
mark
t
))))
(
defsubst
c-major-mode-is
(
mode
)
(
eq
(
derived-mode-class
major-mode
)
mode
))
(
provide
'cc-defs
)
;;; cc-defs.el ends here
lisp/progmodes/cc-engine.el
View file @
0ec8351b
This diff is collapsed.
Click to expand it.
lisp/progmodes/cc-langs.el
View file @
0ec8351b
...
...
@@ -2,10 +2,11 @@
;; Copyright (C) 1985,87,92,93,94,95,96,97,98 Free Software Foundation, Inc.
;; Authors: 1992-1997 Barry A. Warsaw
;; Authors: 1998 Barry A. Warsaw and Martin Stjernholm
;; 1992-1997 Barry A. Warsaw
;; 1987 Dave Detlefs and Stewart Clamen
;; 1985 Richard M. Stallman
;; Maintainer: cc-mode
-help@python
.org
;; Maintainer:
bug-
cc-mode
@gnu
.org
;; Created: 22-Apr-1997 (split from cc-mode.el)
;; Version: See cc-mode.el
;; Keywords: c languages oop
...
...
@@ -29,7 +30,8 @@
(
require
'cc-defs
)
(
eval-when-compile
(
require
'cc-defs
))
;; Regular expressions and other values which must be parameterized on
;; a per-language basis.
...
...
@@ -54,8 +56,10 @@
;; keywords introducing class definitions. language specific
(
defconst
c-C-class-key
"\\(struct\\|union\\)"
)
(
defconst
c-C++-class-key
"\\(class\\|struct\\|union\\)"
)
(
defconst
c-C-extra-toplevel-key
"\\(extern\\)[^_]"
)
(
defconst
c-C++-extra-toplevel-key
"\\(extern\\|namespace\\)[^_]"
)
(
defconst
c-IDL-class-key
"\\(class\\|struct\\|union\\|interface\\)"
)
(
defconst
c-C-extra-toplevel-key
"\\(extern\\)"
)
(
defconst
c-C++-extra-toplevel-key
"\\(extern\\|namespace\\)"
)
(
defconst
c-IDL-extra-toplevel-key
"\\(module\\)"
)
(
defconst
c-ObjC-class-key
(
concat
...
...
@@ -70,10 +74,12 @@
"\\("
c-protection-key
"\\s +\\)?"
"\\(interface\\|class\\)\\s +"
c-symbol-key
;name of the class
"\\(\\s *extends\\s *"
c-symbol-key
"\\)?"
;maybe followed by superclass
"\\(\\s *extends\\s *"
c-symbol-key
"\\)?"
;maybe followed by superclass
;;"\\(\\s *implements *[^{]+{\\)?" ;maybe the adopted protocols list
))
(
defconst
c-Pike-class-key
"class"
)
(
defvar
c-class-key
c-C-class-key
)
(
make-variable-buffer-local
'c-class-key
)
...
...
@@ -87,12 +93,14 @@
(
defconst
c-C++-access-key
(
concat
c-protection-key
"[ \t]*:"
))
(
defconst
c-ObjC-access-key
(
concat
"@"
c-protection-key
))
(
defconst
c-Java-access-key
nil
)
(
defconst
c-Pike-access-key
nil
)
;; keywords introducing conditional blocks
(
defconst
c-C-conditional-key
nil
)
(
defconst
c-C++-conditional-key
nil
)
(
defconst
c-Java-conditional-key
nil
)
(
defconst
c-Pike-conditional-key
nil
)
(
let
((
all-kws
"for\\|if\\|do\\|else\\|while\\|switch"
)
(
exc-kws
"\\|try\\|catch"
)
...
...
@@ -101,7 +109,8 @@
(
back
"\\)\\b[^_]"
))
(
setq
c-C-conditional-key
(
concat
front
all-kws
back
)
c-C++-conditional-key
(
concat
front
all-kws
exc-kws
back
)
c-Java-conditional-key
(
concat
front
all-kws
exc-kws
thr-kws
back
)))
c-Java-conditional-key
(
concat
front
all-kws
exc-kws
thr-kws
back
)
c-Pike-conditional-key
(
concat
front
all-kws
"\\|foreach"
back
)))
(
defvar
c-conditional-key
c-C-conditional-key
)
(
make-variable-buffer-local
'c-conditional-key
)
...
...
@@ -166,6 +175,30 @@
(
defconst
c-Java-javadoc-paragraph-start
"@\\(author\\|exception\\|param\\|return\\|see\\|version\\)"
)
;; Regexp that starts lambda constructs.
(
defvar
c-lambda-key
nil
)
(
make-variable-buffer-local
'c-lambda-key
)
(
defconst
c-Pike-lambda-key
"\\<lambda\\>"
)
;; Regexp that are followed by a statement block in expressions.
(
defvar
c-inexpr-block-key
nil
)
(
make-variable-buffer-local
'c-inexpr-block-key
)
(
defconst
c-Pike-inexpr-block-key
"\\<\\(catch\\|gauge\\)\\>"
)
;; Regexp that may be followed by an anonymous class in expressions.
(
defvar
c-inexpr-class-key
nil
)
(
make-variable-buffer-local
'c-inexpr-class-key
)
(
defconst
c-Java-inexpr-class-key
"\\<new\\>"
)
;; List of open- and close-chars that makes up a pike-style brace
;; list, ie for a `([])' list there should be a cons (?\[ . ?\]) in
;; this list.
(
defvar
c-special-brace-lists
nil
)
(
make-variable-buffer-local
'c-special-brace-lists
)
(
defconst
c-Pike-special-brace-lists
'
((
?{
.
?}
)
(
?\[
.
?\]
)
(
?<
.
?>
)))
;; internal state variables
...
...
@@ -188,11 +221,6 @@
(
defun
c-use-java-style
()
"Institutes `java' indentation style.
For use with the variable `java-mode-hook'."
(
c-set-style
"java"
))
(
defun
c-common-init
()
;; Common initializations for all modes.
;; these variables should always be buffer local; they do not affect
...
...
@@ -212,6 +240,7 @@ For use with the variable `java-mode-hook'."
(
make-local-variable
'outline-regexp
)
(
make-local-variable
'outline-level
)
(
make-local-variable
'adaptive-fill-regexp
)
(
make-local-variable
'adaptive-fill-mode
)
(
make-local-variable
'imenu-generic-expression
)
;set in the mode functions
;; X/Emacs 20 only
(
and
(
boundp
'comment-line-break-function
)
...
...
@@ -235,7 +264,8 @@ For use with the variable `java-mode-hook'."
comment-start-skip
"/\\*+ *\\|// *"
comment-multi-line
nil
comment-line-break-function
'c-comment-line-break-function
adaptive-fill-regexp
nil
)
adaptive-fill-regexp
nil
adaptive-fill-mode
nil
)
;; we have to do something special for c-offsets-alist so that the
;; buffer local value has its own alist structure.
(
setq
c-offsets-alist
(
copy-alist
c-offsets-alist
))
...
...
@@ -249,7 +279,17 @@ For use with the variable `java-mode-hook'."
(
or
(
assq
'c-auto-hungry-string
minor-mode-alist
)
(
setq
minor-mode-alist
(
cons
'
(
c-auto-hungry-string
c-auto-hungry-string
)
minor-mode-alist
))))
minor-mode-alist
)))
;; now set the mode style based on c-default-style
(
c-set-style
(
if
(
stringp
c-default-style
)
(
if
(
c-major-mode-is
'java-mode
)
"java"
c-default-style
)
(
or
(
cdr
(
assq
major-mode
c-default-style
))
(
cdr
(
assq
'other
c-default-style
))
"gnu"
)))
)
(
defun
c-postprocess-file-styles
()
"Function that post processes relevant file local variables.
...
...
@@ -277,6 +317,9 @@ Note that the style variables are always made local to the buffer."
(
add-hook
'hack-local-variables-hook
'c-postprocess-file-styles
)
(
defvar
c-mode-base-map
()
"Keymap shared by all CC Mode related modes."
)
;; Common routines
(
defun
c-make-inherited-keymap
()
(
let
((
map
(
make-sparse-keymap
)))
...
...
@@ -325,9 +368,6 @@ Note that the style variables are always made local to the buffer."
(modify-syntax-entry ?\^m "> b" table))
(defvar c-mode-base-map ()
"Keymap shared by all CC Mode related modes.")
(if c-mode-base-map
nil
;; TBD: should we even worry about naming this keymap. My vote: no,
...
...
@@ -340,6 +380,8 @@ Note that the style variables are always made local to the buffer."
(define-key c-mode-base-map ";" 'c-electric-semi&comma)
(define-key c-mode-base-map "#" 'c-electric-pound)
(define-key c-mode-base-map ":" 'c-electric-colon)
(define-key c-mode-base-map "(" 'c-electric-paren)
(define-key c-mode-base-map ")" 'c-electric-paren)
;; Separate M-BS from C-M-h. The former should remain
;; backward-kill-word.
(define-key c-mode-base-map [(control meta h)] 'c-mark-function)
...
...
@@ -396,26 +438,27 @@ Note that the style variables are always made local to the buffer."
(
defvar
c-c++-menu
nil
)
(
defvar
c-objc-menu
nil
)
(
defvar
c-java-menu
nil
)
(
defvar
c-pike-menu
nil
)
(
defun
c-mode-menu
(
modestr
)
(
let
((
m
'
(
[
"Comment Out Region"
comment-region
(
mark
t
)
]
'
(
[
"Comment Out Region"
comment-region
(
c-region-is-active-p
)
]
[
"Uncomment Region"
(
comment-region
(
region-beginning
)
(
region-end
)
'
(
4
))
(
mark
t
)
]
(
c-region-is-active-p
)
]
[
"Fill Comment Paragraph"
c-fill-paragraph
t]
"---"
[
"Indent Expression"
c-indent-exp
(
memq
(
char-after
)
'
(
?\(
?\[
?\{
))
]
[
"Indent Line
"
c-indent-command
t]
[
"Indent Line
or Region"
c-indent-line-or-region
t]
[
"Up Conditional"
c-up-conditional
t]
[
"Backward Conditional"
c-backward-conditional
t]
[
"Forward Conditional"
c-forward-conditional
t]
[
"Backward Statement"
c-beginning-of-statement
t]
[
"Forward Statement"
c-end-of-statement
t]
"---"
[
"Macro Expand Region"
c-macro-expand
(
mark
t
)
]
[
"Backslashify"
c-backslash-region
(
mark
t
)
]
[
"Macro Expand Region"
c-macro-expand
(
c-region-is-active-p
)
]
[
"Backslashify"
c-backslash-region
(
c-region-is-active-p
)
]
)))
(
cons
modestr
m
)))
...
...
@@ -564,6 +607,33 @@ Note that the style variables are always made local to the buffer."
(
easy-menu-define
c-idl-menu
idl-mode-map
"IDL Mode Commands"
(
c-mode-menu
"IDL"
))
;; Support for Pike
(
defvar
pike-mode-abbrev-table
nil
"Abbreviation table used in pike-mode buffers."
)
(
define-abbrev-table
'pike-mode-abbrev-table
())
(
defvar
pike-mode-map
()
"Keymap used in pike-mode buffers."
)
(
if
pike-mode-map
nil
(
setq
pike-mode-map
(
c-make-inherited-keymap
))
;; additional bindings
(
define-key
pike-mode-map
"\C-c\C-e"
'c-macro-expand
))
;;;###autoload
(
defvar
pike-mode-syntax-table
nil
"Syntax table used in pike-mode buffers."
)
(
if
pike-mode-syntax-table
()
(
setq
pike-mode-syntax-table
(
make-syntax-table
))
(
c-populate-syntax-table
pike-mode-syntax-table
)
(
modify-syntax-entry
?@
"."
pike-mode-syntax-table
))
(
easy-menu-define
c-pike-menu
pike-mode-map
"Pike Mode Commands"
(
c-mode-menu
"Pike"
))
(
provide
'cc-langs
)
...
...
lisp/progmodes/cc-menus.el
View file @
0ec8351b
...
...
@@ -2,10 +2,11 @@
;; Copyright (C) 1985,87,92,93,94,95,96,97,98 Free Software Foundation, Inc.
;; Authors: 1992-1997 Barry A. Warsaw
;; Authors: 1998 Barry A. Warsaw and Martin Stjernholm
;; 1992-1997 Barry A. Warsaw
;; 1987 Dave Detlefs and Stewart Clamen
;; 1985 Richard M. Stallman
;; Maintainer: cc-mode
-help@python
.org
;; Maintainer:
bug-
cc-mode
@gnu
.org
;; Created: 22-Apr-1997 (split from cc-mode.el)
;; Version: See cc-mode.el
;; Keywords: c languages oop
...
...
@@ -27,10 +28,14 @@
;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
;; Boston, MA 02111-1307, USA.
;; Pull in Imenu when compiling, if it exists
(
eval-when-compile
(
condition-case
nil
(
require
'imenu
)
(
error
nil
)))
;; imenu integration
(
eval-when-compile
(
require
'imenu
))
(
defvar
cc-imenu-c-prototype-macro-regexp
nil
"RE matching macro names used to conditionally specify function prototypes.
...
...
@@ -117,7 +122,10 @@ A sample value might look like: `\\(_P\\|_PROTO\\)'.")
"^"
; beginning of line is required
"\\(template[ \t]*<[^>]+>[ \t]*\\)?"
; there may be a `template <...>'
"class[ \t]+"
"\\([a-zA-Z0-9_]+\\)"
; the string we want to get
"\\("
; the string we want to get
"[a-zA-Z0-9_]+"
; class name
"\\(<[^>]+>\\)?"
; possibly explicitely specialized
"\\)"
"[ \t]*[:{]"
))
2
)))
"Imenu generic expression for C++ mode. See `imenu-generic-expression'."
)
...
...
@@ -137,8 +145,8 @@ A sample value might look like: `\\(_P\\|_PROTO\\)'.")
"\\([A-Za-z0-9_-]+[ \t]*[[]?[]]?\\)"
"\\([ \t]\\)"
"\\([A-Za-z0-9_-]+\\)"
; the string we want to get
"\\([ \t]*\\)("
"\\([
][
a-zA-Z,_1-9\n \t]*\\)"
; arguments
"\\([ \t]*\\)
+
("
"\\([a-zA-Z,_1-9\n \t]*
[[]?[]]?
\\)
*
"
; arguments
")[ \t]*"
; "[^;(]"
"[,a-zA-Z_1-9\n \t]*{"
...
...
@@ -307,7 +315,7 @@ Example:
(
if
(
fboundp
'buffer-substring-no-properties
)
'buffer-substring-no-properties
'buffer-substring
)))
(
goto-char
(
point-max
))
(
goto-char
(
point-max
))
(
imenu-progress-message
stupid
0
)
;;
(
while
(
re-search-backward
cc-imenu-objc-generic-expression
nil
t
)
...
...
@@ -386,6 +394,10 @@ Example:
toplist
))
;(defvar cc-imenu-pike-generic-expression
; ())
; FIXME: Please contribute one!
(
provide
'cc-menus
)
;;; cc-menus.el ends here
lisp/progmodes/cc-mode.el
View file @
0ec8351b
...
...
@@ -2,14 +2,15 @@
;; Copyright (C) 1985,87,92,93,94,95,96,97,98 Free Software Foundation, Inc.
;; Authors: 1992-1997 Barry A. Warsaw
;; Authors: 1998 Barry A. Warsaw and Martin Stjernholm
;; 1992-1997 Barry A. Warsaw
;; 1987 Dave Detlefs and Stewart Clamen
;; 1985 Richard M. Stallman
;; Maintainer: cc-mode
-help@python
.org
;; Maintainer:
bug-
cc-mode
@gnu
.org
;; Created: a long, long, time ago. adapted from the original c-mode.el
;; Keywords: c languages oop
(
defconst
c-version
"5.2
1
"
(
defconst
c-version
"5.2
5
"
"CC Mode version number."
)
;; NOTE: Read the commentary below for the right way to submit bug reports!
...
...
@@ -35,13 +36,15 @@
;;; Commentary:
;; This package provides GNU Emacs major modes for editing C, C++,
;; Objective-C, Java and IDL code. As of the latest Emacs and XEmacs
;; releases, it is the default package for editing these languages.
;; This package is called "CC Mode", and should be spelled exactly
;; this way. It supports K&R and ANSI C, ANSI C++, Objective-C, Java,
;; and CORBA's IDL with a consistent indentation model across all
;; modes. This indentation model is intuitive and very flexible, so
;; that almost any desired style of indentation can be supported.
;; Objective-C, Java, IDL and Pike code. As of the latest Emacs and
;; XEmacs releases, it is the default package for editing these
;; languages. This package is called "CC Mode", and should be spelled
;; exactly this way.
;; CC Mode supports K&R and ANSI C, ANSI C++, Objective-C, Java,
;; CORBA's IDL, and Pike with a consistent indentation model across
;; all modes. This indentation model is intuitive and very flexible,
;; so that almost any desired style of indentation can be supported.
;; Installation, usage, and programming details are contained in an
;; accompanying texinfo manual.
...
...
@@ -51,17 +54,20 @@
;; NOTE: This mode does not perform font-locking (a.k.a syntactic
;; coloring, keyword highlighting, etc.) for any of the supported
;; modes. Typically this is done by a package called font-lock.el
;; which
I
do *not* maintain. You should contact the Emacs
;; which
we
do *not* maintain. You should contact the Emacs
or XEmacs
;; maintainers for questions about coloring or highlighting in any
;; language mode.
;; To submit bug reports, type "C-c C-b". These will be sent to
;; bug-gnu-emacs@prep.ai.mit.edu as well as cc-mode-help@python.org,
;; and I'll read about them there (the former is mirrored as the
;; Usenet newsgroup gnu.emacs.bug). Questions can sent to
;; help-gnu-emacs@prep.ai.mit.edu (mirrored as gnu.emacs.help) and/or
;; cc-mode-help@python.org. Please do not send bugs or questions to
;; my personal account.
;; bug-gnu-emacs@gnu.org (mirrored as the Usenet newsgroup
;; gnu.emacs.bug) as well as bug-cc-mode@gnu.org, which directly
;; contacts the CC Mode maintainers. Questions can sent to
;; help-gnu-emacs@gnu.org (mirrored as gnu.emacs.help) and/or
;; bug-cc-mode@gnu.org. The old CC Mode contact address,