(eval-when-compile
(let ((load-path
(if (and (boundp 'byte-compile-dest-file)
(stringp byte-compile-dest-file))
(cons (file-name-directory byte-compile-dest-file) load-path)
load-path)))
(load "cc-bytecomp" nil t)))
(cc-require 'cc-defs)
(cc-require-when-compile 'cc-langs)
(cc-require 'cc-vars)
(cc-require 'cc-engine)
(cc-require 'cc-styles)
(cc-require 'cc-cmds)
(cc-require 'cc-align)
(cc-require 'cc-menus)
(cc-bytecomp-defvar adaptive-fill-first-line-regexp) (cc-bytecomp-defun set-keymap-parents) (cc-bytecomp-defun run-mode-hooks) (cc-bytecomp-obsolete-fun make-local-hook)
(cc-bytecomp-defvar font-lock-defaults)
(cc-bytecomp-defvar font-lock-syntactic-keywords)
(cc-external-require 'easymenu)
(autoload 'c-subword-mode "cc-subword"
"Mode enabling subword movement and editing keys." t)
(require 'cc-fonts)
(autoload 'c-make-init-lang-vars-fun "cc-langs")
(autoload 'c-init-language-vars "cc-langs" nil nil 'macro)
(defun c-leave-cc-mode-mode ()
(setq c-buffer-is-cc-mode nil))
(defmacro c-make-emacs-variables-local ()
`(progn
,@(mapcar (lambda (init)
`(make-local-variable ',(car init)))
(cdr c-emacs-variable-inits))))
(defun c-init-language-vars-for (mode)
"Initialize the language variables for one of the language modes
directly supported by CC Mode. This can be used instead of the
`c-init-language-vars' macro if the language you want to use is one of
those, rather than a derived language defined through the language
variable system (see \"cc-langs.el\")."
(c-make-emacs-variables-local)
(cond ((eq mode 'c-mode) (c-init-language-vars c-mode))
((eq mode 'c++-mode) (c-init-language-vars c++-mode))
((eq mode 'objc-mode) (c-init-language-vars objc-mode))
((eq mode 'java-mode) (c-init-language-vars java-mode))
((eq mode 'idl-mode) (c-init-language-vars idl-mode))
((eq mode 'pike-mode) (c-init-language-vars pike-mode))
((eq mode 'awk-mode) (c-init-language-vars awk-mode))
(t (error "Unsupported mode %s" mode))))
(defun c-initialize-cc-mode (&optional new-style-init)
"Initialize CC Mode for use in the current buffer.
If the optional NEW-STYLE-INIT is nil or left out then all necessary
initialization to run CC Mode for the C language is done. Otherwise
only some basic setup is done, and a call to `c-init-language-vars' or
`c-init-language-vars-for' is necessary too (which gives more
control). See \"cc-mode.el\" for more info."
(setq c-buffer-is-cc-mode t)
(let ((initprop 'cc-mode-is-initialized)
c-initialization-ok)
(unless (get 'c-initialize-cc-mode initprop)
(unwind-protect
(progn
(put 'c-initialize-cc-mode initprop t)
(c-initialize-builtin-style)
(run-hooks 'c-initialization-hook)
(if (boundp 'c-comment-continuation-stars)
(setq c-block-comment-prefix c-comment-continuation-stars))
(add-hook 'change-major-mode-hook 'c-leave-cc-mode-mode)
(setq c-initialization-ok t))
(put 'c-initialize-cc-mode initprop c-initialization-ok))))
(unless new-style-init
(c-init-language-vars-for 'c-mode)))
(defvar c-mode-base-map ()
"Keymap shared by all CC Mode related modes.")
(defun c-make-inherited-keymap ()
(let ((map (make-sparse-keymap)))
(cond
((cc-bytecomp-fboundp 'set-keymap-parents)
(set-keymap-parents map c-mode-base-map))
((cc-bytecomp-fboundp 'set-keymap-parent)
(set-keymap-parent map c-mode-base-map))
(t (error "CC Mode is incompatible with this version of Emacs")))
map))
(defun c-define-abbrev-table (name defs)
(let ((table (or (symbol-value name)
(progn (define-abbrev-table name nil)
(symbol-value name)))))
(while defs
(condition-case nil
(apply 'define-abbrev table (append (car defs) '(t)))
(wrong-number-of-arguments
(apply 'define-abbrev table (car defs))))
(setq defs (cdr defs)))))
(put 'c-define-abbrev-table 'lisp-indent-function 1)
(defun c-bind-special-erase-keys ()
(if normal-erase-is-backspace
(progn
(define-key c-mode-base-map (kbd "C-c C-<delete>")
'c-hungry-delete-forward)
(define-key c-mode-base-map (kbd "C-c C-<backspace>")
'c-hungry-delete-backwards))
(define-key c-mode-base-map (kbd "C-c C-<delete>")
'c-hungry-delete-backwards)
(define-key c-mode-base-map (kbd "C-c C-<backspace>")
'c-hungry-delete-forward)))
(if c-mode-base-map
nil
(setq c-mode-base-map (make-sparse-keymap))
(define-key c-mode-base-map [(control meta h)] 'c-mark-function)
(define-key c-mode-base-map "\e\C-q" 'c-indent-exp)
(substitute-key-definition 'backward-sentence
'c-beginning-of-statement
c-mode-base-map global-map)
(substitute-key-definition 'forward-sentence
'c-end-of-statement
c-mode-base-map global-map)
(substitute-key-definition 'indent-new-comment-line
'c-indent-new-comment-line
c-mode-base-map global-map)
(substitute-key-definition 'indent-for-tab-command
'c-indent-command
c-mode-base-map global-map)
(when (fboundp 'comment-indent-new-line)
(substitute-key-definition 'comment-indent-new-line
'c-indent-new-comment-line
c-mode-base-map global-map))
(define-key c-mode-base-map "\e\C-a" 'c-beginning-of-defun)
(define-key c-mode-base-map "\e\C-e" 'c-end-of-defun)
(define-key c-mode-base-map "\C-c\C-n" 'c-forward-conditional)
(define-key c-mode-base-map "\C-c\C-p" 'c-backward-conditional)
(define-key c-mode-base-map "\C-c\C-u" 'c-up-conditional)
(substitute-key-definition 'fill-paragraph 'c-fill-paragraph
c-mode-base-map global-map)
(substitute-key-definition 'fill-paragraph-or-region 'c-fill-paragraph
c-mode-base-map global-map)
(define-key c-mode-base-map "\C-d" 'c-electric-delete-forward)
(define-key c-mode-base-map "\177" 'c-electric-backspace)
(define-key c-mode-base-map "\C-c\C-d" 'c-hungry-delete-forward)
(define-key c-mode-base-map [?\C-c ?\d] 'c-hungry-delete-backwards)
(define-key c-mode-base-map [?\C-c ?\C-\d] 'c-hungry-delete-backwards)
(define-key c-mode-base-map [?\C-c deletechar] 'c-hungry-delete-forward) (define-key c-mode-base-map [?\C-c (control deletechar)] 'c-hungry-delete-forward)
(when (boundp 'normal-erase-is-backspace)
(add-hook 'normal-erase-is-backspace-hook 'c-bind-special-erase-keys)
(c-bind-special-erase-keys))
(when (fboundp 'delete-forward-p)
(define-key c-mode-base-map [delete] 'c-electric-delete)
(define-key c-mode-base-map [backspace] 'c-electric-backspace)
(define-key c-mode-base-map (kbd "C-c <delete>") 'c-hungry-delete)
(define-key c-mode-base-map (kbd "C-c C-<delete>") 'c-hungry-delete)
(define-key c-mode-base-map (kbd "C-c <backspace>")
'c-hungry-delete-backwards)
(define-key c-mode-base-map (kbd "C-c C-<backspace>")
'c-hungry-delete-backwards))
(define-key c-mode-base-map "#" 'c-electric-pound)
(define-key c-mode-base-map "{" 'c-electric-brace)
(define-key c-mode-base-map "}" 'c-electric-brace)
(define-key c-mode-base-map "/" 'c-electric-slash)
(define-key c-mode-base-map "*" 'c-electric-star)
(define-key c-mode-base-map ";" 'c-electric-semi&comma)
(define-key c-mode-base-map "," 'c-electric-semi&comma)
(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)
(define-key c-mode-base-map "\C-c\C-\\" 'c-backslash-region)
(define-key c-mode-base-map "\C-c\C-a" 'c-toggle-auto-newline)
(define-key c-mode-base-map "\C-c\C-b" 'c-submit-bug-report)
(define-key c-mode-base-map "\C-c\C-c" 'comment-region)
(define-key c-mode-base-map "\C-c\C-l" 'c-toggle-electric-state)
(define-key c-mode-base-map "\C-c\C-o" 'c-set-offset)
(define-key c-mode-base-map "\C-c\C-q" 'c-indent-defun)
(define-key c-mode-base-map "\C-c\C-s" 'c-show-syntactic-information)
(define-key c-mode-base-map "\C-c." 'c-set-style)
(define-key c-mode-base-map "\C-c\C-w" 'c-subword-mode)
)
(cc-bytecomp-defvar outline-level)
(defun c-mode-menu (modestr)
"Return a menu spec suitable for `easy-menu-define' that is exactly
like the C mode menu except that the menu bar item name is MODESTR
instead of \"C\".
This function is provided for compatibility only; derived modes should
preferably use the `c-mode-menu' language constant directly."
(cons modestr (c-lang-const c-mode-menu c)))
(defalias 'c-populate-syntax-table
(cc-eval-when-compile
(let ((f (symbol-function 'c-populate-syntax-table)))
(if (byte-code-function-p f) f (byte-compile f)))))
(defun c-unfind-enclosing-token (pos)
(save-excursion
(let ((tok-beg (progn (goto-char pos)
(and (c-beginning-of-current-token) (point))))
(tok-end (progn (goto-char pos)
(and (c-end-of-current-token) (point)))))
(when (and tok-beg tok-end)
(c-unfind-type (buffer-substring-no-properties tok-beg tok-end))
t))))
(defun c-unfind-coalesced-tokens (beg end)
(or (c-partial-ws-p beg end)
(save-excursion
(progn
(goto-char beg)
(or (eq beg (point-min))
(c-skip-ws-backward (1- beg))
(/= (point) beg)
(= (c-backward-token-2) 1)
(c-unfind-type (buffer-substring-no-properties
(point) beg)))
(goto-char end)
(or (eq end (point-max))
(c-skip-ws-forward (1+ end))
(/= (point) end)
(progn (forward-char) (c-end-of-current-token) nil)
(c-unfind-type (buffer-substring-no-properties
end (point))))))))
(defvar c-maybe-stale-found-type nil)
(make-variable-buffer-local 'c-maybe-stale-found-type)
(defun c-before-change (beg end)
(setq c-maybe-stale-found-type nil)
(save-restriction
(save-match-data
(widen)
(save-excursion
(c-unfind-enclosing-token beg)
(c-unfind-enclosing-token end)
(when (< beg end)
(c-unfind-coalesced-tokens beg end))
(let (lim
type type-pos
marked-id term-pos
(end1
(or (and (eq (get-text-property end 'face) 'font-lock-comment-face)
(previous-single-property-change end 'face))
end)))
(when (>= end1 beg) (while
(and (/= (skip-chars-backward "^;{}") 0)
(> (point) (point-min))
(memq (c-get-char-property (1- (point)) 'face)
'(font-lock-comment-face font-lock-string-face))))
(setq lim (max (point-min) (1- (point))))
(when (and (> end1 (point-min))
(setq type-pos
(if (get-text-property (1- end1) 'c-type)
end1
(previous-single-property-change end1 'c-type nil lim))))
(setq type (get-text-property (max (1- type-pos) lim) 'c-type))
(when (memq type '(c-decl-id-start c-decl-type-start))
(goto-char (1- type-pos))
(setq marked-id
(when (looking-at "\\(\\sw\\|\\s_\\)")
(c-beginning-of-current-token)
(buffer-substring-no-properties (point) type-pos)))
(goto-char end1)
(skip-chars-forward "^;{}") (setq lim (point))
(setq term-pos
(or (next-single-property-change end 'c-type nil lim) lim))
(setq c-maybe-stale-found-type
(list type marked-id
type-pos term-pos
(buffer-substring-no-properties type-pos term-pos)
(buffer-substring-no-properties beg end)))))))))))
(defun c-after-change (beg end old-len)
(c-save-buffer-state ()
(save-restriction
(save-match-data (widen)
(when (> end (point-max))
(setq end (point-max))
(when (> beg end)
(setq beg end)))
(c-trim-found-types beg end old-len) (c-invalidate-sws-region-after beg end)
(c-invalidate-state-cache beg)
(c-invalidate-find-decl-cache beg)
(when c-recognize-<>-arglists
(c-after-change-check-<>-operators beg end))))))
(defun c-basic-common-init (mode default-style)
"Do the necessary initialization for the syntax handling routines
and the line breaking/filling code. Intended to be used by other
packages that embed CC Mode.
MODE is the CC Mode flavor to set up, e.g. 'c-mode or 'java-mode.
DEFAULT-STYLE tells which indentation style to install. It has the
same format as `c-default-style'.
Note that `c-init-language-vars' must be called before this function.
This function cannot do that since `c-init-language-vars' is a macro
that requires a literal mode spec at compile time."
(setq c-buffer-is-cc-mode mode)
(make-local-variable 'parse-sexp-ignore-comments)
(make-local-variable 'indent-line-function)
(make-local-variable 'indent-region-function)
(make-local-variable 'normal-auto-fill-function)
(make-local-variable 'comment-start)
(make-local-variable 'comment-end)
(make-local-variable 'comment-start-skip)
(make-local-variable 'comment-multi-line)
(make-local-variable 'comment-line-break-function)
(make-local-variable 'paragraph-start)
(make-local-variable 'paragraph-separate)
(make-local-variable 'paragraph-ignore-fill-prefix)
(make-local-variable 'adaptive-fill-mode)
(make-local-variable 'adaptive-fill-regexp)
(setq parse-sexp-ignore-comments t
indent-line-function 'c-indent-line
indent-region-function 'c-indent-region
normal-auto-fill-function 'c-do-auto-fill
comment-multi-line t
comment-line-break-function 'c-indent-new-comment-line)
(make-local-variable 'fill-paragraph-function)
(setq fill-paragraph-function 'c-fill-paragraph)
(when (or c-recognize-<>-arglists
(c-major-mode-is 'awk-mode))
(when (boundp 'parse-sexp-lookup-properties)
(make-local-variable 'parse-sexp-lookup-properties)
(setq parse-sexp-lookup-properties t))
(when (boundp 'lookup-syntax-properties)
(make-local-variable 'lookup-syntax-properties)
(setq lookup-syntax-properties t)))
(when (boundp 'text-property-default-nonsticky)
(make-local-variable 'text-property-default-nonsticky)
(let ((elem (assq 'syntax-table text-property-default-nonsticky)))
(if elem
(setcdr elem t)
(setq text-property-default-nonsticky
(cons '(syntax-table . t)
text-property-default-nonsticky))))
(setq text-property-default-nonsticky
(cons '(c-type . t)
text-property-default-nonsticky)))
(c-clear-found-types)
(let ((style (if (stringp default-style)
default-style
(or (cdr (assq mode default-style))
(cdr (assq 'other default-style))
"gnu"))))
(c-set-style style (not (or c-old-style-variable-behavior
(and (not c-style-variables-are-local-p)
c-indentation-style
(not (string-equal c-indentation-style
style)))))))
(c-setup-paragraph-variables)
(setq c-offsets-alist (copy-alist c-offsets-alist))
(make-local-variable 'comment-indent-function)
(setq comment-indent-function 'c-comment-indent)
(c-update-modeline)
(make-local-hook 'before-change-functions)
(add-hook 'before-change-functions 'c-before-change nil t)
(make-local-hook 'after-change-functions)
(add-hook 'after-change-functions 'c-after-change nil t))
(defun c-after-font-lock-init ()
(remove-hook 'after-change-functions 'c-after-change t)
(add-hook 'after-change-functions 'c-after-change nil t))
(defun c-font-lock-init ()
"Set up the font-lock variables for using the font-lock support in CC Mode.
This does not load the font-lock package. Use after
`c-basic-common-init' and after cc-fonts has been loaded."
(make-local-variable 'font-lock-defaults)
(setq font-lock-defaults
`(,(if (c-major-mode-is 'awk-mode)
'awk-font-lock-keywords
(mapcar 'c-mode-symbol
'("font-lock-keywords" "font-lock-keywords-1"
"font-lock-keywords-2" "font-lock-keywords-3")))
nil nil
,c-identifier-syntax-modifications
c-beginning-of-syntax
(font-lock-lines-before . 1)
(font-lock-mark-block-function
. c-mark-function)))
(make-local-hook 'font-lock-mode-hook)
(add-hook 'font-lock-mode-hook 'c-after-font-lock-init nil t))
(defun c-setup-doc-comment-style ()
"Initialize the variables that depend on the value of `c-doc-comment-style'."
(when (and (featurep 'font-lock)
(symbol-value 'font-lock-mode))
(font-lock-mode 0)
(font-lock-mode 1)))
(defun c-common-init (&optional mode)
"Common initialization for all CC Mode modes.
In addition to the work done by `c-basic-common-init' and
`c-font-lock-init', this function sets up various other things as
customary in CC Mode modes but which aren't strictly necessary for CC
Mode to operate correctly.
MODE is the symbol for the mode to initialize, like 'c-mode. See
`c-basic-common-init' for details. It's only optional to be
compatible with old code; callers should always specify it."
(unless mode
(c-init-language-vars-for 'c-mode))
(c-basic-common-init mode c-default-style)
(when mode
(c-font-lock-init))
(make-local-variable 'outline-regexp)
(make-local-variable 'outline-level)
(setq outline-regexp "[^#\n\^M]"
outline-level 'c-outline-level)
(let ((rfn (assq mode c-require-final-newline)))
(when rfn
(make-local-variable 'require-final-newline)
(and (cdr rfn)
(setq require-final-newline mode-require-final-newline)))))
(defun c-remove-any-local-eval-or-mode-variables ()
(goto-char (point-max))
(search-backward "\n\^L" (max (- (point-max) 3000) (point-min)) 'move)
(let (lv-point (prefix "") (suffix ""))
(when (let ((case-fold-search t))
(search-forward "Local Variables:" nil t))
(setq lv-point (point))
(skip-chars-forward " \t")
(or (eolp)
(setq suffix (buffer-substring (point)
(progn (end-of-line) (point)))))
(goto-char (match-beginning 0))
(or (bolp)
(setq prefix
(buffer-substring (point)
(progn (beginning-of-line) (point)))))
(while (search-forward-regexp
(concat "^[ \t]*"
(regexp-quote prefix)
"\\(mode\\|eval\\):.*"
(regexp-quote suffix)
"$")
nil t)
(beginning-of-line)
(delete-region (point) (progn (end-of-line) (point)))))
(unless (and lv-point
(progn (goto-char lv-point)
(forward-line 0)
(bobp)))
(goto-char (point-min))
(delete-region (point) (progn (end-of-line) (point))))))
(defun c-postprocess-file-styles ()
"Function that post processes relevant file local variables in CC Mode.
Currently, this function simply applies any style and offset settings
found in the file's Local Variable list. It first applies any style
setting found in `c-file-style', then it applies any offset settings
it finds in `c-file-offsets'.
Note that the style variables are always made local to the buffer."
(when c-buffer-is-cc-mode
(if (or c-file-style c-file-offsets)
(c-make-styles-buffer-local t))
(and c-file-style
(c-set-style c-file-style))
(and c-file-offsets
(mapcar
(lambda (langentry)
(let ((langelem (car langentry))
(offset (cdr langentry)))
(c-set-offset langelem offset)))
c-file-offsets))
(if (or c-file-style c-file-offsets)
(let ((hack-local-variables-hook nil) (inhibit-read-only t))
(c-tentative-buffer-changes
(c-remove-any-local-eval-or-mode-variables)
(hack-local-variables))
nil))))
(add-hook 'hack-local-variables-hook 'c-postprocess-file-styles)
(defmacro c-run-mode-hooks (&rest hooks)
(if (cc-bytecomp-fboundp 'run-mode-hooks)
`(run-mode-hooks ,@hooks)
`(progn ,@(mapcar (lambda (hook) `(run-hooks ,hook)) hooks))))
(defvar c-mode-syntax-table nil
"Syntax table used in c-mode buffers.")
(or c-mode-syntax-table
(setq c-mode-syntax-table
(funcall (c-lang-const c-make-mode-syntax-table c))))
(defvar c-mode-abbrev-table nil
"Abbreviation table used in c-mode buffers.")
(c-define-abbrev-table 'c-mode-abbrev-table
'(("else" "else" c-electric-continued-statement 0)
("while" "while" c-electric-continued-statement 0)))
(defvar c-mode-map ()
"Keymap used in c-mode buffers.")
(if c-mode-map
nil
(setq c-mode-map (c-make-inherited-keymap))
(define-key c-mode-map "\C-c\C-e" 'c-macro-expand)
)
(easy-menu-define c-c-menu c-mode-map "C Mode Commands"
(cons "C" (c-lang-const c-mode-menu c)))
(defun c-mode ()
"Major mode for editing K&R and ANSI C code.
To submit a problem report, enter `\\[c-submit-bug-report]' from a
c-mode buffer. This automatically sets up a mail buffer with version
information already added. You just need to add a description of the
problem, including a reproducible test case, and send the message.
To see what version of CC Mode you are running, enter `\\[c-version]'.
The hook `c-mode-common-hook' is run with no args at mode
initialization, then `c-mode-hook'.
Key bindings:
\\{c-mode-map}"
(interactive)
(kill-all-local-variables)
(c-initialize-cc-mode t)
(set-syntax-table c-mode-syntax-table)
(setq major-mode 'c-mode
mode-name "C"
local-abbrev-table c-mode-abbrev-table
abbrev-mode t)
(use-local-map c-mode-map)
(c-init-language-vars-for 'c-mode)
(c-common-init 'c-mode)
(easy-menu-add c-c-menu)
(cc-imenu-init cc-imenu-c-generic-expression)
(c-run-mode-hooks 'c-mode-common-hook 'c-mode-hook)
(c-update-modeline))
(defvar c++-mode-syntax-table nil
"Syntax table used in c++-mode buffers.")
(or c++-mode-syntax-table
(setq c++-mode-syntax-table
(funcall (c-lang-const c-make-mode-syntax-table c++))))
(defvar c++-mode-abbrev-table nil
"Abbreviation table used in c++-mode buffers.")
(c-define-abbrev-table 'c++-mode-abbrev-table
'(("else" "else" c-electric-continued-statement 0)
("while" "while" c-electric-continued-statement 0)
("catch" "catch" c-electric-continued-statement 0)))
(defvar c++-mode-map ()
"Keymap used in c++-mode buffers.")
(if c++-mode-map
nil
(setq c++-mode-map (c-make-inherited-keymap))
(define-key c++-mode-map "\C-c\C-e" 'c-macro-expand)
(define-key c++-mode-map "\C-c:" 'c-scope-operator)
(define-key c++-mode-map "<" 'c-electric-lt-gt)
(define-key c++-mode-map ">" 'c-electric-lt-gt))
(easy-menu-define c-c++-menu c++-mode-map "C++ Mode Commands"
(cons "C++" (c-lang-const c-mode-menu c++)))
(defun c++-mode ()
"Major mode for editing C++ code.
To submit a problem report, enter `\\[c-submit-bug-report]' from a
c++-mode buffer. This automatically sets up a mail buffer with
version information already added. You just need to add a description
of the problem, including a reproducible test case, and send the
message.
To see what version of CC Mode you are running, enter `\\[c-version]'.
The hook `c-mode-common-hook' is run with no args at mode
initialization, then `c++-mode-hook'.
Key bindings:
\\{c++-mode-map}"
(interactive)
(kill-all-local-variables)
(c-initialize-cc-mode t)
(set-syntax-table c++-mode-syntax-table)
(setq major-mode 'c++-mode
mode-name "C++"
local-abbrev-table c++-mode-abbrev-table
abbrev-mode t)
(use-local-map c++-mode-map)
(c-init-language-vars-for 'c++-mode)
(c-common-init 'c++-mode)
(easy-menu-add c-c++-menu)
(cc-imenu-init cc-imenu-c++-generic-expression)
(c-run-mode-hooks 'c-mode-common-hook 'c++-mode-hook)
(c-update-modeline))
(defvar objc-mode-syntax-table nil
"Syntax table used in objc-mode buffers.")
(or objc-mode-syntax-table
(setq objc-mode-syntax-table
(funcall (c-lang-const c-make-mode-syntax-table objc))))
(defvar objc-mode-abbrev-table nil
"Abbreviation table used in objc-mode buffers.")
(c-define-abbrev-table 'objc-mode-abbrev-table
'(("else" "else" c-electric-continued-statement 0)
("while" "while" c-electric-continued-statement 0)))
(defvar objc-mode-map ()
"Keymap used in objc-mode buffers.")
(if objc-mode-map
nil
(setq objc-mode-map (c-make-inherited-keymap))
(define-key objc-mode-map "\C-c\C-e" 'c-macro-expand))
(easy-menu-define c-objc-menu objc-mode-map "ObjC Mode Commands"
(cons "ObjC" (c-lang-const c-mode-menu objc)))
(defun objc-mode ()
"Major mode for editing Objective C code.
To submit a problem report, enter `\\[c-submit-bug-report]' from an
objc-mode buffer. This automatically sets up a mail buffer with
version information already added. You just need to add a description
of the problem, including a reproducible test case, and send the
message.
To see what version of CC Mode you are running, enter `\\[c-version]'.
The hook `c-mode-common-hook' is run with no args at mode
initialization, then `objc-mode-hook'.
Key bindings:
\\{objc-mode-map}"
(interactive)
(kill-all-local-variables)
(c-initialize-cc-mode t)
(set-syntax-table objc-mode-syntax-table)
(setq major-mode 'objc-mode
mode-name "ObjC"
local-abbrev-table objc-mode-abbrev-table
abbrev-mode t)
(use-local-map objc-mode-map)
(c-init-language-vars-for 'objc-mode)
(c-common-init 'objc-mode)
(easy-menu-add c-objc-menu)
(cc-imenu-init nil 'cc-imenu-objc-function)
(c-run-mode-hooks 'c-mode-common-hook 'objc-mode-hook)
(c-update-modeline))
(defvar java-mode-syntax-table nil
"Syntax table used in java-mode buffers.")
(or java-mode-syntax-table
(setq java-mode-syntax-table
(funcall (c-lang-const c-make-mode-syntax-table java))))
(defvar java-mode-abbrev-table nil
"Abbreviation table used in java-mode buffers.")
(c-define-abbrev-table 'java-mode-abbrev-table
'(("else" "else" c-electric-continued-statement 0)
("while" "while" c-electric-continued-statement 0)
("catch" "catch" c-electric-continued-statement 0)
("finally" "finally" c-electric-continued-statement 0)))
(defvar java-mode-map ()
"Keymap used in java-mode buffers.")
(if java-mode-map
nil
(setq java-mode-map (c-make-inherited-keymap))
)
(defconst c-Java-defun-prompt-regexp
"^[ \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\v]*\\)+\\)?\\s-*")
(easy-menu-define c-java-menu java-mode-map "Java Mode Commands"
(cons "Java" (c-lang-const c-mode-menu java)))
(defun java-mode ()
"Major mode for editing Java code.
To submit a problem report, enter `\\[c-submit-bug-report]' from a
java-mode buffer. This automatically sets up a mail buffer with
version information already added. You just need to add a description
of the problem, including a reproducible test case, and send the
message.
To see what version of CC Mode you are running, enter `\\[c-version]'.
The hook `c-mode-common-hook' is run with no args at mode
initialization, then `java-mode-hook'.
Key bindings:
\\{java-mode-map}"
(interactive)
(kill-all-local-variables)
(c-initialize-cc-mode t)
(set-syntax-table java-mode-syntax-table)
(setq major-mode 'java-mode
mode-name "Java"
local-abbrev-table java-mode-abbrev-table
abbrev-mode t)
(use-local-map java-mode-map)
(c-init-language-vars-for 'java-mode)
(c-common-init 'java-mode)
(easy-menu-add c-java-menu)
(cc-imenu-init cc-imenu-java-generic-expression)
(c-run-mode-hooks 'c-mode-common-hook 'java-mode-hook)
(c-update-modeline))
(defvar idl-mode-syntax-table nil
"Syntax table used in idl-mode buffers.")
(or idl-mode-syntax-table
(setq idl-mode-syntax-table
(funcall (c-lang-const c-make-mode-syntax-table idl))))
(defvar idl-mode-abbrev-table nil
"Abbreviation table used in idl-mode buffers.")
(c-define-abbrev-table 'idl-mode-abbrev-table nil)
(defvar idl-mode-map ()
"Keymap used in idl-mode buffers.")
(if idl-mode-map
nil
(setq idl-mode-map (c-make-inherited-keymap))
)
(easy-menu-define c-idl-menu idl-mode-map "IDL Mode Commands"
(cons "IDL" (c-lang-const c-mode-menu idl)))
(defun idl-mode ()
"Major mode for editing CORBA's IDL, PSDL and CIDL code.
To submit a problem report, enter `\\[c-submit-bug-report]' from an
idl-mode buffer. This automatically sets up a mail buffer with
version information already added. You just need to add a description
of the problem, including a reproducible test case, and send the
message.
To see what version of CC Mode you are running, enter `\\[c-version]'.
The hook `c-mode-common-hook' is run with no args at mode
initialization, then `idl-mode-hook'.
Key bindings:
\\{idl-mode-map}"
(interactive)
(kill-all-local-variables)
(c-initialize-cc-mode t)
(set-syntax-table idl-mode-syntax-table)
(setq major-mode 'idl-mode
mode-name "IDL"
local-abbrev-table idl-mode-abbrev-table)
(use-local-map idl-mode-map)
(c-init-language-vars-for 'idl-mode)
(c-common-init 'idl-mode)
(easy-menu-add c-idl-menu)
(c-run-mode-hooks 'c-mode-common-hook 'idl-mode-hook)
(c-update-modeline))
(defvar pike-mode-syntax-table nil
"Syntax table used in pike-mode buffers.")
(or pike-mode-syntax-table
(setq pike-mode-syntax-table
(funcall (c-lang-const c-make-mode-syntax-table pike))))
(defvar pike-mode-abbrev-table nil
"Abbreviation table used in pike-mode buffers.")
(c-define-abbrev-table 'pike-mode-abbrev-table
'(("else" "else" c-electric-continued-statement 0)
("while" "while" c-electric-continued-statement 0)))
(defvar pike-mode-map ()
"Keymap used in pike-mode buffers.")
(if pike-mode-map
nil
(setq pike-mode-map (c-make-inherited-keymap))
(define-key pike-mode-map "\C-c\C-e" 'c-macro-expand))
(easy-menu-define c-pike-menu pike-mode-map "Pike Mode Commands"
(cons "Pike" (c-lang-const c-mode-menu pike)))
(defun pike-mode ()
"Major mode for editing Pike code.
To submit a problem report, enter `\\[c-submit-bug-report]' from a
pike-mode buffer. This automatically sets up a mail buffer with
version information already added. You just need to add a description
of the problem, including a reproducible test case, and send the
message.
To see what version of CC Mode you are running, enter `\\[c-version]'.
The hook `c-mode-common-hook' is run with no args at mode
initialization, then `pike-mode-hook'.
Key bindings:
\\{pike-mode-map}"
(interactive)
(kill-all-local-variables)
(c-initialize-cc-mode t)
(set-syntax-table pike-mode-syntax-table)
(setq major-mode 'pike-mode
mode-name "Pike"
local-abbrev-table pike-mode-abbrev-table
abbrev-mode t)
(use-local-map pike-mode-map)
(c-init-language-vars-for 'pike-mode)
(c-common-init 'pike-mode)
(easy-menu-add c-pike-menu)
(c-run-mode-hooks 'c-mode-common-hook 'pike-mode-hook)
(c-update-modeline))
(defvar awk-mode-abbrev-table nil
"Abbreviation table used in awk-mode buffers.")
(c-define-abbrev-table 'awk-mode-abbrev-table
'(("else" "else" c-electric-continued-statement 0)
("while" "while" c-electric-continued-statement 0)))
(defvar awk-mode-map ()
"Keymap used in awk-mode buffers.")
(if awk-mode-map
nil
(setq awk-mode-map (c-make-inherited-keymap))
(define-key awk-mode-map "#" 'self-insert-command)
(define-key awk-mode-map "/" 'self-insert-command)
(define-key awk-mode-map "*" 'self-insert-command)
(define-key awk-mode-map "\C-c\C-n" 'undefined) (define-key awk-mode-map "\C-c\C-p" 'undefined)
(define-key awk-mode-map "\C-c\C-u" 'undefined)
(define-key awk-mode-map "\M-a" 'c-beginning-of-statement) (define-key awk-mode-map "\M-e" 'c-end-of-statement) (define-key awk-mode-map "\C-\M-a" 'c-awk-beginning-of-defun)
(define-key awk-mode-map "\C-\M-e" 'c-awk-end-of-defun))
(easy-menu-define c-awk-menu awk-mode-map "AWK Mode Commands"
(cons "AWK" (c-lang-const c-mode-menu awk)))
(defun awk-mode ()
"Major mode for editing AWK code.
To submit a problem report, enter `\\[c-submit-bug-report]' from an
awk-mode buffer. This automatically sets up a mail buffer with version
information already added. You just need to add a description of the
problem, including a reproducible test case, and send the message.
To see what version of CC Mode you are running, enter `\\[c-version]'.
The hook `c-mode-common-hook' is run with no args at mode
initialization, then `awk-mode-hook'.
Key bindings:
\\{awk-mode-map}"
(interactive)
(require 'cc-awk) (kill-all-local-variables)
(c-initialize-cc-mode t)
(set-syntax-table awk-mode-syntax-table)
(setq major-mode 'awk-mode
mode-name "AWK"
local-abbrev-table awk-mode-abbrev-table
abbrev-mode t)
(use-local-map awk-mode-map)
(c-init-language-vars-for 'awk-mode)
(c-common-init 'awk-mode)
(make-local-variable 'font-lock-syntactic-keywords)
(setq font-lock-syntactic-keywords
'((c-awk-set-syntax-table-properties
0 (0) nil t)))
(c-awk-unstick-NL-prop)
(add-hook 'before-change-functions 'c-awk-before-change nil t)
(add-hook 'after-change-functions 'c-awk-after-change nil t)
(c-save-buffer-state nil
(save-restriction
(widen)
(c-awk-clear-NL-props (point-min) (point-max))
(c-awk-after-change (point-min) (point-max) 0)))
(defalias 'c-in-literal 'c-slow-in-literal)
(c-run-mode-hooks 'c-mode-common-hook 'awk-mode-hook)
(c-update-modeline))
(defconst c-mode-help-address
"bug-cc-mode@gnu.org"
"Address(es) for CC Mode bug reports.")
(defun c-version ()
"Echo the current version of CC Mode in the minibuffer."
(interactive)
(message "Using CC Mode version %s" c-version)
(c-keep-region-active))
(defvar c-prepare-bug-report-hooks nil)
(defvar reporter-prompt-for-summary-p)
(defvar reporter-dont-compact-list)
(defun c-submit-bug-report ()
"Submit via mail a bug report on CC Mode."
(interactive)
(require 'reporter)
(let ((reporter-prompt-for-summary-p t)
(reporter-dont-compact-list '(c-offsets-alist))
(style c-indentation-style)
(c-features c-emacs-features))
(and
(if (y-or-n-p "Do you want to submit a report on CC Mode? ")
t (message "") nil)
(reporter-submit-bug-report
c-mode-help-address
(concat "CC Mode " c-version " (" mode-name ")")
(let ((vars (append
c-style-variables
'(c-buffer-is-cc-mode
c-tab-always-indent
c-syntactic-indentation
c-syntactic-indentation-in-macros
c-ignore-auto-fill
c-auto-align-backslashes
c-backspace-function
c-delete-function
c-electric-pound-behavior
c-default-style
c-enable-xemacs-performance-kludge-p
c-old-style-variable-behavior
defun-prompt-regexp
tab-width
comment-column
parse-sexp-ignore-comments
parse-sexp-lookup-properties
lookup-syntax-properties
signal-error-on-buffer-boundary
auto-fill-mode
auto-fill-function
filladapt-mode
comment-multi-line
comment-start-skip
fill-prefix
fill-column
paragraph-start
adaptive-fill-mode
adaptive-fill-regexp)
nil)))
(mapcar (lambda (var) (unless (boundp var)
(setq vars (delq var vars))))
'(signal-error-on-buffer-boundary
filladapt-mode
defun-prompt-regexp
font-lock-mode
font-lock-maximum-decoration
parse-sexp-lookup-properties
lookup-syntax-properties))
vars)
(lambda ()
(run-hooks 'c-prepare-bug-report-hooks)
(insert (format "Buffer Style: %s\nc-emacs-features: %s\n"
style c-features)))))))
(cc-provide 'cc-mode)