unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Set-window-vscroll sometimes doesn't work
@ 2020-10-18  0:35 Yuan Fu
  2020-10-18 14:34 ` Eli Zaretskii
  0 siblings, 1 reply; 36+ messages in thread
From: Yuan Fu @ 2020-10-18  0:35 UTC (permalink / raw)
  To: help-gnu-emacs

Normally if you scroll back onto an image, the image appears completely. I want to instead only show part of the image, like what pixel scrolling would do. If everything works as expected I should only see the bottom of the image, instead I see the whole image.

It seems to be because (set-window-vscroll nil (- img-height (frame-char-height)) t) didn’t take effect, if you call that again with M-: or wrap it in (run-with-timer), then it works as expected.

Is this caused by some redisplay optimization or something?

Code:

(progn
  (switch-to-buffer (get-buffer-create "test"))
  (erase-buffer)
  (insert "\n\n")
  (insert-image (create-image "abby road.jpeg" nil nil :scale 0.1)
                "x")
  (insert "\n")
  (let ((after-img (point)))
    (set-window-start nil (point))
    (scroll-down 1)
    (let* ((img (plist-get (text-properties-at (window-start)) 'display))
           (img-height (cdr (image-size img t))))
      (set-window-vscroll nil (- img-height (frame-char-height)) t))))

Yuan

Image used in the code:






^ permalink raw reply	[flat|nested] 36+ messages in thread

end of thread, other threads:[~2020-10-27 18:32 UTC | newest]

Thread overview: 36+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-10-18  0:35 Set-window-vscroll sometimes doesn't work Yuan Fu
2020-10-18 14:34 ` Eli Zaretskii
2020-10-18 17:24   ` Yuan Fu
2020-10-18 17:31     ` Eli Zaretskii
2020-10-18 17:51       ` Yuan Fu
2020-10-18 17:55         ` Eli Zaretskii
2020-10-18 18:02           ` Yuan Fu
2020-10-18 19:12           ` Yuan Fu
2020-10-18 19:19             ` Eli Zaretskii
2020-10-18 20:06               ` Yuan Fu
2020-10-19  2:23                 ` Eli Zaretskii
     [not found]                   ` <B1D235FE-49B8-4F0A-9C02-78B7E3244C47@gmail.com>
2020-10-19  6:00                     ` Yuan Fu
2020-10-19 16:24                     ` Eli Zaretskii
2020-10-19 16:56                       ` Yuan Fu
2020-10-19 17:23                         ` Eli Zaretskii
2020-10-19 20:39                           ` Yuan Fu
2020-10-20 16:04                             ` Eli Zaretskii
2020-10-20 18:00                               ` Yuan Fu
2020-10-20 18:19                               ` Yuan Fu
2020-10-21 16:25                                 ` Eli Zaretskii
2020-10-21 19:05                                   ` Yuan Fu
2020-10-22  4:16                                     ` Yuan Fu
2020-10-22 16:08                                       ` Eli Zaretskii
2020-10-22 16:50                                         ` Yuan Fu
2020-10-22 17:09                                           ` Eli Zaretskii
2020-10-22 19:33                                             ` Yuan Fu
2020-10-23  6:05                                               ` Eli Zaretskii
2020-10-23 16:48                                                 ` Yuan Fu
2020-10-23 18:11                                                   ` Eli Zaretskii
2020-10-23 20:30                                                     ` Yuan Fu
2020-10-24  7:17                                                       ` Eli Zaretskii
2020-10-26  8:38                                                         ` Jens C. Jensen
2020-10-26 15:18                                                           ` Eli Zaretskii
2020-10-27 18:10                                                         ` Yuan Fu
2020-10-27 18:32                                                           ` Eli Zaretskii
2020-10-22 16:05                                     ` Eli Zaretskii

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