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, 18 Aug 2009 22:35:47 +0200 Message-ID: References: <87praszybe.fsf@stupidchicken.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1250627771 8653 80.91.229.12 (18 Aug 2009 20:36:11 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 18 Aug 2009 20:36:11 +0000 (UTC) Cc: Stefan Monnier , Emacs Development To: Chong Yidong Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Aug 18 22:36:03 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 1MdVPX-0000AE-1V for ged-emacs-devel@m.gmane.org; Tue, 18 Aug 2009 22:36:03 +0200 Original-Received: from localhost ([127.0.0.1]:47667 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MdVPW-0005DM-6S for ged-emacs-devel@m.gmane.org; Tue, 18 Aug 2009 16:36:02 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MdVPQ-0005Cs-UE for emacs-devel@gnu.org; Tue, 18 Aug 2009 16:35:56 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MdVPM-0005Ce-1V for emacs-devel@gnu.org; Tue, 18 Aug 2009 16:35:56 -0400 Original-Received: from [199.232.76.173] (port=35649 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MdVPL-0005Cb-Sw for emacs-devel@gnu.org; Tue, 18 Aug 2009 16:35:51 -0400 Original-Received: from proxy1.bredband.net ([195.54.101.71]:51160) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MdVPL-00083X-Fv for emacs-devel@gnu.org; Tue, 18 Aug 2009 16:35:51 -0400 Original-Received: from iph2.telenor.se (195.54.127.133) by proxy1.bredband.net (7.3.140.3) id 49F5A15202D0B78F for emacs-devel@gnu.org; Tue, 18 Aug 2009 22:35:50 +0200 X-SMTPAUTH-B2: joakvero X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AsVkANysikpT44qWPGdsb2JhbACKFpBrAQEBATe9PYQZBYIq X-IronPort-AV: E=Sophos;i="4.43,404,1246831200"; d="scan'208";a="36365871" Original-Received: from ua-83-227-138-150.cust.bredbandsbolaget.se (HELO exodia) ([83.227.138.150]) by iph2.telenor.se with ESMTP; 18 Aug 2009 22:35:50 +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 n7IKZlDW000310 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Tue, 18 Aug 2009 22:35:47 +0200 In-Reply-To: <87praszybe.fsf@stupidchicken.com> (Chong Yidong's message of "Tue, 18 Aug 2009 16:01:09 -0400") 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:114384 Archived-At: Chong Yidong writes: > Stefan Monnier writes: > >>> 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. > > This development would probably have to take place in a separate > branch. I will work in my local git repos, and publish a patch here, much like the imagemagick patch and the xwidget patch. I can switch to bzr whenever that works. The core libmagic lisp api should, however, be rather stand-alone and non-intrusive. Client code such as the image type recognition code can then be ported sucessively. -- Joakim Verona