[Top][All Lists]

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

Re: Image mode

From: Richard Stallman
Subject: Re: Image mode
Date: Sun, 11 Feb 2007 23:55:02 -0500

    The point is that all users, whether they know about the risks or not,
    mean for Emacs to render a JPEG if they M-x find-file foo.jpg, because
    that is really the only useful thing Emacs could do there.  When -some-
    users M-x find-file foo.txt, they are specifically wanting Emacs -not- to
    render the file as an image, because they are being careful and dealing
    only in text.  Other users who would see the JPEG data and think only
    "huh, this is garbage" rather than "wow, it really was an image posing as
    text" would benefit from image-minor-mode and its helpful minibuffer
    message about C-c C-c.  In either case, starting the major mode associated
    with the file's extension is probably appropriate.

    So for some users, recognizing but failing to render an image.txt is
    helpful, and for others it does no real harm.  And for all users,
    recognizing and rendering an image.jpg is sensible.

I think you have convinced me that there is some benefit in treating
the contents-extension mismatch case differently from the case where
they match.

So I am led to think of these rules:

1. If the file name indicates an image type and the contents match it,
use image mode.

2. If the file name has no meaning and the contents indicate an image,
use Fundamental mode and Image minor mode.

3. If the file name has a meaning which conflicts with the image type,
obey the file name.

#3 is mostly the case after Yidong's latest change.  The only change
proposed in #3 is that a file foo.jpg which contains a PNG should be
treated as a case of #3.

All of this is separate from the question of whether to display an image
immediately even in case 1.

reply via email to

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