From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Juanma Barranquero" Newsgroups: gmane.emacs.devel Subject: Re: C file recoginzed as image file Date: Sun, 7 Jan 2007 20:20:48 +0100 Message-ID: References: <459EE983.9040008@gnu.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1168197716 15525 80.91.229.12 (7 Jan 2007 19:21:56 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 7 Jan 2007 19:21:56 +0000 (UTC) Cc: Chris Moore , Charles Rendleman , emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Jan 07 20:21:37 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 1H3dZn-0005fA-OS for ged-emacs-devel@m.gmane.org; Sun, 07 Jan 2007 20:21:04 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1H3dZn-0002y3-12 for ged-emacs-devel@m.gmane.org; Sun, 07 Jan 2007 14:21:03 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1H3dZb-0002wn-OK for emacs-devel@gnu.org; Sun, 07 Jan 2007 14:20:51 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1H3dZa-0002vG-2V for emacs-devel@gnu.org; Sun, 07 Jan 2007 14:20:51 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1H3dZZ-0002v2-R2 for emacs-devel@gnu.org; Sun, 07 Jan 2007 14:20:49 -0500 Original-Received: from [64.233.182.188] (helo=nf-out-0910.google.com) by monty-python.gnu.org with esmtp (Exim 4.52) id 1H3dZZ-0007jf-B9 for emacs-devel@gnu.org; Sun, 07 Jan 2007 14:20:49 -0500 Original-Received: by nf-out-0910.google.com with SMTP id h2so1799780nfe for ; Sun, 07 Jan 2007 11:20:48 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=EmKQ5qiBuXQOHfZA7FmU91LYE8F6l80JfQH7p1uQqYxe10IgSKnZprCv3+OjOfF07i/pEaSL/6MnmNF4rqS7DKCuhUJkQnWI0amJxWJBQQHsQw0+1X91Rc6SQ0WO2xwrcmEDux8T70qry0elmWbqgqpwsdfxNkyQir0XzgGxWeM= Original-Received: by 10.82.113.6 with SMTP id l6mr2626491buc.1168197648199; Sun, 07 Jan 2007 11:20:48 -0800 (PST) Original-Received: by 10.82.147.2 with HTTP; Sun, 7 Jan 2007 11:20:48 -0800 (PST) Original-To: "Jason Rumney" In-Reply-To: <459EE983.9040008@gnu.org> Content-Disposition: inline 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:64928 Archived-At: On 1/6/07, Jason Rumney wrote: > I think this can be fixed by using image-mode-maybe in magic-mode-alist, > instead of image-mode. I like this fix. It is still possible to disguise an image type as another image type (a JPEG with a .png file extension, for example), but I don't think that's much of an issue, unless someone happens to trust jpeg62.dll and not libpng13.dll, for example, which would be weird. All in all, we should reach a decision regarding this issue and act upon it. IIRC, there are a few alternatives: 1) Do nothing, i.e., let Emacs auto-detect images. 2) Disable auto-detection, but leave it available to users who want to set it up (with `image-type-auto-detectable'). 3) Revert to previous state: Remove `image-type-auto-detected-p' and `image-type-auto-detectable' and leave `magic-mode-alist' as before. 4) Use `image-type-maybe' (as per Jason's patch) so valid extensions take precedence over contents-based detection (of image files, not in the general case). 5) Ask the user when the file extension and the auto-detected image type disagree. 6) Ask the user whenever an image file is auto-detected based on contents. 7) Use a "disabled" wrapper for image-mode (or image-mode-maybe) in `magic-mode-alist', so the user is forced to decide whether he trusts auto-detection or not (I just dreamed this one, and I'm adding it out of completeness, but I don't like it). 8) Any other? My preferences are: 4, 2, 5, 6, 7, 1, 3. /L/e/k/t/u