[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master 4d74873 2/2: Fix miscellaneous glitches in cc-mode.
From: |
Alan Mackenzie |
Subject: |
[Emacs-diffs] master 4d74873 2/2: Fix miscellaneous glitches in cc-mode.el. Fixes debbugs#20245. |
Date: |
Mon, 06 Apr 2015 22:24:46 +0000 |
branch: master
commit 4d748735d5c49f73e1d49123f7188c9a2fd7d252
Author: Alan Mackenzie <address@hidden>
Commit: Alan Mackenzie <address@hidden>
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).
---
lisp/ChangeLog | 14 ++++++++++++++
lisp/progmodes/cc-mode.el | 20 ++++++++++++--------
2 files changed, 26 insertions(+), 8 deletions(-)
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 38bb8af..1d25e8f 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,17 @@
+2015-04-06 Alan Mackenzie <address@hidden>
+
+ 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 <address@hidden>
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 d88fe70..1f58ba1 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?