[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Obtain X / HPOS with move_it_to at eol when buffer-display-table lin

From: Eli Zaretskii
Subject: Re: Obtain X / HPOS with move_it_to at eol when buffer-display-table line-feed
Date: Wed, 30 Aug 2017 19:51:56 +0300

> Date:  Tue, 29 Aug 2017 11:51:07 -0700
> From:  Keith David Bershatsky <address@hidden>
> Cc:  address@hidden
> I am creating pilcrows at the end of each line using the following code:
> (let ((face (face-id 'font-lock-warning-face)))
>   (aset (or buffer-display-table
>             (setq buffer-display-table (make-display-table))) ?\n `[(182 . 
> ,face) ?\n]))
> Using POS, I would like to obtain X/Y/HPOS/VPOS for any particular eol 
> pilcrow.

When you say "X POS for any particular eol pilcrow", do you mean the x
coordinate of the beginning of the pilcrow or of its end?

And what do you get instead when you use move_it_to like you show?

Also, why do you care about the exact coordinate of the pilcrow?  You
could simply reach it and then do there whatever you want, no matter
what is the coordinate.

> If I search for POS at the end of the line using move_it_to, then 
> it.current_x and it.current_hpos are not the values that I need.  In that 
> situation, I have to subtract frame-char-width from it.current_x, and I have 
> to subtract 1 from it.current_hpos.  it.current_x and it.current_hpos are 
> essentially off to a tune of one character to the right of the pilcrow.

Subtracting frame-char-width will only work with monospaced fonts, so
in general it is not a good idea.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]