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 17:11:02 -0400 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 1250629884 15177 80.91.229.12 (18 Aug 2009 21:11:24 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 18 Aug 2009 21:11:24 +0000 (UTC) Cc: Chong Yidong , Emacs Development To: joakim@verona.se Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Aug 18 23:11:16 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 1MdVxc-0007sR-Ir for ged-emacs-devel@m.gmane.org; Tue, 18 Aug 2009 23:11:16 +0200 Original-Received: from localhost ([127.0.0.1]:54701 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MdVxc-0007SB-0X for ged-emacs-devel@m.gmane.org; Tue, 18 Aug 2009 17:11:16 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MdVxW-0007P9-RN for emacs-devel@gnu.org; Tue, 18 Aug 2009 17:11:10 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MdVxQ-0007H4-Vr for emacs-devel@gnu.org; Tue, 18 Aug 2009 17:11:09 -0400 Original-Received: from [199.232.76.173] (port=49853 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MdVxQ-0007Gs-Se for emacs-devel@gnu.org; Tue, 18 Aug 2009 17:11:04 -0400 Original-Received: from pruche.dit.umontreal.ca ([132.204.246.22]:38261) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MdVxQ-0004v9-He for emacs-devel@gnu.org; Tue, 18 Aug 2009 17:11:04 -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 n7ILB2kF007469; Tue, 18 Aug 2009 17:11:03 -0400 Original-Received: by faina.iro.umontreal.ca (Postfix, from userid 20848) id D6ED03A0F6; Tue, 18 Aug 2009 17:11:02 -0400 (EDT) In-Reply-To: (joakim@verona.se's message of "Tue, 18 Aug 2009 22:35:47 +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:114385 Archived-At: >>>> 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 don't expect it to be too intrusive, so I think it can be done on the trunk, tho of course, each step needs to be planned with care. > 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. That's fine as well. > 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. I think it's OK to install the code in CVS as soon as the Lisp API to libmagic is ready. Once that is done, we can decide which next steps to take. Stefan