[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/trunk r106164: Fix bug #9560, sporadic wron
From: |
Alan Mackenzie |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/trunk r106164: Fix bug #9560, sporadic wrong indentation; improve instrumentation of |
Date: |
Sat, 22 Oct 2011 10:17:25 +0000 |
User-agent: |
Bazaar (2.3.1) |
------------------------------------------------------------
revno: 106164
committer: Alan Mackenzie <address@hidden>
branch nick: trunk
timestamp: Sat 2011-10-22 10:17:25 +0000
message:
Fix bug #9560, sporadic wrong indentation; improve instrumentation of
c-parse-state.
cc-engine.el (c-append-lower-brace-pair-to-state-cache): correct faulty
logical expression.
(c-parse-state-state, c-record-parse-state-state):
(c-replay-parse-state-state): New defvar/defuns.
(c-debug-parse-state): Use new functions.
modified:
lisp/ChangeLog
lisp/progmodes/cc-engine.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog 2011-10-22 09:43:09 +0000
+++ b/lisp/ChangeLog 2011-10-22 10:17:25 +0000
@@ -1,3 +1,14 @@
+2011-10-22 Alan Mackenzie <address@hidden>
+
+ Fix bug #9560, sporadic wrong indentation; improve instrumentation
+ of c-parse-state.
+
+ * cc-engine.el (c-append-lower-brace-pair-to-state-cache): correct
+ faulty logical expression.
+ (c-parse-state-state, c-record-parse-state-state):
+ (c-replay-parse-state-state): New defvar/defuns.
+ (c-debug-parse-state): Use new functions.
+
2011-10-22 Martin Rudalics <address@hidden>
* mouse.el (mouse-drag-line): Fix minibuffer resizing broken by
=== modified file 'lisp/progmodes/cc-engine.el'
--- a/lisp/progmodes/cc-engine.el 2011-08-20 22:02:25 +0000
+++ b/lisp/progmodes/cc-engine.el 2011-10-22 10:17:25 +0000
@@ -2456,7 +2456,7 @@
(<= from (cdr c-state-brace-pair-desert)))
;; Only search what we absolutely need to:
(if (and c-state-brace-pair-desert
- (> from (cdr c-state-brace-pair-desert)))
+ (eq cache-pos (car c-state-brace-pair-desert)))
(narrow-to-region (cdr c-state-brace-pair-desert) (point-max)))
;; In the next pair of nested loops, the inner one moves back past a
@@ -3127,6 +3127,33 @@
(unless (fboundp 'c-real-parse-state)
(fset 'c-real-parse-state (symbol-function 'c-parse-state)))
(cc-bytecomp-defun c-real-parse-state)
+
+(defvar c-parse-state-state nil)
+(defun c-record-parse-state-state ()
+ (setq c-parse-state-state
+ (mapcar
+ (lambda (arg)
+ (cons arg (symbol-value arg)))
+ '(c-state-cache
+ c-state-cache-good-pos
+ c-state-nonlit-pos-cache
+ c-state-nonlit-pos-cache-limit
+ c-state-brace-pair-desert
+ c-state-point-min
+ c-state-point-min-lit-type
+ c-state-point-min-lit-start
+ c-state-min-scan-pos
+ c-state-old-cpp-beg
+ c-state-old-cpp-end))))
+(defun c-replay-parse-state-state ()
+ (message
+ (concat "(setq "
+ (mapconcat
+ (lambda (arg)
+ (format "%s %s%s" (car arg) (if (atom (cdr arg)) "" "'") (cdr arg)))
+ c-parse-state-state " ")
+ ")")))
+
(defun c-debug-parse-state ()
(let ((here (point)) (res1 (c-real-parse-state)) res2)
(let ((c-state-cache nil)
@@ -3145,15 +3172,21 @@
;; The cache can actually go further back due to the ad-hoc way
;; the first paren is found, so try to whack off a bit of its
;; start before complaining.
- (save-excursion
- (goto-char (or (c-least-enclosing-brace res2) (point)))
- (c-beginning-of-defun-1)
- (while (not (or (bobp) (eq (char-after) ?{)))
- (c-beginning-of-defun-1))
- (unless (equal (c-whack-state-before (point) res1) res2)
- (message (concat "c-parse-state inconsistency at %s: "
- "using cache: %s, from scratch: %s")
- here res1 res2))))
+ ;; (save-excursion
+ ;; (goto-char (or (c-least-enclosing-brace res2) (point)))
+ ;; (c-beginning-of-defun-1)
+ ;; (while (not (or (bobp) (eq (char-after) ?{)))
+ ;; (c-beginning-of-defun-1))
+ ;; (unless (equal (c-whack-state-before (point) res1) res2)
+ ;; (message (concat "c-parse-state inconsistency at %s: "
+ ;; "using cache: %s, from scratch: %s")
+ ;; here res1 res2)))
+ (message (concat "c-parse-state inconsistency at %s: "
+ "using cache: %s, from scratch: %s")
+ here res1 res2)
+ (message "Old state:")
+ (c-replay-parse-state-state))
+ (c-record-parse-state-state)
res1))
(defun c-toggle-parse-state-debug (&optional arg)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/trunk r106164: Fix bug #9560, sporadic wrong indentation; improve instrumentation of,
Alan Mackenzie <=