unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Mathias Dahl <brakjoller.rem0veth1s@gmail.com>
Subject: Can I avoid using `clear-image-cache'?
Date: Fri, 06 May 2005 11:27:15 +0200	[thread overview]
Message-ID: <ur7gkso0c.fsf@gmail.com> (raw)

I am currently developing a little package, tumme.el, to browse images
in Emacs. It is similar to thumbs.el but quite different too.

I have code that inserts thumbnail versions of images into a buffer,
like this:

  (defun tumme-ins-img (file original-file-name
                             associated-dired-buffer)
    "Insert thumbnail image."
    (let (beg end tags
              (i `(image :type ,'jpeg
                         :file ,file
                         :relief ,tumme-thumb-relief
                         :margin ,tumme-thumb-margin)))
      (setq beg (point))
      (insert-image i)
      (setq end (point))
      (add-text-properties
       beg end
       (list 'original-file-name original-file-name
             'associated-dired-buffer associated-dired-buffer
             'tags (tumme-list-tags original-file-name)))))

The problem is that if I rotate the thumbnail image (using the tools
from ImageMagick), removes and inserts the image again, the image is
fetched from Emacs' image cache. Therefor I need to clear the cache
using `clear-image-cache' so that it loads the file from disk.

Now, I know that this can be done in other ways. For example
`insert-image-file' does not have this problem as it puts the image
bytes into the text properties, while they way I use `insert-image'
will insert the file name. I probably can change the code to work the
way `insert-image-file' does, but I would rather like to, in some way,
be able to flush one particular image from the image cache.

Can this be done or do I need to write a more advanced piece of code?

For now I will use `clear-image-cache' although it feels "ugly".

/Mathias

             reply	other threads:[~2005-05-06  9:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-05-06  9:27 Mathias Dahl [this message]
2005-05-06 10:35 ` Can I avoid using `clear-image-cache'? Thien-Thi Nguyen
2005-05-09  6:01   ` 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=ur7gkso0c.fsf@gmail.com \
    --to=brakjoller.rem0veth1s@gmail.com \
    /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).