[Top][All Lists]

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

Re: C file recoginzed as image file

From: Richard Stallman
Subject: Re: C file recoginzed as image file
Date: Tue, 09 Jan 2007 12:57:40 -0500

    But they're heuristics as well.  A text file may start with the title
    "GIF89a file format".

That particular one is pretty unreliable, I agree.

    E.g. auto-mode-alist would give "don't know" for a file named "/b/c/foo" but
    would give the set { perl-mode, prolog-mode } for a file named
    "/b/c/foo.pl".  Then magic-mode-alist would give other sets of modes (based
    on things like the #! interpreter name, the -*- ... -*- cookie, etc...).
    If the intersection of the two sets is a singleton, then use that
    major-mode, otherwise query the user to decide whether to believe the file
    name or the contents.  After all, an inconsistently named file is generally
    a sign that there's something wrong, so it's good to prompt the user
    about it.

This is not sufficient for protection against bugs in libraries.  It
might be an improvement on general principles, but it is too complex
to do before the release.

For protection against bugs in libraries, we could consider writing
code in Emacs to thoroughly validate an image before displaying it.
That too is too much for before the release, but it would be the best
solution for after the release.

reply via email to

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