summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Mackenzie <acm@muc.de>2015-04-06 22:20:16 +0000
committerAlan Mackenzie <acm@muc.de>2015-04-06 22:23:30 +0000
commit4d748735d5c49f73e1d49123f7188c9a2fd7d252 (patch)
treee702fdd43d721a6481f77596bf76f833cacfc46e
parentb31d359d182eb252a11f0468a7dc1ee1eafb28e9 (diff)
downloademacs-4d748735d5c49f73e1d49123f7188c9a2fd7d252.tar.gz
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).
-rw-r--r--lisp/ChangeLog14
-rw-r--r--lisp/progmodes/cc-mode.el20
2 files changed, 26 insertions, 8 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 38bb8afa15c..1d25e8f870e 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -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
diff --git a/lisp/progmodes/cc-mode.el b/lisp/progmodes/cc-mode.el
index d88fe702c59..1f58ba1ee9b 100644
--- a/lisp/progmodes/cc-mode.el
+++ b/lisp/progmodes/cc-mode.el
@@ -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?