1 new commit in cc-mode:
https://bitbucket.org/xemacs/cc-mode/changeset/2e447eef29f0/
changeset: 2e447eef29f0
user: acm
date: 2012-02-12 11:41:28
summary: Fix infinite loop with long macros.
cc-engine.el (c-state-safe-place): Handle macros properly.
affected #: 1 file
diff -r f917eef6504b24cff35af446be970deaa864e217 -r
2e447eef29f0336cc6544f428729a4cdaa33a2b9 cc-engine.el
--- a/cc-engine.el
+++ b/cc-engine.el
@@ -2130,7 +2130,7 @@
(widen)
(save-excursion
(let ((c c-state-nonlit-pos-cache)
- pos npos lit macro-beg)
+ pos npos lit macro-beg macro-end)
;; Trim the cache to take account of buffer changes.
(while (and c (> (car c) c-state-nonlit-pos-cache-limit))
(setq c (cdr c)))
@@ -2144,28 +2144,29 @@
;; Add an element to `c-state-nonlit-pos-cache' each iteration.
(and
(<= (setq npos (+ pos c-state-nonlit-pos-interval)) here)
+
+ ;; Test for being in a literal.
(progn
(setq lit (car (cddr (c-state-pp-to-literal pos npos))))
- (cond
- ((null lit)
- (setq pos npos)
- t)
- ((<= (cdr lit) here)
- (setq pos (cdr lit))
- t)
- (t
- (setq pos (car lit))
- nil))))
-
- (goto-char pos)
- (when (and (c-beginning-of-macro) (/= (point) pos))
- (setq macro-beg (point))
- (c-syntactic-end-of-macro)
- (or (eobp) (forward-char))
- (setq pos (if (<= (point) here)
- (point)
- macro-beg)))
- (setq c-state-nonlit-pos-cache (cons pos c-state-nonlit-pos-cache)))
+ (or (null lit)
+ (prog1 (<= (cdr lit) here)
+ (setq npos (cdr lit)))))
+
+ ;; Test for being in a macro.
+ (progn
+ (goto-char npos)
+ (setq macro-beg
+ (and (c-beginning-of-macro) (/= (point) npos) (point)))
+ (when macro-beg
+ (c-syntactic-end-of-macro)
+ (or (eobp) (forward-char))
+ (setq macro-end (point)))
+ (or (null macro-beg)
+ (prog1 (<= macro-end here)
+ (setq npos macro-end)))))
+
+ (setq pos npos)
+ (setq c-state-nonlit-pos-cache (cons pos c-state-nonlit-pos-cache)))
(if (> pos c-state-nonlit-pos-cache-limit)
(setq c-state-nonlit-pos-cache-limit pos))
Repository URL:
https://bitbucket.org/xemacs/cc-mode/
--
This is a commit notification from
bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-patches