From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Miles Bader Newsgroups: gmane.emacs.devel Subject: Re: using libmagic in Emacs? Date: Tue, 25 Aug 2009 11:19:37 +0900 Message-ID: <87r5v0prd2.fsf@catnip.gol.com> References: <87ocqco7fi.fsf@mail.jurta.org> <87y6pb8lqh.fsf@mail.jurta.org> <87my5qngab.fsf@mail.jurta.org> Reply-To: Miles Bader NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1251166805 8625 80.91.229.12 (25 Aug 2009 02:20:05 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 25 Aug 2009 02:20:05 +0000 (UTC) Cc: Juri Linkov , 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 Tue Aug 25 04:19:58 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 1Mfldd-0006ZG-LZ for ged-emacs-devel@m.gmane.org; Tue, 25 Aug 2009 04:19:57 +0200 Original-Received: from localhost ([127.0.0.1]:39876 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mfldc-0002Wk-9j for ged-emacs-devel@m.gmane.org; Mon, 24 Aug 2009 22:19:56 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MfldW-0002WR-Ok for emacs-devel@gnu.org; Mon, 24 Aug 2009 22:19:50 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MfldR-0002WD-3F for emacs-devel@gnu.org; Mon, 24 Aug 2009 22:19:50 -0400 Original-Received: from [199.232.76.173] (port=39916 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MfldQ-0002WA-WF for emacs-devel@gnu.org; Mon, 24 Aug 2009 22:19:45 -0400 Original-Received: from smtp11.dentaku.gol.com ([203.216.5.73]:52928) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MfldN-0003DR-Vd; Mon, 24 Aug 2009 22:19:42 -0400 Original-Received: from 218.231.109.79.eo.eaccess.ne.jp ([218.231.109.79] helo=catnip.gol.com) by smtp11.dentaku.gol.com with esmtpa (Dentaku) id 1MfldK-0000YG-E0; Tue, 25 Aug 2009 11:19:38 +0900 Original-Received: by catnip.gol.com (Postfix, from userid 1000) id D55C1DFBE; Tue, 25 Aug 2009 11:19:37 +0900 (JST) System-Type: x86_64-unknown-linux-gnu In-Reply-To: (Richard Stallman's message of "Mon, 24 Aug 2009 22:08:02 -0400") Original-Lines: 27 X-Virus-Scanned: ClamAV GOL (outbound) X-Abuse-Complaints: abuse@gol.com X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) 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:114571 Archived-At: 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. -Miles --=20 =E8=87=AA=E3=82=89=E3=82=92=E7=A9=BA=E3=81=AB=E3=81=97=E3=81=A6=E3=80=81=E5= =BF=83=E3=82=92=E9=96=8B=E3=81=8F=E6=99=82=E3=80=81=E9=81=93=E3=81=AF=E9=96= =8B=E3=81=8B=E3=82=8C=E3=82=8B