From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.devel Subject: Re: using libmagic in Emacs? Date: Mon, 24 Aug 2009 03:17:18 +0300 Organization: JURTA Message-ID: <87my5qngab.fsf@mail.jurta.org> References: <87ocqco7fi.fsf@mail.jurta.org> <87y6pb8lqh.fsf@mail.jurta.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1251079051 11692 80.91.229.12 (24 Aug 2009 01:57:31 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 24 Aug 2009 01:57:31 +0000 (UTC) Cc: monnier@IRO.UMontreal.CA, joakim@verona.se, emacs-devel@gnu.org To: rms@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Aug 24 03:57:23 2009 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 1MfOoE-0006Lh-Nx for ged-emacs-devel@m.gmane.org; Mon, 24 Aug 2009 03:57:23 +0200 Original-Received: from localhost ([127.0.0.1]:33312 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MfOoD-0005s9-Pf for ged-emacs-devel@m.gmane.org; Sun, 23 Aug 2009 21:57:21 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MfOo7-0005q3-Js for emacs-devel@gnu.org; Sun, 23 Aug 2009 21:57:15 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MfOo2-0005pV-Tk for emacs-devel@gnu.org; Sun, 23 Aug 2009 21:57:15 -0400 Original-Received: from [199.232.76.173] (port=46987 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MfOo2-0005pS-Ok for emacs-devel@gnu.org; Sun, 23 Aug 2009 21:57:10 -0400 Original-Received: from smtp-out1.starman.ee ([85.253.0.3]:60883 helo=mx1.starman.ee) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MfOnz-0001kH-KL; Sun, 23 Aug 2009 21:57:08 -0400 X-Virus-Scanned: by Amavisd-New at mx1.starman.ee Original-Received: from mail.starman.ee (82.131.30.208.cable.starman.ee [82.131.30.208]) by mx1.starman.ee (Postfix) with ESMTP id 74BCB3F40E8; Mon, 24 Aug 2009 04:56:58 +0300 (EEST) In-Reply-To: (Richard Stallman's message of "Sun, 23 Aug 2009 20:07:18 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (x86_64-pc-linux-gnu) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) 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:114543 Archived-At: > Whatever we do with the function `image-jpeg-p', we could easily make > Emacs test these two bytes. It makes no sense to install code to link > with libmagic just to handle that and a few other similar things. > > Meanwhile, for operations less common and important than visiting a file, > running `file' is easy to do. > > Combining those two approaches seems much better than adding code to > link with libmagic. Of course, before adding code to link with libmagic we should analyze how useful it would be. I see its usefulness at least in the following areas: 1. Archive file types A popular way to create new archive file types nowadays is to register a new file extension with the old data compression and archive format. For instance, Java archive files have the .jar extension but build on the ZIP file format, so they can be visited in Emacs with the help of `archive-mode'. Enterprise Java archives with the .ear extension and Web application Java archives with the .war extension all are based on the ZIP file format as well as OpenDocument files with extensions .odt .ods .odb .odp .odg .odf, Firefox add-ons (.xpi), Keyhole Markup (.kmz), and many other file types that can be potentially opened in Emacs if were identified as archive files by libmagic. We can't track and add all new formats. This is the main task of libmagic. 2. Image file types Using ImageMagick in Emacs can support over 100 image file formats. It won't possible to recognize all them without libmagic. 3. MIME-types handling Emacs can process different MIME-type detected by libmagic. Even when Emacs has no special handling for a file type, it is still useful to let Emacs run an external program associated with its MIME-type for users who prefer running programs (including GUI programs) from Emacs instead of using a window manager's application menu. -- Juri Linkov http://www.jurta.org/emacs/