GNU bug report logs -
#7595
Infinite loop in cc-mode, or the coming of autumn
Previous Next
Full log
Message #46 received at submit <at> debbugs.gnu.org (full text, mbox):
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).
This bug report was last modified 14 years and 140 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.