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

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

Re: `window-absolute-pixel-position' with vscroll


From: Rahguzar
Subject: Re: `window-absolute-pixel-position' with vscroll
Date: Wed, 21 Jun 2023 22:42:22 +0200
User-agent: mu4e 1.10.3; emacs 29.0.91

Hi Eli,

Due to some reason I didn't receive your message and only saw it
because I checked archives just now.

Consider the following code,

(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.

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.

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.

Thanks,
Rahguzar



reply via email to

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