Fix miscellaneous glitches in cc-mode.el. Fixes debbugs#20245.

* progmodes/cc-mode.el (c-common-init): bind
\(before\|after\)-change-functions to nil around invocations of
c-get-state-before-change-functions and
c-before-font-lock-functions to prevent recursive invocations.
(c-neutralize-syntax-in-and-mark-CPP): On c-beginning-of-macro,
check that point has actually moved back.
(c-fl-decl-start): Check whether c-beginning-of-decl-1 has
actually found a boundary (as contrasted with hitting a search
limit).
This commit is contained in:
Alan Mackenzie 2015-04-06 22:20:16 +00:00
parent b31d359d18
commit 4d748735d5
2 changed files with 26 additions and 8 deletions

View file

@ -1,3 +1,17 @@
2015-04-06 Alan Mackenzie <acm@muc.de>
Fix miscellaneous glitches in cc-mode.el. Fixes debbugs#20245.
* progmodes/cc-mode.el (c-common-init): bind
\(before\|after\)-change-functions to nil around invocations of
c-get-state-before-change-functions and
c-before-font-lock-functions to prevent recursive invocations.
(c-neutralize-syntax-in-and-mark-CPP): On c-beginning-of-macro,
check that point has actually moved back.
(c-fl-decl-start): Check whether c-beginning-of-decl-1 has
actually found a boundary (as contrasted with hitting a search
limit).
2015-02-01 Alan Mackenzie <acm@muc.de>
CC Mode: Stop Font Lock forcing fontification from BOL. Fixes

View file

@ -659,13 +659,14 @@ compatible with old code; callers should always specify it."
(setq c-new-BEG (point-min))
(setq c-new-END (point-max))
(save-excursion
(mapc (lambda (fn)
(funcall fn (point-min) (point-max)))
c-get-state-before-change-functions)
(mapc (lambda (fn)
(funcall fn (point-min) (point-max)
(- (point-max) (point-min))))
c-before-font-lock-functions)))
(let (before-change-functions after-change-functions)
(mapc (lambda (fn)
(funcall fn (point-min) (point-max)))
c-get-state-before-change-functions)
(mapc (lambda (fn)
(funcall fn (point-min) (point-max)
(- (point-max) (point-min))))
c-before-font-lock-functions))))
(set (make-local-variable 'outline-regexp) "[^#\n\^M]")
(set (make-local-variable 'outline-level) 'c-outline-level)
@ -972,7 +973,9 @@ Note that the style variables are always made local to the buffer."
(unless
(or (save-excursion
(goto-char (match-beginning 0))
(c-beginning-of-macro))
(let ((here (point)))
(and (save-match-data (c-beginning-of-macro))
(< (point) here))))
(progn
(setq pps-state
(parse-partial-sexp pps-position (point) nil nil pps-state)
@ -1170,6 +1173,7 @@ Note that the style variables are always made local to the buffer."
;; Go to a less nested declaration each time round this loop.
(and
(eq (car (c-beginning-of-decl-1 bod-lim)) 'same)
(> (point) bod-lim)
(progn (setq bo-decl (point))
;; Are we looking at a keyword such as "template" or
;; "typedef" which can decorate a type, or the type itself?