302 |
|
|
303 |
(defun thumbs-thumbname (img) |
(defun thumbs-thumbname (img) |
304 |
"Return a thumbnail name for the image IMG." |
"Return a thumbnail name for the image IMG." |
305 |
(concat thumbs-thumbsdir "/" |
(convert-standard-filename |
306 |
(subst-char-in-string |
(let ((filename (expand-file-name img))) |
307 |
?\ ?\_ |
(format "%s/%08x-%s.jpg" |
308 |
(apply |
thumbs-thumbsdir |
309 |
'concat |
(sxhash filename) |
310 |
(split-string |
(subst-char-in-string |
311 |
(expand-file-name img) "/"))))) |
?\s ?\_ |
312 |
|
(apply |
313 |
|
'concat |
314 |
|
(split-string filename "/"))))))) |
315 |
|
|
316 |
(defun thumbs-make-thumb (img) |
(defun thumbs-make-thumb (img) |
317 |
"Create the thumbnail for IMG." |
"Create the thumbnail for IMG." |
318 |
(let* ((fn (expand-file-name img)) |
(let ((fn (expand-file-name img)) |
319 |
(tn (thumbs-thumbname img))) |
(tn (thumbs-thumbname img))) |
320 |
(if (or (not (file-exists-p tn)) |
(if (or (not (file-exists-p tn)) |
321 |
;; This is not the right fix, but I don't understand |
;; This is not the right fix, but I don't understand |
322 |
;; the external program or why it produces a geometry |
;; the external program or why it produces a geometry |
381 |
(unless (bobp) (newline)))) |
(unless (bobp) (newline)))) |
382 |
|
|
383 |
(defun thumbs-show-thumbs-list (L &optional buffer-name same-window) |
(defun thumbs-show-thumbs-list (L &optional buffer-name same-window) |
384 |
(when (not (display-images-p)) |
(unless (and (display-images-p) |
385 |
(error "Images are not supported in this Emacs session")) |
(image-type-available-p 'jpeg)) |
386 |
|
(error "Required image type is not supported in this Emacs session")) |
387 |
(funcall (if same-window 'switch-to-buffer 'pop-to-buffer) |
(funcall (if same-window 'switch-to-buffer 'pop-to-buffer) |
388 |
(or buffer-name "*THUMB-View*")) |
(or buffer-name "*THUMB-View*")) |
389 |
(let ((inhibit-read-only t)) |
(let ((inhibit-read-only t)) |