unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: David Kastrup <dak@gnu.org>
Cc: emacs-devel@gnu.org, Mathias Dahl <brakjoller@gmail.com>
Subject: Re: thumbs.el and transparency
Date: Sun, 29 Jan 2006 19:13:09 +0100	[thread overview]
Message-ID: <85bqxu52dm.fsf@lola.goethe.zz> (raw)
In-Reply-To: <fc339e4a0601290838o4943407ay@mail.gmail.com> (Miles Bader's message of "Mon, 30 Jan 2006 01:38:45 +0900")

Miles Bader <miles@gnu.org> writes:

> 2006/1/29, Mathias Dahl <brakjoller@gmail.com>:
>> Such a command would need to check how many images the directory
>> contains and warn the user if the number of files exeeds a certain,
>> configurable, limit (say 50 or something like that as default).
>
> How hard would it be to have it do the thumb-ification in the
> background, so that it wouldn't really matter if there were many image
> files (the user would see them being added, and could use those that
> were available)?  This is the way many image browsing programs work,
> and it's a very nice way of dealing with the delay of
> thumb-conversion.

I'd like to mention how preview-latex does this sort of background
rendering in order to have it least offensive: it keeps a queue of
images that still may have to be processed.  Then it uses a
conditional display property (the importance is not the condition,
which needs to evaluate to t, but the side effect from evaluating the
condition) for showing on-screen stuff first with the help of the
following two functions:

(defun preview-add-urgentization (fun ov &rest rest)
  "Cause FUN (function call form) to be called when redisplayed.
FUN must be a form with OV as first argument,
REST as the remainder, returning T."
  (let ((dispro (overlay-get ov 'display)))
    (unless (eq (car dispro) 'when)
      (overlay-put ov 'display `(when (,fun ,ov ,@rest)  . ,dispro)))))

(defun preview-remove-urgentization (ov)
  "Undo urgentization of OV by `preview-add-urgentization'.
Returns the old arguments to `preview-add-urgentization'
if there was any urgentization."
  (let ((dispro (overlay-get ov 'display)))
    (when (eq (car dispro) 'when)
      (prog1
	  (car (cdr dispro))
	(overlay-put ov 'display (cdr (cdr dispro)))))))

(this is in preview/prv-emacs.el, since the variant for XEmacs looks
quite different).

This is used as

  (preview-add-urgentization #'preview-gs-urgentize ov run-buffer)

when the overlay is pushed into preview-gs-queue.
preview-gs-urgentize then does the following:

(defun preview-gs-urgentize (ov buff)
  "Make a displayed overlay render with higher priority.
This function is used in fake conditional display properties
for reordering the conversion order to prioritize on-screen
images.  OV is the overlay in question, and BUFF is the
Ghostscript process buffer where the buffer-local queue
is located."
  ;; It does not matter that ov gets queued twice in that process: the
  ;; first version to get rendered will clear the 'queued property.
  ;; It cannot get queued more than twice since we remove the
  ;; conditional display property responsible for requeuing here.
  ;; We don't requeue if the overlay has been killed (its buffer made
  ;; nil).  Not necessary, but while we are checking...
  ;; We must return t.
  (preview-remove-urgentization ov)
  (when (and (overlay-get ov 'queued)
	     (overlay-buffer ov))
    (with-current-buffer buff
      (push ov preview-gs-queue)))
  t)


Ok, the net effect is that stuff that is on-screen will get pushed to
the front of the queue.  That means when moving around in the buffer,
first the on-screen stuff gets done, afterwards the non-visible stuff
gets done in background.

I think this would be a reasonable way of proceeding with large
directory listings, too.

If it is any help: those parts are written by myself and a part of
AUCTeX for which I have assigned papers.

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum

  reply	other threads:[~2006-01-29 18:13 UTC|newest]

Thread overview: 127+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-01-25  1:08 thumbs.el and transparency Nick Roberts
2006-01-25  7:59 ` Juri Linkov
2006-01-25  9:20   ` Nick Roberts
2006-01-26 18:54     ` Mathias Dahl
2006-01-26 21:59       ` Nick Roberts
2006-01-27  3:46         ` Miles Bader
2006-01-27  9:27           ` Nick Roberts
2006-01-28  4:50             ` Richard M. Stallman
2006-01-28 23:58               ` Nick Roberts
2006-01-29 13:41                 ` Mathias Dahl
2006-01-29 21:10                   ` Nick Roberts
2006-01-29 22:42                     ` Mathias Dahl
2006-01-30 10:26                 ` Kim F. Storm
2006-01-30 11:23                   ` Juanma Barranquero
2006-01-30 15:12                     ` Chong Yidong
2006-01-30 15:41                       ` Juanma Barranquero
2006-01-30 18:43                         ` Chong Yidong
2006-01-31 15:31                         ` CUA-related problem (was: Re: thumbs.el and transparency) Kim F. Storm
2006-01-31 15:41                           ` Juanma Barranquero
2006-01-31 18:19                             ` Luc Teirlinck
2006-01-31 19:32                               ` Juanma Barranquero
2006-01-31 18:04                         ` thumbs.el and transparency Richard M. Stallman
2006-01-31 19:47                           ` Juanma Barranquero
2006-01-31 21:10                             ` Luc Teirlinck
2006-01-31 23:08                               ` Kim F. Storm
2006-01-31 23:45                                 ` Luc Teirlinck
2006-02-01 10:41                                   ` Kim F. Storm
2006-02-02  2:07                                     ` Luc Teirlinck
2006-02-02  9:26                                       ` Juanma Barranquero
2006-02-02  9:35                                       ` Kim F. Storm
2006-01-31 23:54                                 ` Luc Teirlinck
2006-02-01 10:45                                 ` Juanma Barranquero
2006-01-30 23:25                     ` Richard M. Stallman
2006-01-31  9:26                       ` Juanma Barranquero
2006-01-29  9:38               ` Sascha Wilde
2006-01-29 13:46                 ` Mathias Dahl
2006-01-29 16:38                   ` Miles Bader
2006-01-29 18:13                     ` David Kastrup [this message]
2006-01-29 22:35                     ` Mathias Dahl
2006-01-29 16:50                   ` David Kastrup
2006-01-29 22:33                     ` Mathias Dahl
2006-01-27 16:53           ` Mathias Dahl
2006-01-29  0:03             ` Nick Roberts
2006-01-30  0:56               ` Richard M. Stallman
2006-01-30 11:35                 ` Mathias Dahl
2006-01-29  2:33             ` Miles Bader
2006-01-29 14:07               ` Mathias Dahl
2006-01-29 14:34               ` Mathias Dahl
2006-01-29 16:22             ` Robert J. Chassell
2006-01-29 18:01               ` Chong Yidong
2006-01-29 20:13               ` Nick Roberts
2006-01-30  1:04                 ` Robert J. Chassell
2006-01-30  2:08                   ` Nick Roberts
2006-01-30 14:44                     ` Robert J. Chassell
2006-01-29 22:04               ` Mathias Dahl
2006-01-29 23:13                 ` Chong Yidong
2006-01-30 11:57                   ` Mathias Dahl
2006-01-30 14:18                   ` Mathias Dahl
2006-01-30  1:49                 ` Robert J. Chassell
2006-01-30 12:08                   ` Mathias Dahl
2006-01-28  4:51           ` Richard M. Stallman
2006-01-29 16:01             ` Mathias Dahl
2006-01-30 18:46               ` Richard M. Stallman
2006-01-30 21:49                 ` Mathias Dahl
2006-01-30 22:16                   ` Mathias Dahl
2006-01-31 18:03                   ` Richard M. Stallman
2006-02-01 10:44                     ` Mathias Dahl
2006-02-02  4:16                       ` Richard M. Stallman
2006-02-02 16:34                         ` Mathias Dahl
2006-02-04 18:27                           ` Richard M. Stallman
2006-02-05 12:03                             ` Mathias Dahl
2006-02-05 20:36                               ` Juri Linkov
2006-02-05 22:05                                 ` Mathias Dahl
2006-02-06  0:22                                   ` Miles Bader
2006-02-06  7:27                                     ` Juri Linkov
2006-02-06 17:37                                     ` Mathias Dahl
2006-02-07 10:59                                       ` Juri Linkov
2006-02-07 17:46                                         ` Mathias Dahl
2006-02-08  9:17                                           ` Juri Linkov
2006-02-08 15:27                                             ` Mathias Dahl
2006-02-09 17:29                                               ` Juri Linkov
2006-02-09 22:46                                                 ` Mathias Dahl
2006-02-10  1:29                                                   ` Juri Linkov
2006-02-10 10:14                                                     ` Mathias Dahl
2006-02-10 10:28                                                       ` Miles Bader
2006-02-10 13:45                                                       ` tumme testing Robert J. Chassell
2006-02-10 14:26                                                         ` Mattis
2006-02-10 18:18                                                           ` Robert J. Chassell
2006-02-11  0:17                                                             ` Mattis
2006-02-11 12:57                                                               ` Robert J. Chassell
2006-02-11 21:54                                                                 ` Mathias Dahl
2006-02-11  1:22                                                           ` Juri Linkov
2006-02-11  9:21                                                             ` Mathias Dahl
2006-02-12 17:45                                                               ` Juri Linkov
2006-02-12 21:21                                                                 ` Mathias Dahl
2006-02-12 23:41                                                                   ` Mathias Dahl
2006-02-13  0:24                                                                     ` Robert J. Chassell
2006-02-13 17:55                                                                       ` Juri Linkov
2006-02-13 18:41                                                                         ` Drew Adams
2006-02-14  6:18                                                                           ` Tomas Zerolo
2006-02-14 17:45                                                                             ` Juri Linkov
2006-02-13 20:21                                                                         ` Mathias Dahl
2006-02-10 16:47                                                         ` Mathias Dahl
2006-02-11 16:45                                                     ` thumbs.el and transparency Richard M. Stallman
2006-02-09 23:47                                                 ` Miles Bader
2006-02-10 10:12                                                   ` Mathias Dahl
2006-02-10 23:02                                                 ` Richard M. Stallman
2006-02-10 23:56                                                   ` Mathias Dahl
2006-02-11  1:21                                                     ` Juri Linkov
2006-02-11  9:30                                                       ` Mathias Dahl
2006-02-12 17:45                                                         ` Juri Linkov
2006-02-12 18:35                                                           ` Mathias Dahl
2006-02-12  4:30                                                     ` Richard M. Stallman
2006-02-12 14:38                                                       ` Mattis
2006-02-12 17:47                                                         ` Juri Linkov
2006-02-12 18:39                                                           ` Mathias Dahl
2006-02-13 17:57                                                             ` Juri Linkov
2006-02-06  2:06                               ` Richard M. Stallman
2006-02-06 21:19                                 ` Can someone verify my changes to tumme and dired? (was: thumbs.el and transparency) Mathias Dahl
2006-02-06 22:17                                   ` Can someone verify my changes to tumme and dired? Mathias Dahl
2006-02-06 23:33                                     ` David Kastrup
2006-02-07 12:58                                       ` Mathias Dahl
2006-01-27  4:12         ` thumbs.el and transparency Miles Bader
2006-01-27  4:50           ` Nick Roberts
  -- strict thread matches above, loose matches on Subject: below --
2006-01-29 13:57 Xavier Maillard
2006-01-29 20:14 ` Nick Roberts
2006-01-29 22:11   ` Mathias Dahl

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=85bqxu52dm.fsf@lola.goethe.zz \
    --to=dak@gnu.org \
    --cc=brakjoller@gmail.com \
    --cc=emacs-devel@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 public inbox

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

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