Commit 34d203ef authored by Alan Mackenzie's avatar Alan Mackenzie
Browse files

Revert 2009-12-03T16:02:10Z!acm@muc.de (enhance c-parse-state) and...

Revert 2009-12-03T16:02:10Z!acm@muc.de (enhance c-parse-state) and 2010-02-04T21:15:37Z!acm@muc.de (< and > handling).
[These enhancements were not sufficiently stable at the time of releasing
a pretest.]
parents 79353a53 e42a3301
......@@ -134,11 +134,6 @@
* indent.el (indent-for-tab-command): Doc fix.
2010-03-22 Alan Mackenzie <acm@muc.de>
* progmodes/cc-engine.el (c-remove-stale-state-cache):
Fix off-by-one error. Fixes bug #5747.
2010-03-22 Juanma Barranquero <lekktu@gmail.com>
* image-dired.el (image-dired-display-thumbs): Fix typo in docstring.
......@@ -287,11 +282,6 @@
* calendar/cal-hebrew.el (holiday-hebrew-passover): Fix date
of Yom HaAtzma'ut when it falls on a Monday (rule changed in 2004).
2010-03-01 Alan Mackenzie <acm@muc.de>
* progmodes/cc-engine.el (c-remove-stale-state-cache):
Correct previous patch.
2010-03-01 Kenichi Handa <handa@m17n.org>
* language/burmese.el (burmese-composable-pattern): Rename from
......@@ -303,11 +293,6 @@
(otf-script-alist): Likewise.
(setup-default-fontset): Likewise. Re-fix :otf spec.
2010-03-01 Alan Mackenzie <bug-cc-mode@gnu.org>
* cc-engine.el (c-remove-stale-state-cache): Take account of when
`good-pos' is in the same macro as `here'. Fixes bug#5649.
2010-02-28 Katsumi Yamaoka <yamaoka@jpl.org>
* menu-bar.el (menu-bar-manuals-menu): Fix typo.
......@@ -373,16 +358,6 @@
* mail/sendmail.el (send-mail-function): Autoload the call
to custom-initialize-delay, not otherwise preserved in loaddefs.el.
2010-02-25 Alan Mackenzie <acm@muc.de>
* progmodes/cc-engine.el (c-clear-<-pair-props)
(c-clear->-pair-props): Correct to wipe category text props, not
syntax-table ones.
* progmodes/cc-mode.el (c-after-change): Remove any hard
syntax-table properties for <, > which, e.g., C-y has
inopportunely converted from category properties.
2010-02-24 Chong Yidong <cyd@stupidchicken.com>
* files.el (hack-local-variables-filter): For eval forms, also
......@@ -720,33 +695,6 @@
(doc-view-pdf->png): Don't rely on doc-view-pdf/ps->png for the few
windows that are not yet showing images.
2010-02-04 Alan Mackenzie <acm@muc.de>
Change strategy for marking < and > as template delimiters: mark
them strictly in matching pairs.
* cc-mode.el (c-before-change):
Use c-get-state-before-change-functions.
(c-common-init): Adapt to use
c-get-state-before-change-functions (note plural).
* cc-langs.el (c-no-parens-syntax-table): New syntax table, used
for searching syntactically for matching <s and >s.
(c-get-state-before-change-functions): New language variable (note
the plural) which supersedes c-get-state-before-change-function.
* cc-engine.el (c-clear-<-pair-props, c-clear->-pair-props)
(c-clear-<>-pair-props, c-clear-<-pair-props-if-match-after)
(c-clear->-pair-props-if-match-before)
(c-before-change-check-<>-operators): New functions.
(c-after-change-check-<>-operators): Use macro
c-unmark-<->-as-paren.
* cc-defs.el (c-search-backward-char-property): New macro.
* cc-cmds.el (c-electric-lt-gt): Do not set text properties on <
and > any more. (These will be handled by font locking.)
2010-02-04 Michael Albinus <michael.albinus@gmx.de>
* dired.el (dired-revert): If DIRED-DIRECTORY is a cons cell, call
......
......@@ -1086,76 +1086,104 @@ numeric argument is supplied, or the point is inside a literal."
(interactive "*P")
(let ((c-echo-syntactic-information-p nil)
final-pos close-paren-inserted found-delim)
final-pos close-paren-inserted)
(self-insert-command (prefix-numeric-value arg))
(setq final-pos (point))
;;;; 2010-01-31: There used to be code here to put a syntax-table text
;;;; property on the new < or > and its mate (if any) when they are template
;;;; parens. This is now done in an after-change function.
(c-save-buffer-state (c-parse-and-markup-<>-arglists
c-restricted-<>-arglists
<-pos)
;; Indent the line if appropriate.
(when (and c-electric-flag c-syntactic-indentation c-recognize-<>-arglists)
(setq found-delim
(if (eq last-command-event ?<)
;; If a <, basically see if it's got "template" before it .....
(or (and (progn
(backward-char)
(= (point)
(progn (c-beginning-of-current-token) (point))))
(progn
(c-backward-token-2)
(looking-at c-opt-<>-sexp-key)))
;; ..... or is a C++ << operator.
(and (c-major-mode-is 'c++-mode)
(progn
(goto-char (1- final-pos))
(c-beginning-of-current-token)
(looking-at "<<"))
(>= (match-end 0) final-pos)))
;; It's a >. Either a C++ >> operator. ......
(or (and (c-major-mode-is 'c++-mode)
(when c-recognize-<>-arglists
(if (eq last-command-event ?<)
(when (and (progn
(backward-char)
(= (point)
(progn
(c-beginning-of-current-token)
(point))))
(progn
(goto-char (1- final-pos))
(c-beginning-of-current-token)
(looking-at ">>"))
(>= (match-end 0) final-pos))
;; ...., or search back for a < which isn't already marked as an
;; opening template delimiter.
(save-restriction
(widen)
;; Narrow to avoid `c-forward-<>-arglist' below searching past
;; our position.
(narrow-to-region (point-min) final-pos)
(goto-char final-pos)
(while
(and
(progn
(c-syntactic-skip-backward "^<;}" nil t)
(eq (char-before) ?<))
(progn
(backward-char)
(looking-at "\\s\("))))
(and (eq (char-after) ?<)
(not (looking-at "\\s\("))
(progn (c-backward-syntactic-ws)
(c-simple-skip-symbol-backward))
(or (looking-at c-opt-<>-sexp-key)
(not (looking-at c-keywords-regexp)))))))))
(c-backward-token-2)
(looking-at c-opt-<>-sexp-key)))
(c-mark-<-as-paren (1- final-pos)))
;; It's a ">". Check if there's an earlier "<" which either has
;; open paren syntax already or that can be recognized as an arglist
;; together with this ">". Note that this won't work in cases like
;; "template <x, a < b, y>" but they ought to be rare.
(save-restriction
;; Narrow to avoid that `c-forward-<>-arglist' below searches past
;; our position.
(narrow-to-region (point-min) final-pos)
(while (and
(progn
(goto-char final-pos)
(c-syntactic-skip-backward "^<;}" nil t)
(eq (char-before) ?<))
(progn
(backward-char)
;; If the "<" already got open paren syntax we know we
;; have the matching closer. Handle it and exit the
;; loop.
(if (looking-at "\\s\(")
(progn
(c-mark->-as-paren (1- final-pos))
(setq close-paren-inserted t)
nil)
t))
(progn
(setq <-pos (point))
(c-backward-syntactic-ws)
(c-simple-skip-symbol-backward))
(or (looking-at c-opt-<>-sexp-key)
(not (looking-at c-keywords-regexp)))
(let ((c-parse-and-markup-<>-arglists t)
c-restricted-<>-arglists
(containing-sexp
(c-most-enclosing-brace (c-parse-state))))
(when (and containing-sexp
(progn (goto-char containing-sexp)
(eq (char-after) ?\())
(not (eq (get-text-property (point) 'c-type)
'c-decl-arg-start)))
(setq c-restricted-<>-arglists t))
(goto-char <-pos)
(c-forward-<>-arglist nil))
;; Loop here if the "<" we found above belongs to a nested
;; angle bracket sexp. When we start over we'll find the
;; previous or surrounding sexp.
(if (< (point) final-pos)
t
(setq close-paren-inserted t)
nil)))))))
(goto-char final-pos)
(when found-delim
(indent-according-to-mode)
(when (and (eq (char-before) ?>)
(not executing-kbd-macro)
blink-paren-function)
;; Note: Most paren blink functions, such as the standard
;; `blink-matching-open', currently doesn't handle paren chars
;; marked with text properties very well. Maybe we should avoid
;; this call for the time being?
(funcall blink-paren-function)))))
;; Indent the line if appropriate.
(when (and c-electric-flag c-syntactic-indentation)
(backward-char)
(when (prog1 (or (looking-at "\\s\(\\|\\s\)")
(and (c-major-mode-is 'c++-mode)
(progn
(c-beginning-of-current-token)
(looking-at "<<\\|>>"))
(= (match-end 0) final-pos)))
(goto-char final-pos))
(indent-according-to-mode)))
(when (and close-paren-inserted
(not executing-kbd-macro)
blink-paren-function)
;; Note: Most paren blink functions, such as the standard
;; `blink-matching-open', currently doesn't handle paren chars
;; marked with text properties very well. Maybe we should avoid
;; this call for the time being?
(funcall blink-paren-function))))
(defun c-electric-paren (arg)
"Insert a parenthesis.
......
......@@ -1029,44 +1029,6 @@ MODE is either a mode symbol or a list of mode symbols."
;; Emacs.
`(remove-text-properties ,from ,to '(,property nil))))
(defmacro c-search-forward-char-property (property value &optional limit)
"Search forward for a text-property PROPERTY having value VALUE.
LIMIT bounds the search. The comparison is done with `equal'.
Leave point just after the character, and set the match data on
this character, and return point. If VALUE isn't found, Return
nil; point is then left undefined."
`(let ((place (point)))
(while
(and
(< place ,(or limit '(point-max)))
(not (equal (get-text-property place ,property) ,value)))
(setq place (next-single-property-change
place ,property nil ,(or limit '(point-max)))))
(when (< place ,(or limit '(point-max)))
(goto-char place)
(search-forward-regexp ".") ; to set the match-data.
(point))))
(defmacro c-search-backward-char-property (property value &optional limit)
"Search backward for a text-property PROPERTY having value VALUE.
LIMIT bounds the search. The comparison is done with `equal'.
Leave point just before the character, set the match data on this
character, and return point. If VALUE isn't found, Return nil;
point is then left undefined."
`(let ((place (point)))
(while
(and
(> place ,(or limit '(point-min)))
(not (equal (get-text-property (1- place) ,property) ,value)))
(setq place (previous-single-property-change
place ,property nil ,(or limit '(point-min)))))
(when (> place ,(or limit '(point-max)))
(goto-char place)
(search-backward-regexp ".") ; to set the match-data.
(point))))
(defun c-clear-char-property-with-value-function (from to property value)
"Remove all text-properties PROPERTY from the region (FROM, TO)
which have the value VALUE, as tested by `equal'. These
......@@ -1183,117 +1145,23 @@ been put there by c-put-char-property. POINT remains unchanged."
(goto-char (point-max)))))
(defconst c-<-as-paren-syntax '(4 . ?>))
(put 'c-<-as-paren-syntax 'syntax-table c-<-as-paren-syntax)
(defsubst c-mark-<-as-paren (pos)
;; Mark the "<" character at POS as a template opener using the
;; `syntax-table' property via the `category' property.
;; Mark the "<" character at POS as an sexp list opener using the
;; syntax-table property.
;;
;; This function does a hidden buffer change. Note that we use
;; indirection through the `category' text property. This allows us to
;; toggle the property in all template brackets simultaneously and
;; cheaply. We use this, for instance, in `c-parse-state'.
(c-put-char-property pos 'category 'c-<-as-paren-syntax))
;; This function does a hidden buffer change.
(c-put-char-property pos 'syntax-table c-<-as-paren-syntax))
(defconst c->-as-paren-syntax '(5 . ?<))
(put 'c->-as-paren-syntax 'syntax-table c->-as-paren-syntax)
(defsubst c-mark->-as-paren (pos)
;; Mark the ">" character at POS as an sexp list closer using the
;; syntax-table property.
;;
;; This function does a hidden buffer change. Note that we use
;; indirection through the `category' text property. This allows us to
;; toggle the property in all template brackets simultaneously and
;; cheaply. We use this, for instance, in `c-parse-state'.
(c-put-char-property pos 'category 'c->-as-paren-syntax))
(defsubst c-unmark-<->-as-paren (pos)
;; Unmark the "<" or "<" character at POS as an sexp list opener using
;; the syntax-table property indirectly through the `category' text
;; property.
;;
;; This function does a hidden buffer change. Note that we use
;; indirection through the `category' text property. This allows us to
;; toggle the property in all template brackets simultaneously and
;; cheaply. We use this, for instance, in `c-parse-state'.
(c-clear-char-property pos 'category))
(defsubst c-suppress-<->-as-parens ()
;; Suppress the syntactic effect of all marked < and > as parens. Note
;; that this effect is NOT buffer local. You should probably not use
;; this directly, but only through the macro
;; `c-with-<->-as-parens-suppressed'
(put 'c-<-as-paren-syntax 'syntax-table nil)
(put 'c->-as-paren-syntax 'syntax-table nil))
(defsubst c-restore-<->-as-parens ()
;; Restore the syntactic effect of all marked <s and >s as parens. This
;; has no effect on unmarked <s and >s
(put 'c-<-as-paren-syntax 'syntax-table c-<-as-paren-syntax)
(put 'c->-as-paren-syntax 'syntax-table c->-as-paren-syntax))
(defmacro c-with-<->-as-parens-suppressed (&rest forms)
;; Like progn, except that the paren property is suppressed on all
;; template brackets whilst they are running. This macro does a hidden
;; buffer change.
`(unwind-protect
(progn
(c-suppress-<->-as-parens)
,@forms)
(c-restore-<->-as-parens)))
;;;;;;;;;;;;;;;
(defconst c-cpp-delimiter '(14)) ; generic comment syntax
;; This is the value of the `category' text property placed on every #
;; which introduces a CPP construct and every EOL (or EOB, or character
;; preceding //, etc.) which terminates it. We can instantly "comment
;; out" all CPP constructs by giving `c-cpp-delimiter' a syntax-table
;; propery '(14) (generic comment delimiter).
(defmacro c-set-cpp-delimiters (beg end)
;; This macro does a hidden buffer change.
`(progn
(c-put-char-property ,beg 'category 'c-cpp-delimiter)
(if (< ,end (point-max))
(c-put-char-property ,end 'category 'c-cpp-delimiter))))
(defmacro c-clear-cpp-delimiters (beg end)
;; This macro does a hidden buffer change.
`(progn
(c-clear-char-property ,beg 'category)
(if (< ,end (point-max))
(c-clear-char-property ,end 'category))))
(defsubst c-comment-out-cpps ()
;; Render all preprocessor constructs syntactically commented out.
(put 'c-cpp-delimiter 'syntax-table c-cpp-delimiter))
(defsubst c-uncomment-out-cpps ()
;; Restore the syntactic visibility of preprocessor constructs.
(put 'c-cpp-delimiter 'syntax-table nil))
(defmacro c-with-cpps-commented-out (&rest forms)
;; Execute FORMS... whilst the syntactic effect of all characters in
;; all CPP regions is suppressed. In particular, this is to suppress
;; the syntactic significance of parens/braces/brackets to functions
;; such as `scan-lists' and `parse-partial-sexp'.
`(unwind-protect
(c-save-buffer-state ()
(c-comment-out-cpps)
,@forms)
(c-save-buffer-state ()
(c-uncomment-out-cpps))))
(defmacro c-with-all-but-one-cpps-commented-out (beg end &rest forms)
;; Execute FORMS... whilst the syntactic effect of all characters in
;; every CPP region APART FROM THE ONE BETWEEN BEG and END is
;; suppressed.
`(unwind-protect
(c-save-buffer-state ()
(c-clear-cpp-delimiters ,beg ,end)
,`(c-with-cpps-commented-out ,@forms))
(c-save-buffer-state ()
(c-set-cpp-delimiters ,beg ,end))))
;; This function does a hidden buffer change.
(c-put-char-property pos 'syntax-table c->-as-paren-syntax))
(defsubst c-intersect-lists (list alist)
;; return the element of ALIST that matches the first element found
;; in LIST. Uses assq.
......
This diff is collapsed.
......@@ -426,8 +426,7 @@ stuff. Used on level 1 and higher."
(progn
(c-mark-<-as-paren beg)
(c-mark->-as-paren end))
;; (c-clear-char-property beg 'syntax-table)
(c-clear-char-property beg 'category)))
(c-clear-char-property beg 'syntax-table)))
nil)))))))
;; #define.
......
......@@ -391,27 +391,6 @@ The syntax tables aren't stored directly since they're quite large."
(and (c-lang-const c++-make-template-syntax-table)
(funcall (c-lang-const c++-make-template-syntax-table))))
(c-lang-defconst c-no-parens-syntax-table
;; A variant of the standard syntax table which is used to find matching
;; "<"s and ">"s which have been marked as parens using syntax table
;; properties. The other paren characters (e.g. "{", ")" "]") are given a
;; non-paren syntax here. so that the list commands will work on "< ... >"
;; even when there's unbalanced other parens inside them.
;;
;; This variable is nil for languages which don't have template stuff.
t `(lambda ()
(if (c-lang-const c-recognize-<>-arglists)
(let ((table (funcall ,(c-lang-const c-make-mode-syntax-table))))
(modify-syntax-entry ?\( "." table)
(modify-syntax-entry ?\) "." table)
(modify-syntax-entry ?\[ "." table)
(modify-syntax-entry ?\] "." table)
(modify-syntax-entry ?\{ "." table)
(modify-syntax-entry ?\} "." table)
table))))
(c-lang-defvar c-no-parens-syntax-table
(funcall (c-lang-const c-no-parens-syntax-table)))
(c-lang-defconst c-identifier-syntax-modifications
"A list that describes the modifications that should be done to the
mode syntax table to get a syntax table that matches all identifiers
......@@ -444,36 +423,26 @@ the new syntax, as accepted by `modify-syntax-entry'."
classifies symbol constituents like '_' and '$' as word constituents,
so that all identifiers are recognized as words.")
(c-lang-defconst c-get-state-before-change-functions
;; For documentation see the following c-lang-defvar of the same name.
;; The value here may be a list of functions or a single function.
t nil
c++ '(c-extend-region-for-CPP c-before-change-check-<>-operators)
(c objc) 'c-extend-region-for-CPP
;; java 'c-before-change-check-<>-operators
awk 'c-awk-record-region-clear-NL)
(c-lang-defvar c-get-state-before-change-functions
(let ((fs (c-lang-const c-get-state-before-change-functions)))
(if (listp fs)
fs
(list fs)))
"If non-nil, a list of functions called from c-before-change-hook.
Typically these will record enough state to allow
(c-lang-defconst c-get-state-before-change-function
"If non-nil, a function called from c-before-change-hook.
Typically it will record enough state to allow
`c-before-font-lock-function' to extend the region to fontify,
and may do such things as removing text-properties which must be
recalculated.
These functions will be run in the order given. Each of them
takes 2 parameters, the BEG and END supplied to every
It takes 2 parameters, the BEG and END supplied to every
before-change function; on entry, the buffer will have been
widened and match-data will have been saved; point is undefined
on both entry and exit; the return value is ignored.
The functions are called even when font locking isn't enabled.
When the mode is initialized, the functions are called with
parameters \(point-min) and \(point-max).")
When the mode is initialized, this function is called with
parameters \(point-min) and \(point-max)."
t nil
(c c++ objc) 'c-extend-region-for-CPP
awk 'c-awk-record-region-clear-NL)
(c-lang-defvar c-get-state-before-change-function
(c-lang-const c-get-state-before-change-function))
(c-lang-defconst c-before-font-lock-function
"If non-nil, a function called just before font locking.
Typically it will extend the region about to be fontified \(see
......@@ -492,7 +461,7 @@ The function is called even when font locking is disabled.
When the mode is initialized, this function is called with
parameters \(point-min), \(point-max) and <buffer size>."
t nil
(c c++ objc) 'c-neutralize-syntax-in-and-mark-CPP
(c c++ objc) 'c-extend-and-neutralize-syntax-in-CPP
awk 'c-awk-extend-and-syntax-tablify-region)
(c-lang-defvar c-before-font-lock-function
(c-lang-const c-before-font-lock-function))
......
......@@ -410,7 +410,7 @@ preferably use the `c-mode-menu' language constant directly."
;; temporary changes in some font lock support modes, causing extra
;; unnecessary work and font lock glitches due to interactions between
;; various text properties.
;;
;;
;; (2007-02-12): The macro `combine-after-change-calls' ISN'T used any
;; more.
......@@ -451,18 +451,18 @@ preferably use the `c-mode-menu' language constant directly."
end (point))))))))
;; c-maybe-stale-found-type records a place near the region being
;; changed where an element of `found-types' might become stale. It
;; changed where an element of `found-types' might become stale. It
;; is set in c-before-change and is either nil, or has the form:
;;
;; (c-decl-id-start "foo" 97 107 " (* ooka) " "o"), where
;;
;;
;; o - `c-decl-id-start' is the c-type text property value at buffer
;; pos 96.
;;
;;
;; o - 97 107 is the region potentially containing the stale type -
;; this is delimited by a non-nil c-type text property at 96 and
;; either another one or a ";", "{", or "}" at 107.
;;
;;
;; o - " (* ooka) " is the (before change) buffer portion containing
;; the suspect type (here "ooka").
;;
......@@ -517,9 +517,6 @@ that requires a literal mode spec at compile time."
(make-local-variable 'fill-paragraph-function)
(setq fill-paragraph-function 'c-fill-paragraph)
;; Initialise the cache of brace pairs, and opening braces/brackets/parens.
(c-state-cache-init)
(when (or c-recognize-<>-arglists
(c-major-mode-is 'awk-mode)
(c-major-mode-is '(c-mode c++-mode objc-mode)))
......@@ -641,10 +638,8 @@ compatible with old code; callers should always specify it."
(save-restriction
(widen)
(save-excursion
(if c-get-state-before-change-functions
(mapc (lambda (fn)
(funcall fn (point-min) (point-max)))
c-get-state-before-change-functions))
(if c-get-state-before-change-function
(funcall c-get-state-before-change-function (point-min) (point-max)))
(if c-before-font-lock-function
(funcall c-before-font-lock-function (point-min) (point-max)
(- (point-max) (point-min))))))
......@@ -777,7 +772,7 @@ Note that the style variables are always made local to the buffer."
(defmacro c-run-mode-hooks (&rest hooks)
;; Emacs 21.1 has introduced a system with delayed mode hooks that
;; requires the use of the new function `run-mode-hooks'.
;; 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))))
......@@ -810,8 +805,8 @@ Note that the style variables are always made local to the buffer."
;; has already been widened, and match-data saved. The return value is
;; meaningless.
;;
;; This function is in the C/C++/ObjC values of
;; `c-get-state-before-change-functions' and is called exclusively as a
;; This function is the C/C++/ObjC value of
;; `c-get-state-before-change-function' and is called exclusively as a
;; before change function.
(goto-char beg)
(c-beginning-of-macro)
......@@ -848,7 +843,7 @@ Note that the style variables are always made local to the buffer."
t)
(t nil)))))))
(defun c-neutralize-syntax-in-and-mark-CPP (begg endd old-len)
(defun c-extend-and-neutralize-syntax-in-CPP (begg endd old-len)
;; (i) Extend the font lock region to cover all changed preprocessor
;; regions; it does this by setting the variables `c-new-BEG' and
;; `c-new-END' to the new boundaries.
......@@ -857,15 +852,10 @@ Note that the style variables are always made local to the buffer."
;; extended changed region. "Restore" lines which were CPP lines before the
;; change and are no longer so; these can be located from the Buffer local
;; variables `c-old-BOM' and `c-old-EOM'.
;;
;; (iii) Mark every CPP construct by placing a `category' property value
;; `c-cpp-delimiter' at its start and end. The marked characters are the
;; opening # and usually the terminating EOL, but sometimes the character
;; before a comment/string delimiter.
;;
;;
;; That is, set syntax-table properties on characters that would otherwise
;; interact syntactically with those outside the CPP line(s).
;;
;;
;; This function is called from an after-change function, BEGG ENDD and
;; OLD-LEN being the standard parameters. It prepares the buffer for font
;; locking, hence must get called before `font-lock-after-change-function'.
......@@ -876,34 +866,32 @@ Note that the style variables are always made local to the buffer."
;; This function is the C/C++/ObjC value of `c-before-font-lock-function'.
;;
;; Note: SPEED _MATTERS_ IN THIS FUNCTION!!!
;;
;;
;; This function might make hidden buffer changes.
(c-save-buffer-state (limits)
(c-save-buffer-state (limits mbeg+1)
;; First determine the region, (c-new-BEG c-new-END), which will get font
;; locked. It might need "neutralizing". This region may not start
;; inside a string, comment, or macro.
(goto-char c-old-BOM) ; already set to old start of macro or begg.
(setq c-new-BEG
(if (setq limits (c-state-literal-at (point)))
(if (setq limits (c-literal-limits))
(cdr limits) ; go forward out of any string or comment.
(point)))
(goto-char endd)
(if (setq limits (c-state-literal-at (point)))
(if (setq limits (c-literal-limits))
(goto-char (car limits))) ; go backward out of any string or comment.
(if (c-beginning-of-macro)
(c-end-of-macro))
(setq c-new-END (max (+ (- c-old-EOM old-len) (- endd begg))
(point)))
;; Clear all old relevant properties.
;; Clear any existing punctuation properties.
(c-clear-char-property-with-value c-new-BEG c-new-END 'syntax-table '(1))
(c-clear-char-property-with-value c-new-BEG c-new-END 'category 'c-cpp-delimiter)
;; FIXME!!! What about the "<" and ">" category properties? 2009-11-16