help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Correct way to implement `pixel-point-and-height-at-unseen-line'?


From: Eli Zaretskii
Subject: Re: Correct way to implement `pixel-point-and-height-at-unseen-line'?
Date: Tue, 14 Dec 2021 15:30:44 +0200

> From: Po Lu <luangruo@yahoo.com>
> Cc: help-gnu-emacs@gnu.org
> Date: Tue, 14 Dec 2021 08:41:06 +0800
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> > And you didn't describe why do you need
> > pixel-point-and-height-at-unseen-line's data in the first place, so
> > maybe there's a different solution to whatever you are trying to do
> > that doesn't involve such a function.
> 
> It's used to find a suitable new start position that's N pixels above
> window start, so vscroll can then be set to compensate for the
> difference.

Did you try something like this:

  (save-excursion
    (goto-char (window-start))
    (vertical-motion (- (ceiling N (frame-char-height))))
    (point))

where N is your number of pixels?



reply via email to

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