From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Stephen J. Turnbull" Newsgroups: gmane.emacs.devel Subject: Re: C file recoginzed as image file Date: Tue, 09 Jan 2007 02:09:25 +0900 Message-ID: <87tzz1wim2.fsf@uwakimon.sk.tsukuba.ac.jp> References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1168275664 18202 80.91.229.12 (8 Jan 2007 17:01:04 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 8 Jan 2007 17:01:04 +0000 (UTC) Cc: lekktu@gmail.com, c.a.rendle@gmail.com, rms@gnu.org, dooglus@gmail.com, emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Jan 08 18:01:01 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 1H3xrW-0001hl-AD for ged-emacs-devel@m.gmane.org; Mon, 08 Jan 2007 18:00:42 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1H3xrV-0000z1-Om for ged-emacs-devel@m.gmane.org; Mon, 08 Jan 2007 12:00:41 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1H3xqw-0000ou-M4 for emacs-devel@gnu.org; Mon, 08 Jan 2007 12:00:06 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1H3xqu-0000nc-Jk for emacs-devel@gnu.org; Mon, 08 Jan 2007 12:00:06 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1H3xqu-0000nK-7T for emacs-devel@gnu.org; Mon, 08 Jan 2007 12:00:04 -0500 Original-Received: from [130.158.97.224] (helo=mtps02.sk.tsukuba.ac.jp) by monty-python.gnu.org with esmtp (Exim 4.52) id 1H3xqr-0000Cc-Fh; Mon, 08 Jan 2007 12:00:01 -0500 Original-Received: from uwakimon.sk.tsukuba.ac.jp (uwakimon.sk.tsukuba.ac.jp [130.158.99.156]) by mtps02.sk.tsukuba.ac.jp (Postfix) with ESMTP id 62AAE7FF6; Tue, 9 Jan 2007 01:59:29 +0900 (JST) Original-Received: by uwakimon.sk.tsukuba.ac.jp (Postfix, from userid 1000) id 917351A2D65; Tue, 9 Jan 2007 02:09:25 +0900 (JST) Original-To: Stefan Monnier In-Reply-To: X-Mailer: VM 7.17 under 21.5 (beta27) "fiddleheads" (+CVS-20060716) XEmacs Lucid 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:64982 Archived-At: Stefan Monnier writes: > If the intersection of the two sets is a singleton, then use that > major-mode, Hear, hear! Suggestion: s/two/N/. There may be metadata available (eg, from url.el). > otherwise query the user to decide whether to believe the file name > or the contents. If the contents look like OGG to Emacs's heuristic, I doubt libpng or ImageMagick will take the user's word that it's PNG. In general, I think that users would prefer information from metadata, then file names, then contents. So I suggest that (1) if there's metadata giving a MIME type, for example, then display using that type if all available heuristics agree (in the sense of a singleton intersection), otherwise warn the user and suggest one or more commands that can be used to force a codec compatible with the content; (2) else if the file extension heuristic is available, then display using that type if all available heuristics agree, otherwise warn and suggest; (3) else use the contents. YMMV, so if you think a different order of precedence is appropriate, you can amend the algorithm in the obvious way.