From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: using libmagic in Emacs? Date: Tue, 25 Aug 2009 13:36:27 -0400 Message-ID: References: <87ocqco7fi.fsf@mail.jurta.org> <87y6pb8lqh.fsf@mail.jurta.org> <87my5qngab.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 1251221815 4511 80.91.229.12 (25 Aug 2009 17:36:55 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 25 Aug 2009 17:36:55 +0000 (UTC) Cc: Juri Linkov , 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 19:36:48 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 1Mfzwo-000893-Nh for ged-emacs-devel@m.gmane.org; Tue, 25 Aug 2009 19:36:43 +0200 Original-Received: from localhost ([127.0.0.1]:36503 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mfzwn-0000G4-QL for ged-emacs-devel@m.gmane.org; Tue, 25 Aug 2009 13:36:41 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Mfzwi-0000Cz-Ii for emacs-devel@gnu.org; Tue, 25 Aug 2009 13:36:36 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Mfzwe-0008Tr-0N for emacs-devel@gnu.org; Tue, 25 Aug 2009 13:36:36 -0400 Original-Received: from [199.232.76.173] (port=49956 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mfzwd-0008Td-KX for emacs-devel@gnu.org; Tue, 25 Aug 2009 13:36:31 -0400 Original-Received: from chene.dit.umontreal.ca ([132.204.246.20]:54463) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Mfzwb-0002B4-Ah; Tue, 25 Aug 2009 13:36:29 -0400 Original-Received: from faina.iro.umontreal.ca (faina.iro.umontreal.ca [132.204.26.177]) by chene.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id n7PHaRd9025181; Tue, 25 Aug 2009 13:36:27 -0400 Original-Received: by faina.iro.umontreal.ca (Postfix, from userid 20848) id A7A453A06B; Tue, 25 Aug 2009 13:36:27 -0400 (EDT) In-Reply-To: (Richard Stallman's message of "Mon, 24 Aug 2009 22:08:02 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux) X-NAI-Spam-Score: 0 X-NAI-Spam-Rules: 1 Rules triggered RV3348=0 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:114591 Archived-At: > 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'. Actually, running `file' might be a useful fallback (especially if run via process-file so it also works on remote files, contrary to libmagic). Also, looking at the way the magic database works, it seems that we might want to run `file-type-by-magic' on a buffer's content as well. As for Miles's suggestion to interpret the magic file directly, I think it's a bad idea: let's not reinvent the wheel, the code that parses this database and uses it already exists, it's in libmagic, so we should just use it. Stefan