From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.devel Subject: Re: using libmagic in Emacs? Date: Wed, 19 Aug 2009 03:57:21 +0300 Organization: JURTA Message-ID: <87ocqco7fi.fsf@mail.jurta.org> References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1250650084 29393 80.91.229.12 (19 Aug 2009 02:48:04 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 19 Aug 2009 02:48:04 +0000 (UTC) Cc: joakim@verona.se, Emacs Development To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Aug 19 04:47:56 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 1MdbDQ-0005Tf-35 for ged-emacs-devel@m.gmane.org; Wed, 19 Aug 2009 04:47:56 +0200 Original-Received: from localhost ([127.0.0.1]:37991 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MdbDP-00063L-H5 for ged-emacs-devel@m.gmane.org; Tue, 18 Aug 2009 22:47:55 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Mdb7c-0004I4-Dm for emacs-devel@gnu.org; Tue, 18 Aug 2009 22:41:56 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Mdb7X-0004Fy-0Z for emacs-devel@gnu.org; Tue, 18 Aug 2009 22:41:55 -0400 Original-Received: from [199.232.76.173] (port=37903 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mdb7W-0004Fr-Sf for emacs-devel@gnu.org; Tue, 18 Aug 2009 22:41:50 -0400 Original-Received: from smtp-out2.starman.ee ([85.253.0.4]:48591 helo=mx2.starman.ee) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Mdb7W-00057L-6o for emacs-devel@gnu.org; Tue, 18 Aug 2009 22:41:50 -0400 X-Virus-Scanned: by Amavisd-New at mx2.starman.ee Original-Received: from mail.starman.ee (82.131.55.87.cable.starman.ee [82.131.55.87]) by mx2.starman.ee (Postfix) with ESMTP id A30243F409F; Wed, 19 Aug 2009 05:41:42 +0300 (EEST) In-Reply-To: (Stefan Monnier's message of "Tue, 18 Aug 2009 15:23:06 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (x86_64-pc-linux-gnu) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) 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:114388 Archived-At: >> 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. image.el doesn't recognize some rare JPEG formats, so libmagic will be useful here. >> Also, I often whish that files would open in Emacs with correct mode >> more often when there is no file extension. libmagick could supplement `magic-mode-alist' and `magic-fallback-mode-alist'. > 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. gnus/mailcap.el contains a table mapping MIME-types to major modes. -- Juri Linkov http://www.jurta.org/emacs/