mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2024-12-24 10:38:38 +00:00
2005-05-23 Martin Stjernholm <bug-cc-mode@gnu.org>
CC Mode update to 5.30.10: * cc-fonts.el (c-font-lock-declarators): Fixed bug where the point could go past the limit in decoration level 2, thereby causing errors during interactive fontification. * cc-mode.el (c-make-inherited-keymap): Fixed cc-bytecomp bug when the file is evaluated interactively. * cc-engine.el (c-guess-basic-syntax): Handle operator declarations somewhat better in C++. * cc-styles.el, cc-mode.el (c-run-mode-hooks): New helper macro to make use of run-mode-hooks' which has been added in Emacs 21.1. (c-mode, c++-mode, objc-mode, java-mode, idl-mode, pike-mode, awk-mode): Use it. (make-local-hook): Suppress warning about obsoleteness. * cc-engine.el, cc-align.el, cc-cmds.el (c-append-backslashes-forward, c-delete-backslashes-forward, c-find-decl-spots, c-semi&comma-no-newlines-before-nonblanks): Compensate for return value from forward-line' when it has moved but not to a different line due to eob. * cc-engine.el (c-guess-basic-syntax): Fixed anchoring in objc-method-intro' and objc-method-args-cont'. 2005-05-23 Alan Mackenzie <bug-cc-mode@gnu.org> CC Mode update to 5.30.10: * cc-mode.el, cc-engine.el, cc-align.el: Change the FSF's address in the copyright statement. Incidentally, change "along with GNU Emacs" to "along with this program" where it occurs. * cc-mode.el: Add a fourth parameter t' to the awk-mode autoload, so that it is interactive, hence can be found by M-x awk-mode whilst cc-mode is yet to be loaded. Reported by Glenn Morris <gmorris+emacs@ast.cam.ac.uk>. * cc-awk.el: Add character classes (e.g. "[:alpha:]") into AWK Mode's regexps. 2005-05-23 Kevin Ryde <user42@zip.com.au>: * cc-align.el (c-lineup-argcont): Ignore conses for {} pairs from c-parse-state, to avoid a lisp error (on bad code).
This commit is contained in:
parent
f1e9abb9bf
commit
3efc2cd768
@ -24,9 +24,9 @@
|
||||
;; GNU General Public License for more details.
|
||||
|
||||
;; You should have received a copy of the GNU General Public License
|
||||
;; along with GNU Emacs; see the file COPYING. If not, write to
|
||||
;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
;; Boston, MA 02111-1307, USA.
|
||||
;; along with this program; see the file COPYING. If not, write to
|
||||
;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
;; Boston, MA 02110-1301, USA.
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
@ -175,7 +175,8 @@ Works with: arglist-cont, arglist-cont-nonempty."
|
||||
(let ((open-paren (elt c-syntactic-element 2))
|
||||
(paren-state (c-parse-state)))
|
||||
(while (not (eq (car paren-state) open-paren))
|
||||
(goto-char (car paren-state))
|
||||
(unless (consp (car paren-state)) ;; ignore matched braces
|
||||
(goto-char (car paren-state)))
|
||||
(setq paren-state (cdr paren-state)))))
|
||||
|
||||
(let ((start (point)) c)
|
||||
@ -1171,6 +1172,7 @@ Otherwise, no determination is made."
|
||||
;;(/= (point-max)
|
||||
;; (save-excursion (skip-syntax-forward " ") (point))
|
||||
(zerop (forward-line 1))
|
||||
(bolp) ; forward-line has funny behavior at eob.
|
||||
(not (looking-at "^[ \t]*$")))
|
||||
'stop
|
||||
nil)))
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
;; Copyright (C) 1988,94,96,2000,01,02,03 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: Alan Mackenzie (originally based on awk-mode.el)
|
||||
;; Author: Alan Mackenzie <acm@muc.de> (originally based on awk-mode.el)
|
||||
;; Maintainer: FSF
|
||||
;; Keywords: AWK, cc-mode, unix, languages
|
||||
|
||||
@ -526,13 +526,22 @@
|
||||
;; Matches any AWK regexp character which doesn't require special analysis.
|
||||
(defconst c-awk-escaped-newlines*-re "\\(\\\\[\n\r]\\)*")
|
||||
;; Matches a (possibly empty) sequence of escaped newlines.
|
||||
|
||||
;; NOTE: In what follows, "[asdf]" in a regexp will be called a "character
|
||||
;; list", and "[:alpha:]" inside a character list will be known as a
|
||||
;; "character class". These terms for these things vary between regexp
|
||||
;; descriptions .
|
||||
(defconst c-awk-regexp-char-class-re
|
||||
"\\[:[a-z]+:\\]")
|
||||
;; Matches a character class spec (e.g. [:alpha:]).
|
||||
(defconst c-awk-regexp-char-list-re
|
||||
(concat "\\[" c-awk-escaped-newlines*-re "^?" c-awk-escaped-newlines*-re "]?"
|
||||
"\\(" c-awk-esc-pair-re "\\|" "[^]\n\r]" "\\)*" "\\(]\\|$\\)"))
|
||||
;; Matches a regexp char class, up to (but not including) EOL if the ] is
|
||||
"\\(" c-awk-esc-pair-re "\\|" c-awk-regexp-char-class-re
|
||||
"\\|" "[^]\n\r]" "\\)*" "\\(]\\|$\\)"))
|
||||
;; Matches a regexp char list, up to (but not including) EOL if the ] is
|
||||
;; missing.
|
||||
(defconst c-awk-regexp-innards-re
|
||||
(concat "\\(" c-awk-esc-pair-re "\\|" c-awk-regexp-char-class-re
|
||||
(concat "\\(" c-awk-esc-pair-re "\\|" c-awk-regexp-char-list-re
|
||||
"\\|" c-awk-regexp-normal-re "\\)*"))
|
||||
;; Matches the inside of an AWK regexp (i.e. without the enclosing /s)
|
||||
(defconst c-awk-regexp-without-end-re
|
||||
@ -549,7 +558,7 @@
|
||||
;; A "neutral" char(pair). Doesn't change the "state" of a subsequent /.
|
||||
;; This is space/tab, braces, an auto-increment/decrement operator or an
|
||||
;; escaped character. Or one of the (illegal) characters @ or `. But NOT an
|
||||
;; end of line (even if escpaed).
|
||||
;; end of line (even if escaped).
|
||||
(defconst c-awk-neutrals*-re
|
||||
(concat "\\(" c-awk-neutral-re "\\)*"))
|
||||
;; A (possibly empty) string of neutral characters (or character pairs).
|
||||
|
@ -2441,7 +2441,8 @@ command to conveniently insert and align the necessary backslashes."
|
||||
(delete-region (point) end)
|
||||
(indent-to column 1)))
|
||||
|
||||
(= (forward-line 1) 0))))
|
||||
(zerop (forward-line 1)))
|
||||
(bolp))) ; forward-line has funny behavior at eob.
|
||||
|
||||
;; Make sure there are backslashes with at least one space in
|
||||
;; front of them.
|
||||
@ -2466,7 +2467,8 @@ command to conveniently insert and align the necessary backslashes."
|
||||
(insert ?\\)
|
||||
(insert ?\ ?\\)))
|
||||
|
||||
(= (forward-line 1) 0)))))))
|
||||
(zerop (forward-line 1)))
|
||||
(bolp)))))) ; forward-line has funny behavior at eob.
|
||||
|
||||
(defun c-delete-backslashes-forward (to-mark point-pos)
|
||||
;; This function does not do any hidden buffer changes.
|
||||
@ -2481,7 +2483,8 @@ command to conveniently insert and align the necessary backslashes."
|
||||
(skip-chars-backward " \t" (if (>= (point) point-pos)
|
||||
point-pos))
|
||||
(point))))
|
||||
(= (forward-line 1) 0)))))
|
||||
(zerop (forward-line 1)))
|
||||
(bolp)))) ; forward-line has funny behavior at eob.
|
||||
|
||||
|
||||
|
||||
|
@ -104,7 +104,7 @@
|
||||
|
||||
;;; Variables also used at compile time.
|
||||
|
||||
(defconst c-version "5.30.9"
|
||||
(defconst c-version "5.30.10"
|
||||
"CC Mode version number.")
|
||||
|
||||
(defconst c-version-sym (intern c-version))
|
||||
|
@ -24,9 +24,9 @@
|
||||
;; GNU General Public License for more details.
|
||||
|
||||
;; You should have received a copy of the GNU General Public License
|
||||
;; along with GNU Emacs; see the file COPYING. If not, write to
|
||||
;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
;; Boston, MA 02111-1307, USA.
|
||||
;; along with this program; see the file COPYING. If not, write to
|
||||
;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
;; Boston, MA 02110-1301, USA.
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
@ -3198,6 +3198,7 @@ This function does not do any hidden buffer changes."
|
||||
;; when font-lock refontifies the current line only.
|
||||
(when (save-excursion
|
||||
(and (= (forward-line 1) 0)
|
||||
(bolp) ; forward-line has funny behavior at eob.
|
||||
(or (< (c-point 'eol) cfd-limit)
|
||||
(progn (backward-char)
|
||||
(not (eq (char-before) ?\\))))))
|
||||
@ -4551,7 +4552,7 @@ brace."
|
||||
;; operator token preceded by "operator".
|
||||
(save-excursion
|
||||
(and (c-safe (c-backward-sexp) t)
|
||||
(looking-at "operator\\([^_]\\|$\\)")))
|
||||
(looking-at "operator\\>\\([^_]\\|$\\)")))
|
||||
(and (eq (char-before) ?<)
|
||||
(c-with-syntax-table c++-template-syntax-table
|
||||
(if (c-safe (goto-char (c-up-list-forward (point))))
|
||||
@ -6104,7 +6105,12 @@ This function does not do any hidden buffer changes."
|
||||
;; Note: We use the fact that lim is always after any
|
||||
;; preceding brace sexp.
|
||||
(while (and (zerop (c-backward-token-2 1 t lim))
|
||||
(not (looking-at "[;<,=]"))))
|
||||
(or (not (looking-at "[;<,=]"))
|
||||
(and c-overloadable-operators-regexp
|
||||
(looking-at c-overloadable-operators-regexp)
|
||||
(save-excursion
|
||||
(zerop (c-backward-token-2 1 nil lim))
|
||||
(looking-at "operator\\>[^_]"))))))
|
||||
(or (memq (char-after) '(?, ?=))
|
||||
(and (c-major-mode-is 'c++-mode)
|
||||
(zerop (c-backward-token-2 1 nil lim))
|
||||
@ -6237,7 +6243,15 @@ This function does not do any hidden buffer changes."
|
||||
;; CASE 5I: ObjC method definition.
|
||||
((and c-opt-method-key
|
||||
(looking-at c-opt-method-key))
|
||||
(c-beginning-of-statement-1 lim)
|
||||
(c-beginning-of-statement-1 nil t)
|
||||
(if (= (point) indent-point)
|
||||
;; Handle the case when it's the first (non-comment)
|
||||
;; thing in the buffer. Can't look for a 'same return
|
||||
;; value from cbos1 since ObjC directives currently
|
||||
;; aren't recognized fully, so that we get 'same
|
||||
;; instead of 'previous if it moved over a preceding
|
||||
;; directive.
|
||||
(goto-char (point-min)))
|
||||
(c-add-syntax 'objc-method-intro (c-point 'boi)))
|
||||
;; CASE 5P: AWK pattern or function or continuation
|
||||
;; thereof.
|
||||
@ -6316,11 +6330,13 @@ This function does not do any hidden buffer changes."
|
||||
;; CASE 5K: we are at an ObjC method definition
|
||||
;; continuation line.
|
||||
((and c-opt-method-key
|
||||
(progn
|
||||
(save-excursion
|
||||
(goto-char indent-point)
|
||||
(c-beginning-of-statement-1 lim)
|
||||
(beginning-of-line)
|
||||
(looking-at c-opt-method-key)))
|
||||
(c-add-syntax 'objc-method-args-cont (point)))
|
||||
(when (looking-at c-opt-method-key)
|
||||
(setq placeholder (point)))))
|
||||
(c-add-syntax 'objc-method-args-cont placeholder))
|
||||
;; CASE 5L: we are at the first argument of a template
|
||||
;; arglist that begins on the previous line.
|
||||
((eq (char-before) ?<)
|
||||
|
@ -875,7 +875,7 @@ casts and declarations are fontified. Used on level 2 and higher."
|
||||
;; with array initializers. Otherwise stop at braces
|
||||
;; to avoid going past full function and class blocks.
|
||||
(and (if (and (eq got-init ?=)
|
||||
(= (c-forward-token-2) 0)
|
||||
(= (c-forward-token-2 1 nil limit) 0)
|
||||
(looking-at "{"))
|
||||
(c-safe (c-forward-sexp) t)
|
||||
t)
|
||||
|
@ -1186,7 +1186,7 @@ will be handled."
|
||||
(c-lang-defvar c-brace-list-key (c-lang-const c-brace-list-key))
|
||||
|
||||
(c-lang-defconst c-other-block-decl-kwds
|
||||
"Keywords where the following block (if any) contain another
|
||||
"Keywords where the following block (if any) contains another
|
||||
declaration level that should not be considered a class.
|
||||
|
||||
If any of these also are on `c-type-list-kwds', `c-ref-list-kwds',
|
||||
|
@ -24,9 +24,9 @@
|
||||
;; GNU General Public License for more details.
|
||||
|
||||
;; You should have received a copy of the GNU General Public License
|
||||
;; along with GNU Emacs; see the file COPYING. If not, write to
|
||||
;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
;; Boston, MA 02111-1307, USA.
|
||||
;; along with this program; see the file COPYING. If not, write to
|
||||
;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
;; Boston, MA 02110-1301, USA.
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
@ -91,10 +91,12 @@
|
||||
(cc-require 'cc-align)
|
||||
(cc-require 'cc-menus)
|
||||
|
||||
;; SILENCE the compiler.
|
||||
;; Silence the compiler.
|
||||
(cc-bytecomp-defvar comment-line-break-function) ; (X)Emacs 20+
|
||||
(cc-bytecomp-defvar adaptive-fill-first-line-regexp) ; Emacs 20+
|
||||
(cc-bytecomp-defun set-keymap-parents) ; XEmacs
|
||||
(cc-bytecomp-defun run-mode-hooks) ; Emacs 21.1+
|
||||
(cc-bytecomp-obsolete-fun make-local-hook) ; Marked obsolete in Emacs 21.1.
|
||||
|
||||
;; We set these variables during mode init, yet we don't require
|
||||
;; font-lock.
|
||||
@ -201,12 +203,15 @@ control). See \"cc-mode.el\" for more info."
|
||||
|
||||
(defun c-make-inherited-keymap ()
|
||||
(let ((map (make-sparse-keymap)))
|
||||
;; Necessary to use `cc-bytecomp-fboundp' below since this
|
||||
;; function is called from top-level forms that are evaluated
|
||||
;; while cc-bytecomp is active when one does M-x eval-buffer.
|
||||
(cond
|
||||
;; XEmacs
|
||||
((fboundp 'set-keymap-parents)
|
||||
((cc-bytecomp-fboundp 'set-keymap-parents)
|
||||
(set-keymap-parents map c-mode-base-map))
|
||||
;; Emacs
|
||||
((fboundp 'set-keymap-parent)
|
||||
((cc-bytecomp-fboundp 'set-keymap-parent)
|
||||
(set-keymap-parent map c-mode-base-map))
|
||||
;; incompatible
|
||||
(t (error "CC Mode is incompatible with this version of Emacs")))
|
||||
@ -587,6 +592,13 @@ Note that the style variables are always made local to the buffer."
|
||||
|
||||
(add-hook 'hack-local-variables-hook 'c-postprocess-file-styles)
|
||||
|
||||
(defmacro c-run-mode-hooks (&rest hooks)
|
||||
;; Emacs 21.1 has introduced a system with delayed mode hooks that
|
||||
;; require the use of the new function `run-mode-hooks'.
|
||||
(if (cc-bytecomp-fboundp 'run-mode-hooks)
|
||||
`(run-mode-hooks ,@hooks)
|
||||
`(progn ,@(mapcar (lambda (hook) `(run-hooks ,hook)) hooks))))
|
||||
|
||||
|
||||
;; Support for C
|
||||
|
||||
@ -667,7 +679,7 @@ Key bindings:
|
||||
(c-common-init 'c-mode)
|
||||
(easy-menu-add c-c-menu)
|
||||
(cc-imenu-init cc-imenu-c-generic-expression)
|
||||
(run-mode-hooks 'c-mode-common-hook 'c-mode-hook)
|
||||
(c-run-mode-hooks 'c-mode-common-hook 'c-mode-hook)
|
||||
(c-update-modeline))
|
||||
|
||||
|
||||
@ -730,7 +742,7 @@ Key bindings:
|
||||
(c-common-init 'c++-mode)
|
||||
(easy-menu-add c-c++-menu)
|
||||
(cc-imenu-init cc-imenu-c++-generic-expression)
|
||||
(run-mode-hooks 'c-mode-common-hook 'c++-mode-hook)
|
||||
(c-run-mode-hooks 'c-mode-common-hook 'c++-mode-hook)
|
||||
(c-update-modeline))
|
||||
|
||||
|
||||
@ -794,7 +806,7 @@ Key bindings:
|
||||
(c-common-init 'objc-mode)
|
||||
(easy-menu-add c-objc-menu)
|
||||
(cc-imenu-init nil 'cc-imenu-objc-function)
|
||||
(run-mode-hooks 'c-mode-common-hook 'objc-mode-hook)
|
||||
(c-run-mode-hooks 'c-mode-common-hook 'objc-mode-hook)
|
||||
(c-update-modeline))
|
||||
|
||||
|
||||
@ -864,7 +876,7 @@ Key bindings:
|
||||
(c-common-init 'java-mode)
|
||||
(easy-menu-add c-java-menu)
|
||||
(cc-imenu-init cc-imenu-java-generic-expression)
|
||||
(run-mode-hooks 'c-mode-common-hook 'java-mode-hook)
|
||||
(c-run-mode-hooks 'c-mode-common-hook 'java-mode-hook)
|
||||
(c-update-modeline))
|
||||
|
||||
|
||||
@ -922,7 +934,7 @@ Key bindings:
|
||||
(c-common-init 'idl-mode)
|
||||
(easy-menu-add c-idl-menu)
|
||||
;;(cc-imenu-init cc-imenu-idl-generic-expression) ;TODO
|
||||
(run-mode-hooks 'c-mode-common-hook 'idl-mode-hook)
|
||||
(c-run-mode-hooks 'c-mode-common-hook 'idl-mode-hook)
|
||||
(c-update-modeline))
|
||||
|
||||
|
||||
@ -984,7 +996,7 @@ Key bindings:
|
||||
(c-common-init 'pike-mode)
|
||||
(easy-menu-add c-pike-menu)
|
||||
;;(cc-imenu-init cc-imenu-pike-generic-expression) ;TODO
|
||||
(run-mode-hooks 'c-mode-common-hook 'pike-mode-hook)
|
||||
(c-run-mode-hooks 'c-mode-common-hook 'pike-mode-hook)
|
||||
(c-update-modeline))
|
||||
|
||||
|
||||
@ -1076,7 +1088,7 @@ Key bindings:
|
||||
;; in cc-engine.el, just before (defun c-fast-in-literal ...
|
||||
(defalias 'c-in-literal 'c-slow-in-literal)
|
||||
|
||||
(run-mode-hooks 'c-mode-common-hook 'awk-mode-hook)
|
||||
(c-run-mode-hooks 'c-mode-common-hook 'awk-mode-hook)
|
||||
(c-update-modeline))
|
||||
) ;; closes the (if (not (memq 'syntax-properties c-emacs-features))
|
||||
|
||||
|
@ -48,6 +48,7 @@
|
||||
|
||||
;; Silence the compiler.
|
||||
(cc-bytecomp-defvar adaptive-fill-first-line-regexp) ; Emacs
|
||||
(cc-bytecomp-obsolete-fun make-local-hook) ; Marked obsolete in Emacs 21.1.
|
||||
|
||||
|
||||
(defvar c-style-alist
|
||||
|
Loading…
Reference in New Issue
Block a user