[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#7595: Infinite loop in cc-mode, or the coming of autumn
From: |
Alan Mackenzie |
Subject: |
bug#7595: Infinite loop in cc-mode, or the coming of autumn |
Date: |
Mon, 7 Mar 2011 20:55:46 +0000 |
User-agent: |
Mutt/1.5.9i |
Hi, all!
On Mon, Mar 07, 2011 at 12:00:23AM -0500, Chong Yidong wrote:
> > we will shall see if we just have to bite the bullet and continue
> > pretesting. But if it does not trigger for realistic usage, I prefer
> > to leave matters as they are for 23.3---i.e. swapping one rare infloop
> > in 23.2 (Bug#7595) for a different one in 23.3 (the above).
> On reflection, it's probably better to revert the original fix for 7595,
> and go back to the (problematic) prior behavior. As for the patch you
> proposed, it doesn't look obvious and safe enough to include at this
> late stage.
Daniel, you correctly identified the wrong bit of code in your proposed
patch. What has happened is that the code in c-beginning-of-statement
which handles macros has been replaced by the analogous code from
c-END-of-statement. This is totally crazy and totally wrong. I've no
record of doing this myself, there's nothing about it I can find in
.../lisp/ChangeLog, so, as yet, I've no idea how it happened.
I think the best solution is to reverse this mysterious change, making
c-b-o-s again identical to the version in Emacs 23.2 (modulo a corrected
typo in a comment). Here is a patch which does exactly that:
=== modified file 'lisp/progmodes/cc-cmds.el'
*** lisp/progmodes/cc-cmds.el 2011-02-20 18:36:29 +0000
--- lisp/progmodes/cc-cmds.el 2011-03-07 20:39:34 +0000
***************
*** 2564,2582 ****
;; Are we about to move backwards into or out of a
;; preprocessor command? If so, locate its beginning.
(when (eq (cdr res) 'macro-boundary)
! (setq macro-fence
! (save-excursion
! (if macro-fence
! (progn
! (end-of-line)
! (and (not (eobp))
! (progn (c-skip-ws-forward)
! (c-beginning-of-macro))
! (progn (c-end-of-macro)
! (point))))
! (and (not (eobp))
! (c-beginning-of-macro)
! (progn (c-end-of-macro) (point)))))))
;; Are we about to move backwards into a literal?
(when (memq (cdr res) '(macro-boundary literal))
(setq range (c-ascertain-preceding-literal)))
--- 2564,2575 ----
;; Are we about to move backwards into or out of a
;; preprocessor command? If so, locate its beginning.
(when (eq (cdr res) 'macro-boundary)
! (save-excursion
! (beginning-of-line)
! (setq macro-fence
! (and (not (bobp))
! (progn (c-skip-ws-backward)
(c-beginning-of-macro))
! (point)))))
;; Are we about to move backwards into a literal?
(when (memq (cdr res) '(macro-boundary literal))
(setq range (c-ascertain-preceding-literal)))
What does everybody think?
--
Alan Mackenzie (Nuremberg, Germany).
- bug#7595: Infinite loop in cc-mode, or the coming of autumn, Daniel Colascione, 2011/03/06
- bug#7595: Infinite loop in cc-mode, or the coming of autumn, Daniel Colascione, 2011/03/06
- bug#7595: Infinite loop in cc-mode, or the coming of autumn, Chong Yidong, 2011/03/07
- bug#7595: Infinite loop in cc-mode, or the coming of autumn, Daniel Colascione, 2011/03/07
- bug#7595: Infinite loop in cc-mode, or the coming of autumn, Alan Mackenzie, 2011/03/07
- bug#7595: Infinite loop in cc-mode, or the coming of autumn, Chong Yidong, 2011/03/07
- bug#7595: Infinite loop in cc-mode, or the coming of autumn, Alan Mackenzie, 2011/03/07
- bug#7595: Infinite loop in cc-mode, or the coming of autumn, Daniel Colascione, 2011/03/08
- bug#7595: Infinite loop in cc-mode, or the coming of autumn,
Alan Mackenzie <=
bug#7595: Infinite loop in cc-mode, or the coming of autumn, Chong Yidong, 2011/03/07