emacs-devel
[Top][All Lists]
Advanced

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

Re: A few issues with thumbs.el


From: Mathias Dahl
Subject: Re: A few issues with thumbs.el
Date: 12 Jun 2005 11:13:33 +0200
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3

Juanma Barranquero <address@hidden> writes:

> Yeah. In fact I want to do that to detect whether the convert.exe in
> the path is the ImageMagick's or Windows' one (alternatively, I'm
> thinking of temporarily removing %windir%/* directories from
> exec-path before trying to find convert.exe).

I don't understand why we couldn't just leave this to the user to
configure this, instead of trying to have more or less complex logic,
trying to figure this out automatically. `find-dired' has the same
problem in that it will find (haha) the wrong "find" on w32. It also
has more or less hard-coded syntax in it.

Juanma, you know how tumme.el currently does this; that works quite
well, does it not?

For others, this is how tumme currently handle this:

(defcustom tumme-cmd-create-thumbnail-program
  "convert"
  "*Executable used to create thumbnail. Used together with
`tumme-cmd-create-thumbnail-options'."
  :type 'string
  :group 'tumme)

...

(defcustom tumme-cmd-create-thumbnail-options
  "%e -size %sx%s \"%f\" -resize %sx%s +profile \"*\" jpeg:\"%t\""
  "*Format of command used to create thumbnail image. Available
options are %e which is replaced by
`tumme-cmd-create-thumbnail-program', %s which is replaced by
`tumme-thumb-size', %f which is replaced by the file name of the
original image and %t which is replaced by the file name of the
thumbnail file."
  :type 'string
  :group 'tumme)

...

(defun tumme-create-thumb (file)
  "Using the convert program, create thumbnail image for FILE and
place it in `tumme-dir'"
  (let* ((size (int-to-string tumme-thumb-size))
         (command
          (format-spec
           tumme-cmd-create-thumbnail-options
           (list
            (cons ?e tumme-cmd-create-thumbnail-program)
            (cons ?s size)
            (cons ?f file)
            (cons ?t (expand-file-name (tumme-thumb-name file)))))))
    (if (file-exists-p tumme-dir)
        (if (not (file-directory-p tumme-dir))
            (error "%s exists but is not a directory!" tumme-dir))
      (make-directory tumme-dir))
    (shell-command command nil)))

/Mathias





reply via email to

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