emacs-devel
[Top][All Lists]
Advanced

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

Re: Image-conversion shims


From: Lars Ingebrigtsen
Subject: Re: Image-conversion shims
Date: Mon, 30 Sep 2019 06:12:03 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

Eli Zaretskii <address@hidden> writes:

>> Uhm...  what about...  image-use-external-converter?
>
> SGTM.

OK; done.

> But that means the command strings are restricted in what they can
> use, because split-string has some limitations that aren't immediately
> evident.  So if you want to leave this stuff as-is, at least we should
> say something in the doc string of image-converter--converters to that
> effect that; e.g., I think quotes should not be allowed there.

Stefan M. suggested using a list instead of a string, and I think I'll
make that adjustment.

> Maybe.  It sounds a bit too convoluted to me, and I hoped for a
> simpler solution...

Me too, but I don't see one at the moment.

> Actually, why not simply add the relevant extensions to
> auto-mode-alist, causing them to invoke image-mode?

But when do we do that?  To determine what the list of supported formats
is, we have to run `image-converter--probe' (etc).  But we don't know
whether we need to do that until we know that we're going to load an
unsupported image format.  :-/

I.e., we want ("*.webp" . image-mode) in auto-mode-alist, but we can't
put it there before we've called "gm convert -list format", and we don't
do that until we call `create-image' with image-use-external-converter
non-nil, which won't be called since we don't have a mapping from
"*.webp" to image-mode.

Very chicken and egg.

Hm...  One possibility would be to do away with

(setq image-use-external-converter t)

as a user-level thing, and instead tell them to do

(image-external-converter-mode)

in ~/.emacs, which would do the probing and then altering
auto-mode-alist.  Hm.  Perhaps that's a pretty clean idea?  Hm...  I
think so.  Except that switching the mode off would have to remove the
entries from auto-mode-alist again, which sounds slightly destructive.

Uhm.  Perhaps map .wepb etc to a new image-mode-external that should
just be a mode that inherits from image-mode, but would do nothing if
the image-external-converter-mode has been toggled off?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no



reply via email to

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