From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: joakim@verona.se Newsgroups: gmane.emacs.devel Subject: Re: using libmagic in Emacs? Date: Tue, 25 Aug 2009 07:09:03 +0200 Message-ID: References: <87ocqco7fi.fsf@mail.jurta.org> <87y6pb8lqh.fsf@mail.jurta.org> <87my5qngab.fsf@mail.jurta.org> <87r5v0prd2.fsf@catnip.gol.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1251176988 28654 80.91.229.12 (25 Aug 2009 05:09:48 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 25 Aug 2009 05:09:48 +0000 (UTC) Cc: Juri Linkov , emacs-devel@gnu.org, rms@gnu.org, monnier@IRO.UMontreal.CA To: Miles Bader Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Aug 25 07:09:41 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 1MfoHs-0000O8-AA for ged-emacs-devel@m.gmane.org; Tue, 25 Aug 2009 07:09:40 +0200 Original-Received: from localhost ([127.0.0.1]:48196 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MfoHq-0000ve-L8 for ged-emacs-devel@m.gmane.org; Tue, 25 Aug 2009 01:09:38 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MfoHk-0000vB-JZ for emacs-devel@gnu.org; Tue, 25 Aug 2009 01:09:32 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MfoHd-0000sW-KW for emacs-devel@gnu.org; Tue, 25 Aug 2009 01:09:30 -0400 Original-Received: from [199.232.76.173] (port=57759 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MfoHd-0000sT-EI for emacs-devel@gnu.org; Tue, 25 Aug 2009 01:09:25 -0400 Original-Received: from proxy1.bredband.net ([195.54.101.71]:35993) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MfoHZ-0007r9-CO; Tue, 25 Aug 2009 01:09:21 -0400 Original-Received: from iph2.telenor.se (195.54.127.133) by proxy1.bredband.net (7.3.140.3) id 49F5A15202F3743C; Tue, 25 Aug 2009 07:09:18 +0200 X-SMTPAUTH-B2: X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AvFtAMsOk0pT44qWPGdsb2JhbACafQEBAQE3uneEGgU X-IronPort-AV: E=Sophos;i="4.44,270,1249250400"; d="scan'208";a="37851608" Original-Received: from ua-83-227-138-150.cust.bredbandsbolaget.se (HELO exodia) ([83.227.138.150]) by iph2.telenor.se with ESMTP; 25 Aug 2009 07:09:18 +0200 Original-Received: from localhost.localdomain (DIR-655.lan [192.168.200.113]) (authenticated bits=0) by exodia (8.14.3/8.14.3) with ESMTP id n7P593Q0031533 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Tue, 25 Aug 2009 07:09:04 +0200 In-Reply-To: <87r5v0prd2.fsf@catnip.gol.com> (Miles Bader's message of "Tue, 25 Aug 2009 11:19:37 +0900") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux) X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. 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:114572 Archived-At: Miles Bader writes: > Richard Stallman writes: >> If some other Lisp code is interested in the mime type of a file, >> there is a much easier way to find it out: run `file'. > > Well, not entirely trivial of course, since Emacs then needs to > interpret the results from the file command. > >> To complicate Emacs with another library just to make that operation >> a little faster is a step in the wrong direction. > > I wonder how hard it would be to have some elisp that understands the > "magic" rules that the file command uses... at first glance, they don't > seem particularly complex; e.g., this is the first entry from > "/usr/share/file/magic": > > 0 lelong 0xc3cbc6c5 RISC OS Chunk data > >12 string OBJ_ \b, AOF object > >12 string LIB_ \b, ALF library > > If there was such elisp code, Emacs could use any magic rules file on > the system, and in addition, could distribute it's own (perhaps smaller) > set. I agree that the main benefit of using libmagic is getting access to the libmagic database. > -Miles -- Joakim Verona