GNU bug report logs -
#5747
24.0.50; Unstable C-mode indentation
Previous Next
Reported by: Ari Roponen <ari.roponen <at> gmail.com>
Date: Sun, 21 Mar 2010 13:31:02 UTC
Severity: normal
Merged with 5741
Done: Chong Yidong <cyd <at> stupidchicken.com>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 5747 in the body.
You can then email your comments to 5747 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org
:
bug#5747
; Package
emacs
.
(Sun, 21 Mar 2010 13:31:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Ari Roponen <ari.roponen <at> gmail.com>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Sun, 21 Mar 2010 13:31:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
Hi, the indentation of C-mode is not stable. Here is the recipe
to reproduce the problem:
1. Eval this form in "emacs -Q":
(progn
(switch-to-buffer "tmp.c")
(erase-buffer)
(c-mode)
(insert "int fun (void)\n{\n int a = foo ();\n}")
(c-indent-line-or-region)
(backward-sexp)
(c-indent-line-or-region))
2. Now every time you press TAB-key the indentation of the
bracket alternates between two positions.
By bisecting the source (using the GIT-repo) I found that the
problem comes from:
acm <at> muc.de-20091203160210-5u4g9gppsv3zts3e
committer: Alan Mackenzie <acm <at> muc.de>
timestamp: Thu 2009-12-03 16:02:10 +0000
message:
Enhance `c-parse-state' to run efficiently in "brace desserts".
After reverting that the problem goes away.
In GNU Emacs 24.0.50.1 (x86_64-unknown-linux-gnu, GTK+ Version 2.19.7)
of 2010-03-18 on arirop
Windowing system distributor `Fedora Project', version 11.0.10799901
--
Ari Roponen
Information forwarded
to
owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org
:
bug#5747
; Package
emacs
.
(Mon, 22 Mar 2010 11:29:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 5747 <at> debbugs.gnu.org (full text, mbox):
Hi, Ari and everybody else!
On Sun, Mar 21, 2010 at 02:48:34PM +0200, Ari Roponen wrote:
> Hi, the indentation of C-mode is not stable. Here is the recipe
> to reproduce the problem:
> 1. Eval this form in "emacs -Q":
> (progn
> (switch-to-buffer "tmp.c")
> (erase-buffer)
> (c-mode)
> (insert "int fun (void)\n{\n int a = foo ();\n}")
> (c-indent-line-or-region)
> (backward-sexp)
> (c-indent-line-or-region))
> 2. Now every time you press TAB-key the indentation of the
> bracket alternates between two positions.
> By bisecting the source (using the GIT-repo) I found that the
> problem comes from:
> acm <at> muc.de-20091203160210-5u4g9gppsv3zts3e
> committer: Alan Mackenzie <acm <at> muc.de>
> timestamp: Thu 2009-12-03 16:02:10 +0000
> message:
> Enhance `c-parse-state' to run efficiently in "brace desserts".
> After reverting that the problem goes away.
That is one absolutely tremendous bug report! Thank you very much indeed
for it! With all the information you've given me, I was able to track
down an off-by-one error very quickly.
Would you please (all) try the following patch, which I'm hopeful will
fix all the recent instabilities in CC Modes indentation.
*** cc-engine.el~ 2010-03-22 11:15:40.248931952 +0000
--- cc-engine.el 2010-03-22 11:24:04.981200984 +0000
***************
*** 2624,2630 ****
(< (point-max) c-state-old-cpp-end)))
(point-max)
(min (point-max) c-state-old-cpp-beg)))
! (while (and c-state-cache (> (c-state-cache-top-lparen) upper-lim))
(setq c-state-cache (cdr c-state-cache)))
;; If `upper-lim' is inside the last recorded brace pair, remove its
;; RBrace and indicate we'll need to search backwards for a previous
--- 2624,2630 ----
(< (point-max) c-state-old-cpp-end)))
(point-max)
(min (point-max) c-state-old-cpp-beg)))
! (while (and c-state-cache (>= (c-state-cache-top-lparen) upper-lim))
(setq c-state-cache (cdr c-state-cache)))
;; If `upper-lim' is inside the last recorded brace pair, remove its
;; RBrace and indicate we'll need to search backwards for a previous
> --
> Ari Roponen
--
Alan Mackenzie (Nuremberg, Germany).
Information forwarded
to
owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org
:
bug#5747
; Package
emacs
.
(Mon, 22 Mar 2010 12:04:01 GMT)
Full text and
rfc822 format available.
Message #11 received at 5747 <at> debbugs.gnu.org (full text, mbox):
Hi,
> Would you please (all) try the following patch, which I'm hopeful will
> fix all the recent instabilities in CC Modes indentation.
>
this patch fixes the problem I reported. Thank you.
>
> *** cc-engine.el~ 2010-03-22 11:15:40.248931952 +0000
> --- cc-engine.el 2010-03-22 11:24:04.981200984 +0000
> ***************
> *** 2624,2630 ****
> (< (point-max) c-state-old-cpp-end)))
> (point-max)
> (min (point-max) c-state-old-cpp-beg)))
> ! (while (and c-state-cache (> (c-state-cache-top-lparen) upper-lim))
> (setq c-state-cache (cdr c-state-cache)))
> ;; If `upper-lim' is inside the last recorded brace pair, remove its
> ;; RBrace and indicate we'll need to search backwards for a previous
> --- 2624,2630 ----
> (< (point-max) c-state-old-cpp-end)))
> (point-max)
> (min (point-max) c-state-old-cpp-beg)))
> ! (while (and c-state-cache (>= (c-state-cache-top-lparen) upper-lim))
> (setq c-state-cache (cdr c-state-cache)))
> ;; If `upper-lim' is inside the last recorded brace pair, remove its
> ;; RBrace and indicate we'll need to search backwards for a previous
>
--
Ari Roponen
Merged 5741 5747.
Request was from
Glenn Morris <rgm <at> gnu.org>
to
control <at> debbugs.gnu.org
.
(Mon, 22 Mar 2010 21:32:01 GMT)
Full text and
rfc822 format available.
bug closed, send any further explanations to Ari Roponen <ari.roponen <at> gmail.com>
Request was from
Chong Yidong <cyd <at> stupidchicken.com>
to
control <at> debbugs.gnu.org
.
(Sun, 28 Mar 2010 19:14:01 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Mon, 26 Apr 2010 11:24:03 GMT)
Full text and
rfc822 format available.
This bug report was last modified 15 years and 116 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.