all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: help-gnu-emacs@gnu.org
Subject: Re: Correct way to implement `pixel-point-and-height-at-unseen-line'?
Date: Tue, 14 Dec 2021 15:30:44 +0200	[thread overview]
Message-ID: <83bl1jl3ej.fsf@gnu.org> (raw)
In-Reply-To: <87czm0uifx.fsf@yahoo.com> (message from Po Lu on Tue, 14 Dec 2021 08:41:06 +0800)

> 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	other threads:[~2021-12-14 13:30 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <87pmq1wag9.fsf.ref@yahoo.com>
2021-12-13  1:38 ` Correct way to implement `pixel-point-and-height-at-unseen-line'? Po Lu
2021-12-13  2:20   ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-12-13  2:49     ` Po Lu
2021-12-13  3:04       ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-12-13  3:18         ` Po Lu
2021-12-13 23:41           ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-12-14  0:41             ` Po Lu
2021-12-13 14:32   ` Eli Zaretskii
2021-12-14  0:41     ` Po Lu
2021-12-14 13:30       ` Eli Zaretskii [this message]
2021-12-14 13:48         ` Po Lu
2021-12-14 14:26           ` Eli Zaretskii
2021-12-15  0:40             ` Po Lu
2021-12-15 13:11               ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83bl1jl3ej.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.