[Top][All Lists]

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

Re: [Emacs-diffs] master 63f4f02: If requested, use external image conve

From: Stefan Monnier
Subject: Re: [Emacs-diffs] master 63f4f02: If requested, use external image converters for exotic formats
Date: Sun, 29 Sep 2019 09:22:12 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

> +(defvar image-converter--converters
> +  '((graphicsmagick :command "gm convert" :probe "-list format")
> +    (imagemagick :command "convert" :probe "-list format")
> +    (ffmpeg :command "ffmpeg" :probe "-decoders"))
> +  "List of supported image converters to try.")
> +    (let ((command (split-string (image-converter--value type :command) " "))
> +          formats)
> +      (when (zerop (apply #'call-process (car command) nil '(t nil) nil

Why not split the string directly in image-converter--converters?
Same for the ":probe" part?

I.e. use something like:

    (defvar image-converter--converters
      '((graphicsmagick :command "gm" :convertargs ("convert") :probe ("-list" 
        (imagemagick :command "convert" :probe ("-list" "format"))
        (ffmpeg :command "ffmpeg" :probe "-decoders"))

so it works even if the command's name (or some of the args your need to
pass to the command) contains spaces?

This said, given that you use separate methods for the different backends:

    (cl-defmethod image-converter--probe ((type (eql imagemagick)))

I don't understand why you need those args in
image-converter--converters instead of putting them directly into
their respective methods.


reply via email to

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