Subject: Re: bug#18504: 24.3.93; posn-at-point intermittently returns wrong value for a valid buffer position

From: Eli Zaretskii <[email-masked]>
Date: Fri, 19 Sep 2014 16:35:15 +0300

> Date: Fri, 19 Sep 2014 17:29:31 +0400
> From: Dmitry Gutov <[email-masked]>
> CC: [email-masked]
> 
> On 09/19/2014 05:12 PM, Eli Zaretskii wrote:
> 
> >> Wouldn't setting a conditional breakpoint help?
> >
> > Conditional breakpoint where?
> 
> In the "call a function" routine, maybe? If the function is 
> "posn-at-point", and if its returned X coord is zero, halt!

And then do what?  The damage was already done, and the debugger
cannot tell you how the code got to that wrong result post-factum.

Btw, why is it important what happens when the user types C-g, i.e. if
she abandons the completion?  Or does the problem happen without C-g
as well?

> > With these issues, the only way to find the bug is to step through the
> > offending code _before_ it produces the wrong values.  So we need a
> > condition that happens at the beginning of that code, not where it
> > produces the final wrong results.
> 
> If `posn-at-point' is itself stateless (and doesn't modify any relevant 
> caches), why not call it again at that point?

Because it will most probably produce the correct result.

But you can try that yourself: insert a second call under the
conditions that you know are evidence of the problem.  If that is
repeatable, i.e. if that second call always produces the wrong result,
then I have what I need.