emacs-devel
[Top][All Lists]
Advanced

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

Re: Displaying scrollable images in a grid-layout


From: Eli Zaretskii
Subject: Re: Displaying scrollable images in a grid-layout
Date: Tue, 14 Apr 2015 17:56:35 +0300

> Date: Mon, 13 Apr 2015 23:27:52 +0300
> From: Eli Zaretskii <address@hidden>
> Cc: address@hidden
> 
> Try this:
> 
>      (defun show-data-dir-images (&optional ncolumns)
>        (interactive (list 4))
>        (let* ((files (directory-files
>                       (expand-file-name "images" data-directory)
>                       no-dot-files))
>               (column 0))
>          (with-current-buffer (get-buffer-create "*images*")
>            (erase-buffer)
>            (save-excursion
>              (dolist (f files)
>                (when (and (file-regular-p f)
>                           (file-name-extension f)
>                           (image-type-available-p
>                            (intern (downcase (file-name-extension f)))))
>                  (insert-image (create-image f))
>                  (when (= (cl-incf column) ncolumns)
>                    (insert ?\n)
>                    (setq column 0)))))          
>            (setq-local scroll-conservatively 0)
>            (setq-local scroll-step 0)
>            (setq-local scroll-up-aggressively nil)
>            (display-buffer (current-buffer)))))

After running this function, this works for me:

   (set-window-vscroll nil N t)

as long as (a) point is not on the first screen line shown in the
window, and (b) N is no more than 24, which AFAICS is the pixel size
of the small images created by the above function.

This also works:

   (set-window-vscroll nil N)

as long as N is less than the vertical coordinate of point's line in
canonical line height units.

Is that what you see?  If you see something else, we are not talking
about the same issue.

> (setq-local scroll-step 1)
> (set-window-vscroll nil 10) => Scrolls, but:
> 
> Redisplay performance (or something else) greatly suffers, i.e. opening
> e.g. the M-x prompt after I have executed the above 2 commands takes
> about one second.  (I have tested this with emacs-git -Q .)

I don't see this performance hit.  After typing "M-x", I see the
prompt with no perceptible delay, certainly nowhere near 1 sec.  So
some other factor is at work here.  Maybe your original recipe is
somehow different in this respect from the modified one, which I
tried, e.g. the thumbnail images are probably smaller, though I don't
see why that would make redisplay slower.  (I also tried to use more
than 4 columns, but saw no redisplay slow-down in that case, either.)

The other points I made in my previous message and today still hold:
there are limits to what Emacs will currently let you do with
window-vscroll, mainly due to 2 factors:

  . the basic desire embedded in redisplay to avoid showing partial
    lines, unless they are unavoidable

  . the automatic scrolling when point goes off the window

Let me know if you need further help or have additional
questions/issues about this.



reply via email to

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