Discussion:
bug#5570: automatic cache validation
(too old to reply)
Paul Pogonyshev
2010-04-02 17:01:36 UTC
Permalink
Does
M-x (c-state-cache-init)
fix it?
No, it does not.
I just got the problem again, while editing gtkutil.c in Emacs. There
M-: (c-state-cache-init) did indeed fix the problem.
So it sometimes help. I guess this only adds to the confusion...
I guess that's because there are several similar bugs. At the rate
fixing goes (or rather doesn't go) I think I'll compile and use an old
Emacs without indentation bugs again.

Paul


P.S. By the way: maybe this change did fix the original bug, but it
didn't improve overall indentation problems in CC modes noticeably.

2010-03-24 Alan Mackenzie <***@muc.de>

* progmodes/cc-engine.el (c-remove-stale-state-cache):
Fix off-by-one error. Fixes bug #5747.
Chong Yidong
2010-04-03 23:55:53 UTC
Permalink
Does
M-x (c-state-cache-init)
fix it?
No, it does not.
I just got the problem again, while editing gtkutil.c in Emacs. There
M-: (c-state-cache-init) did indeed fix the problem.
So it sometimes help. I guess this only adds to the confusion...
You sent this message on March 22. That was the date Alan checked this
into the branch:

2010-03-22 Alan Mackenzie <***@muc.de>

* progmodes/cc-engine.el (c-remove-stale-state-cache):
Fix off-by-one error. Fixes bug #5747.

The patch was merged to the trunk a couple days later. I don't know
whether you were running with it when you made the above observation.

So, are you still observing the problem after the patch?
Jan Djärv
2010-04-04 08:09:25 UTC
Permalink
Post by Chong Yidong
Does
M-x (c-state-cache-init)
fix it?
No, it does not.
I just got the problem again, while editing gtkutil.c in Emacs. There
M-: (c-state-cache-init) did indeed fix the problem.
So it sometimes help. I guess this only adds to the confusion...
You sent this message on March 22. That was the date Alan checked this
Fix off-by-one error. Fixes bug #5747.
The patch was merged to the trunk a couple days later. I don't know
whether you were running with it when you made the above observation
I was running without it.
.
Post by Chong Yidong
So, are you still observing the problem after the patch?
Yes, but it seems to happen less frequently. Also, sometimes just another TAB
at BOL fixes it.

Jan D.
Paul Pogonyshev
2010-04-04 00:14:14 UTC
Permalink
Post by Chong Yidong
Does
M-x (c-state-cache-init)
fix it?
No, it does not.
I just got the problem again, while editing gtkutil.c in Emacs. There
M-: (c-state-cache-init) did indeed fix the problem.
So it sometimes help. I guess this only adds to the confusion...
You sent this message on March 22. That was the date Alan checked this
Fix off-by-one error. Fixes bug #5747.
The patch was merged to the trunk a couple days later. I don't know
whether you were running with it when you made the above observation.
So, are you still observing the problem after the patch?
Not directed to me, but I can answer as well.

Yes, I see the problem, though I'm not sure if it is "the" problem,
since there might be many similar ones.

* At least in some cases M-x (c-state-cache-init) doesn't help, but
C-x RET r (buffer reloading) does;

* Occasionally even buffer reloading doesn't help, so I have to kill
the buffer and open the file again;

* Sometimes I get wrong indentation which miraculously fixes itself
after I hit TAB next time;

* Sometimes when I type in a C string (like "bla-bla-bla"), first
character after the opening quote gets eaten because of a Lisp
error. Will report as separate bug when it happens if I don't
forget.

And yes, I double-verified that I do have the fix in the version I'm
running now.

Paul
Chong Yidong
2010-04-28 18:55:34 UTC
Permalink
Hi Alan,

I found a small recipe for reproducing a (the?) cache bug on the trunk:

1. emacs -Q

2. C-x C-f foo.c RET

3. Type the following (from view-lossage):

i n t SPC m a i n SPC ( ) <return>
{ <return> f o o ; <return> } M-< <return>
<up> # i n c l u d e SPC < s t d i o . h > <return>
<down> <down> <down> <tab>

At this point, the line "foo;" becomes indented to the zeroth column.

Does this help?
Alan Mackenzie
2010-04-29 15:04:42 UTC
Permalink
Hi, Yidong and Paul!
Post by Chong Yidong
Hi Alan,
1. emacs -Q
2. C-x C-f foo.c RET
i n t SPC m a i n SPC ( ) <return>
{ <return> f o o ; <return> } M-< <return>
<up> # i n c l u d e SPC < s t d i o . h > <return>
<down> <down> <down> <tab>
At this point, the line "foo;" becomes indented to the zeroth column.
Does this help?
Does it help? That was an absolute dream of a bug report. :-)

The problem was another off-by-one error. What triggered the bug is
typing <return> at the end of the #include line. The thing marking the
end of the macro (a category text property) got pushed onto the next line
instead of being properly removed. This then fouled up the
"c-state-cache" mechanism.

It looks like the situation reported by Paul (in his mail of 2010-02-23,
Message-Id: <***@gmx.net>) is likely caused by
the same bug.

I've committed a fix to the Bazaar HEAD, which of course is a fix for the
last bug in this area. ;-)

Paul, would you please update your copy of the Emacs HEAD from savannah,
and see if any indentation bugs still manifest themselves. Thanks!
--
Alan Mackenzie (Nuremberg, Germany).
Paul Pogonyshev
2010-05-29 22:27:47 UTC
Permalink
Post by Alan Mackenzie
Paul, would you please update your copy of the Emacs HEAD from savannah,
and see if any indentation bugs still manifest themselves. Thanks!
Yes they do. I still see all kinds of indentation bugs, none seem to
be gone:

* Sometimes everything is topmost-intro; this may or may not be gone
after buffer reload with C-x RET r, suggesting at least two sources
for the bug.

* Indentation sometimes spuriosly changes when hitting TAB (e.g. TAB
-> to 0th column, TAB again -> to 8th column, TAB third time -> to
0th once more; no intervening keystrokes).

* Sometimes character after opening " gets eaten see #5851.

I did 'bzr pull', then 'make maintainer-clean && ./configure && make'
and then 'sudo make install'.

Paul

Continue reading on narkive:
Loading...