From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Richard Stallman Newsgroups: gmane.emacs.devel Subject: Re: C file recoginzed as image file Date: Tue, 09 Jan 2007 12:57:40 -0500 Message-ID: References: Reply-To: rms@gnu.org NNTP-Posting-Host: lo.gmane.org Content-Type: text/plain; charset=ISO-8859-15 X-Trace: sea.gmane.org 1168365633 2994 80.91.229.12 (9 Jan 2007 18:00:33 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 9 Jan 2007 18:00:33 +0000 (UTC) Cc: lekktu@gmail.com, emacs-devel@gnu.org, c.a.rendle@gmail.com, dooglus@gmail.com Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Jan 09 19:00:30 2007 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1H4LGs-0006HI-1W for ged-emacs-devel@m.gmane.org; Tue, 09 Jan 2007 19:00:26 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1H4LGr-0004ld-Pd for ged-emacs-devel@m.gmane.org; Tue, 09 Jan 2007 13:00:25 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1H4LEh-0003tT-B5 for emacs-devel@gnu.org; Tue, 09 Jan 2007 12:58:11 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1H4LEg-0003sn-Bb for emacs-devel@gnu.org; Tue, 09 Jan 2007 12:58:10 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1H4LEg-0003sc-0u for emacs-devel@gnu.org; Tue, 09 Jan 2007 12:58:10 -0500 Original-Received: from [199.232.76.164] (helo=fencepost.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.52) id 1H4LEf-000614-MV for emacs-devel@gnu.org; Tue, 09 Jan 2007 12:58:09 -0500 Original-Received: from rms by fencepost.gnu.org with local (Exim 4.60) (envelope-from ) id 1H4LEC-000623-7l; Tue, 09 Jan 2007 12:57:40 -0500 Original-To: Stefan Monnier In-reply-to: (message from Stefan Monnier on Mon, 08 Jan 2007 10:09:21 -0500) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:65070 Archived-At: 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.