From: Eli Zaretskii <eliz@gnu.org>
To: help-gnu-emacs@gnu.org
Subject: Re: `window-absolute-pixel-position' with vscroll
Date: Thu, 22 Jun 2023 19:59:53 +0300 [thread overview]
Message-ID: <83jzvv301i.fsf@gnu.org> (raw)
In-Reply-To: <87zg4secdn.fsf@zohomail.eu> (message from Rahguzar on Wed, 21 Jun 2023 22:42:22 +0200)
> From: Rahguzar <rahguzar@zohomail.eu>
> Date: Wed, 21 Jun 2023 22:42:22 +0200
> CC: help-gnu-emacs@gnu.org
>
> Due to some reason I didn't receive your message and only saw it
> because I checked archives just now.
I reply to the list only, so you should either be subscribed or check
the archives.
> (progn
> (goto-char (point-max))
> (insert "\n")
> (insert-image (create-image "path/to/image"))
> (insert "\n")
> (insert-image (create-image "path/to/image")))
>
> I pasted it in scratch buffer starting from `emacs -Q` and then
> evaluated it.
>
> Now go to the first image and use `i +` till the image height is larger
> than the window height (more about needing this below).
>
> Then do `M-: (set-window-vscroll nil 100 t t)`
>
> Where 100 is just a place holder but the number should be smaller than
> the window height and large enough that the second image comes into
> view.
>
> Next do `M-: (window-absolute-pixel-position (point))`
> I got `(1896 . 0)` which I don't know how to interpret since that is
> supposed to represent the top-left corner of the image but that corner
> is not visible in window and I don't know how that 1896 came to be there.
window-absolute-pixel-position returns the coordinates relative to the
top-left corner of the _display_ (i.e. the terminal) on which the
window is displayed. Without knowing where the window was on your
display, I cannot help you interpret the value. Perhaps it would help
if you move the window's frame to the top-left corner of the screen,
and repeat your experiment.
> Next do `M-: (window-absolute-pixel-position (+ 2 (point)))`
>
> I got `(8 . 862)`, which matches what I expect from evaluating
> `(pos-visible-in-window-p (point) nil t)`. Although I remember this
> result being confusing too but I think it was just me being confused.
pos-visible-in-window-p returns X/Y coordinates relative to the
top-left corner of the _window_. So its origin is different, and
perhaps that difference is what caused your confusion.
> While doing this I noticed that I can't set vscroll until image is
> taller than the window i.e. in this case the top of first the image
> remains glued to the top of the window. This is not the case with text
> i.e. `M-: (progn (goto-char (point-min)) (set-window-vscroll nil 10 t t))`
> in the scratch buffer partially hides the top line for me as expected
> but if the window starts at an image less tall than the window and I do
> `M-: (set-window-vscroll nil 100 t t)` the top of the image remains
> visible even if the image is more than 100 pixels tall.
pixel-scroll-precision-mode does what you want, so it is certainly
possible.
next prev parent reply other threads:[~2023-06-22 16:59 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-21 20:42 `window-absolute-pixel-position' with vscroll Rahguzar
2023-06-22 16:59 ` Eli Zaretskii [this message]
[not found] <87r0q2dxvz.fsf@zohomail.eu>
[not found] ` <83fs6i1a64.fsf@gnu.org>
2023-06-23 15:22 ` Rahguzar
2023-06-23 15:47 ` Eli Zaretskii
-- strict thread matches above, loose matches on Subject: below --
2023-06-20 19:23 Rahguzar
2023-06-21 12:50 ` 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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=83jzvv301i.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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).