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, 18 Aug 2009 15:23:06 -0400 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1250623472 26947 80.91.229.12 (18 Aug 2009 19:24:32 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 18 Aug 2009 19:24:32 +0000 (UTC) Cc: Emacs Development To: joakim@verona.se Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Aug 18 21:24:25 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 1MdUID-0007ib-AT for ged-emacs-devel@m.gmane.org; Tue, 18 Aug 2009 21:24:25 +0200 Original-Received: from localhost ([127.0.0.1]:37230 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MdUIC-0008LN-MJ for ged-emacs-devel@m.gmane.org; Tue, 18 Aug 2009 15:24:24 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MdUH3-0007wk-14 for emacs-devel@gnu.org; Tue, 18 Aug 2009 15:23:13 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MdUGy-0007uy-IC for emacs-devel@gnu.org; Tue, 18 Aug 2009 15:23:12 -0400 Original-Received: from [199.232.76.173] (port=54688 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MdUGy-0007ur-86 for emacs-devel@gnu.org; Tue, 18 Aug 2009 15:23:08 -0400 Original-Received: from pruche.dit.umontreal.ca ([132.204.246.22]:42960) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MdUGx-0003ny-Ut for emacs-devel@gnu.org; Tue, 18 Aug 2009 15:23:08 -0400 Original-Received: from faina.iro.umontreal.ca (faina.iro.umontreal.ca [132.204.26.177]) by pruche.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id n7IJN6WF029422; Tue, 18 Aug 2009 15:23:06 -0400 Original-Received: by faina.iro.umontreal.ca (Postfix, from userid 20848) id 9F1C390126; Tue, 18 Aug 2009 15:23:06 -0400 (EDT) In-Reply-To: (joakim@verona.se's message of "Tue, 18 Aug 2009 20:35:14 +0200") 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 RV3343=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:114381 Archived-At: > (This is probably a FAQ but my google skills seem to fail me) > There are some operations in Emacs which tries to do the same thing as > the "libmagic" library, which is the core of the "file" utility, does. > For instance, in "image.el" there is functionality to look at magic > numbers in image files. > Also, I often whish that files would open in Emacs with correct mode > more often when there is no file extension. > Would there be interest in an Emacs patch for libmagic, or is there some > obvious reason this havent been done yet? I envision this as being an > inteface with 2 implementations, a lisp fallback like today, and > libmagic if available. I did a libmagick wrapper for Ocaml using Swig > before so I have some familiarity with the API. I think it's a good idea. It may require some non-trivial changes on the Lisp side, since libmagic's information is not quite the same as what Emacs currently uses: we'll probably want to use libmagic to get a MIME-type and then have a table mapping mime-types to major modes or some such. Stefan