Subject: Re: bug#27427: 26.0.50; Native line numbers lead to display error in company-mode popup

From: Eli Zaretskii <[email-masked]>
Date: Fri, 14 Jul 2017 10:04:42 +0300

> Cc: [email-masked], [email-masked]
> From: Dmitry Gutov <[email-masked]>
> Date: Fri, 14 Jul 2017 09:24:58 +0300
> 
> > No, it isn't brittle.  What are you struggling to understand?  Maybe I
> > can help.
> 
> To get the value of the current column, Emacs needs to trigger 
> redisplay, right? To know how many columns the numbers take up. Then it 
> has to redisplay again before the user sees the result.
> 
> So I'm surprised Emacs knows it needs to perform two redisplays just 
> because I bound display-line-numbers to nil temporarily.

That's because posn-at-point "simulates" redisplay: it performs all
the layout calculations exactly like redisplay would, but without
actually displaying anything.  Otherwise, how would posn-at-point be
able to return you the information you request, even when there are no
line numbers?

(If you think posn-at-point takes that information from what is
displayed on the glass, or from some of its internal representation,
then that's not what it does, because the internal representation of
what's on the glass is many times outdated when a Lisp program runs,
so it cannot be trusted.)