Subject: Re: bug#18493: 24.3.93; posn-col-row should take text-scale-mode into account

From: Dmitry Gutov <[email-masked]>
Date: Fri, 19 Sep 2014 00:55:06 +0400

On 09/18/2014 06:58 PM, Eli Zaretskii wrote:

> That's the intended behavior: posn-col-row is documented to return the
> coordinates of its argument in canonical character units.  And that is
> what it does here.  There's no bug here.

Fair enough. Maybe define an alternative function, which does take  text 
zoom into account?

Or otherwise, I'd be fine with precise algorithm how to convert one into 
the other, if it's relatively simple and unlikely to change.

> Calculate what, exactly?  The results of this function _are_ reliable.
> You just cannot in general use them as the logical (a.k.a. "physical")
> column and row number, i.e. the ordinal number of a character from the
> line beginning and its line number relative to window-start.  You can
> only use them as the real column and row if your text uses the default
> face.  But once variable-size fonts, stretch glyphs, images, and other
> display atrocities come into play, there's no meaningful way of
> talking about "columns" and "rows" that can be used as indices into
> the text.

Text zoom is different from all the other features you enumerate here, 
though. In programming language buffers, I usually have no images or 
proportional fonts, but zooming the text is something that happens once 
in a while.

> So the answer to your question depends on what you intend to do with
> the value.

All the recent display engine issues I've been creating are for the same 
package and feature: company-mode and its overlay-based popup, which I'd 
like to polish up a bit before trying other methods of popup rendering, 
because they won't be available to users of Emacs 24.4 and older 
versions, and it'll likely be quite some time until the next release.

> IOW, please explain what is it that "you'd like".

The "current column" obtained from the return value of this function, is 
used to position each line of the popup in the display string of the 
overlay that spans the next few lines. So naturally, the return value 
should not depend on the zoom level. And I'm using `posn-col-row' for 
this because it became the consensus in the several discussions I've had 
with you recently on this subject.