[Top][All Lists]

[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: Wed, 09 Oct 2019 21:26:04 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

Stefan Monnier <address@hidden> writes:

> I still can't see why we should care about our ability to display an
> image before preferring image-mode over fundamental-mode.

It just feels odd to be mapping file extensions to a mode when we don't
know whether that mode can display the file meaningfully or not.  We
don't do that with other file types, so why with images?

But in practice I guess it doesn't make much difference.  It's more of a
cleanliness thing.

> IOW, I think the auto-mode-alist entries should be added statically not
> based on what we can do with them, but based on what the extension means
> in practice.
> Typically, there are various cases:
> - things like .svg and .xpm which can be meaningfully viewed as "an
>   image" or as "a text file".  There, we should make sure the user can
>   switch between those two views (and default to text if we can't
>   display the image, e.g. via image-mode-maybe).
> - extensions which are sometimes used for images and sometimes for
>   completely unrelated purposes.  We should decide based on
>   which is most likely to the case.

Since we don't default to using the external converters for exotic image
formats, when the user has switched it on, that's a signal that the user
does want those to be mapped to images, perhaps, which is a practical
argument for having the mappings be dynamic.

> - extensions which are always images and can't meaningfully be edited
>   within Emacs, so only image-mode makes sense.

In that case we should change image-mode to not display stuff like this
for formats it doesn't understand:

Type C-c C-c or C-c C-x to view the image as an image or hex.
Cannot display image: (Cannot determine image type)

(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]