emacs-devel
[Top][All Lists]
Advanced

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

A few issues with thumbs.el


From: Juanma Barranquero
Subject: A few issues with thumbs.el
Date: Wed, 25 May 2005 17:18:33 +0200

I've been testing thumbs.el on Windows, and I have a few issues:

  - Thumbs functions by default create jpeg thumbnails, but they don't
check whether the jpeg image support is loaded; that fails in
dynamic-loading environments. That is addressed in the patch below.

  - `thumbs-thumbname' makes a simple transformation on the image
filename to generate a thumbnail filename (taking out slashes and
changing spaces to underscores). That simple transformation fails on
Windows (it doesn't modify the ":" in drive:path, for example). I
could fix that, but instead of playing cat&mouse with unusual chars, I
think it'd be better to just make a digest of the name (with md5) and
get rid of the problem. That's addressed in the patch below, too.

  - When using `thumb', there's a crash on MSVC builds only; it
happens on jpeg_memory_src. I think the problem is unrelated to the
other day's troubles. I'll take a look at debugging it. Unaddressed.

  - The docstring of `thumbs-gensym' is wrong with respect to its
argument. But, instead of fixing the docstring, wouldn't be just
better to get rid of the argument? I mean, thumbs.el uses the function
without passing it, and I don't think there's much use outside of
thumbs.el for a `gensym'-alike that doesn't really add that much to
`gensym'. Or is there?

  - Other than being interactive, does `thumbs-kill-buffer' something
different that
   (quit-window t (selected-window))
  ?

                    /L/e/k/t/u



Index: lisp/ChangeLog
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/ChangeLog,v
retrieving revision 1.7592
diff -u -2 -r1.7592 ChangeLog
--- lisp/ChangeLog      25 May 2005 14:18:45 -0000      1.7592
+++ lisp/ChangeLog      25 May 2005 14:54:53 -0000
@@ -14,4 +14,8 @@
        (thumbs-increment-image-size, thumbs-decrement-image-size):
        Fix typos in docstrings.
+       (thumbs-thumbname): Use `md5' to safely encode all kinds of
+       filenames.
+       (thumbs-show-thumbs-list): Check for availability of the 'jpeg
+       image type.
 
  2005-05-24  Andre Spiegel  <address@hidden>
Index: lisp/thumbs.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/thumbs.el,v
retrieving revision 1.11
diff -u -2 -r1.11 thumbs.el
--- lisp/thumbs.el      25 May 2005 14:08:33 -0000      1.11
+++ lisp/thumbs.el      25 May 2005 14:24:14 -0000
@@ -303,11 +303,5 @@
  (defun thumbs-thumbname (img)
   "Return a thumbnail name for the image IMG."
-  (concat thumbs-thumbsdir "/"
-         (subst-char-in-string
-          ?\  ?\_
-          (apply
-           'concat
-           (split-string
-            (expand-file-name img) "/")))))
+  (concat thumbs-thumbsdir "/" (md5 (expand-file-name img))))
 
  (defun thumbs-make-thumb (img)
@@ -379,6 +373,7 @@
 
  (defun thumbs-show-thumbs-list (L &optional buffer-name same-window)
-  (when (not (display-images-p))
-    (error "Images are not supported in this Emacs session"))
+  (unless (and (display-images-p)
+               (image-type-available-p 'jpeg))
+    (error "Required image type is not supported in this Emacs session"))
   (funcall (if same-window 'switch-to-buffer 'pop-to-buffer)
           (or buffer-name "*THUMB-View*"))




reply via email to

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