Function: image-dired-update-thumbnail-at-point

image-dired-update-thumbnail-at-point is a byte-compiled function defined in image-dired-util.el.gz.

Signature

(image-dired-update-thumbnail-at-point)

Documentation

Update the thumbnail at point if the original image file has been modified.

This function uncaches and removes the thumbnail file under the old name.

Source Code

;; Defined in /usr/src/emacs/lisp/image/image-dired-util.el.gz
(defun image-dired-update-thumbnail-at-point ()
  "Update the thumbnail at point if the original image file has been modified.
This function uncaches and removes the thumbnail file under the old name."
  (when (image-dired-image-at-point-p)
    (let* ((file (image-dired-original-file-name))
           (thumb (expand-file-name (image-dired-thumb-name file)))
           (image (get-text-property (point) 'display)))
      (when image
        (let ((old-thumb (plist-get (cdr image) :file)))
          ;; When 'image-dired-thumb-naming' is set to
          ;; 'sha1-contents', 'thumb' and 'old-thumb' could be
          ;; different file names.  Update the thumbnail then.
          (unless (string= thumb old-thumb)
            (setf (plist-get (cdr image) :file) thumb)
            (clear-image-cache old-thumb)
            (delete-file old-thumb)))))))