From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Stuart D. Herring" Newsgroups: gmane.emacs.devel Subject: Re: Image mode Date: Wed, 7 Feb 2007 08:10:22 -0800 (PST) Message-ID: <39229.128.165.123.18.1170864622.squirrel@webmail.lanl.gov> References: <87k5yxeg19.fsf@jurta.org> <87iregmafd.fsf@stupidchicken.com> <86irefojcc.fsf@lola.quinscape.zz> <86tzxzn0bx.fsf@lola.quinscape.zz> <86ps8nmy95.fsf@lola.quinscape.zz> <86d54nmve9.fsf@lola.quinscape.zz> <868xfbmthh.fsf@lola.quinscape.zz> Reply-To: herring@lanl.gov NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: sea.gmane.org 1170864661 26387 80.91.229.12 (7 Feb 2007 16:11:01 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 7 Feb 2007 16:11:01 +0000 (UTC) Cc: lekktu@gmail.com, cyd@stupidchicken.com, emacs-devel@gnu.org To: "Richard Stallman" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Feb 07 17:10:45 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 1HEpNc-0007RZ-Ja for ged-emacs-devel@m.gmane.org; Wed, 07 Feb 2007 17:10:44 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HEpNb-0004kg-V7 for ged-emacs-devel@m.gmane.org; Wed, 07 Feb 2007 11:10:44 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1HEpNQ-0004kb-Ta for emacs-devel@gnu.org; Wed, 07 Feb 2007 11:10:32 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1HEpNM-0004kO-9S for emacs-devel@gnu.org; Wed, 07 Feb 2007 11:10:31 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HEpNM-0004kL-5F for emacs-devel@gnu.org; Wed, 07 Feb 2007 11:10:28 -0500 Original-Received: from mailwasher.lanl.gov ([192.65.95.54] helo=mailwasher-b.lanl.gov) by monty-python.gnu.org with esmtp (Exim 4.52) id 1HEpNJ-0005dg-Pn; Wed, 07 Feb 2007 11:10:26 -0500 Original-Received: from mailrelay3.lanl.gov (mailrelay3.lanl.gov [128.165.4.104]) by mailwasher-b.lanl.gov (8.13.8/8.13.8/(ccn-5)) with ESMTP id l17GANSO024625; Wed, 7 Feb 2007 09:10:23 -0700 Original-Received: from webmail1.lanl.gov (webmail1.lanl.gov [128.165.4.106]) by mailrelay3.lanl.gov (8.13.8/8.13.8/(ccn-5)) with ESMTP id l17GAMJS024501; Wed, 7 Feb 2007 09:10:22 -0700 Original-Received: from webmail1.lanl.gov (localhost.localdomain [127.0.0.1]) by webmail1.lanl.gov (8.12.11.20060308/8.12.11) with ESMTP id l17GAMUg000718; Wed, 7 Feb 2007 09:10:22 -0700 Original-Received: (from apache@localhost) by webmail1.lanl.gov (8.12.11.20060308/8.12.11/Submit) id l17GAMi3000716; Wed, 7 Feb 2007 08:10:22 -0800 X-Authentication-Warning: webmail1.lanl.gov: apache set sender to herring@lanl.gov using -f Original-Received: from 128.165.123.18 (SquirrelMail authenticated user 196434) by webmail.lanl.gov with HTTP; Wed, 7 Feb 2007 08:10:22 -0800 (PST) In-Reply-To: User-Agent: SquirrelMail/1.4.8-2.el3.7lanl X-Priority: 3 (Normal) Importance: Normal X-PMX-Version: 4.7.1.128075 X-detected-kernel: Linux 2.4-2.6 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:66067 Archived-At: > What good does it do me to avoid displaying a image named foo.txt > if I don't avoid displaying an image named foo.jpg? Displaying an image carries some risk, while (to the best of everyone's knowledge) displaying any data whatever in an Emacs buffer as text (possibly with control characters, or with hexl-mode) is safe. So a user presented with two plausible files from an untrusted source, foo.txt and foo.jpg, might sensibly examine the text file first to see if it is legitimate. If, however, the files have the same malicious contents, and Emacs helpfully renders the .txt file as an image, the user's caution is vain. Yes, not all users have such caution, but they are not harmed by a policy which treats misnamed files as suspect. 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. All of this should of course be customizable: `image-render-immediately', defaulting to t because permanent paranoia should be opt-in, and `image-render-nonimage-immediately', defaulting to nil because users should not have to be paranoid about text files. Finally, the ".txt" extension here could just as easily be ".png"; if the image is in fact a JPEG, we have the case where a user has just patched their PNG library but not their JPEG library. I suppose that it is more common to merely distinguish images from not, so perhaps a third option `image-render-misnamed-immediately' defaulting to t would be appropriate. Davis PS The default values I offer here end up being a selection from the list of options that has been going around, but they are not the point! The point is to illustrate why the behavior could be usefully different for different extensions. -- This product is sold by volume, not by mass. If it appears too dense or too sparse, it is because mass-energy conversion has occurred during shipping.