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: Mon, 31 Aug 2009 19:19:59 +0300 Organization: JURTA Message-ID: <8763c40xhm.fsf@mail.jurta.org> References: <87ocqco7fi.fsf@mail.jurta.org> <87y6pb8lqh.fsf@mail.jurta.org> <87my5qngab.fsf@mail.jurta.org> <87eiquuq7j.fsf@mail.jurta.org> <83vdk69evw.fsf@gnu.org> <87tyzovxd7.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 1251737153 29492 80.91.229.12 (31 Aug 2009 16:45:53 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 31 Aug 2009 16:45:53 +0000 (UTC) Cc: Eli Zaretskii , rms@gnu.org, joakim@verona.se, emacs-devel@gnu.org To: Chong Yidong Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Aug 31 18:45:45 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 1MiA0n-0003C7-E0 for ged-emacs-devel@m.gmane.org; Mon, 31 Aug 2009 18:45:45 +0200 Original-Received: from localhost ([127.0.0.1]:56983 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MiA0m-0005AO-Sd for ged-emacs-devel@m.gmane.org; Mon, 31 Aug 2009 12:45:44 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Mi9x4-00033n-QJ for emacs-devel@gnu.org; Mon, 31 Aug 2009 12:41:54 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Mi9x0-00030t-7B for emacs-devel@gnu.org; Mon, 31 Aug 2009 12:41:54 -0400 Original-Received: from [199.232.76.173] (port=35234 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mi9x0-00030l-2D for emacs-devel@gnu.org; Mon, 31 Aug 2009 12:41:50 -0400 Original-Received: from smtp-out2.starman.ee ([85.253.0.4]:50360 helo=mx2.starman.ee) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Mi9ws-00017H-7h; Mon, 31 Aug 2009 12:41:42 -0400 X-Virus-Scanned: by Amavisd-New at mx2.starman.ee Original-Received: from mail.starman.ee (82.131.53.175.cable.starman.ee [82.131.53.175]) by mx2.starman.ee (Postfix) with ESMTP id 810513F4282; Mon, 31 Aug 2009 19:23:31 +0300 (EEST) In-Reply-To: <87tyzovxd7.fsf@stupidchicken.com> (Chong Yidong's message of "Mon, 31 Aug 2009 11:03:48 -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:114910 Archived-At: > No one has yet explained why we shouldn't deal with such failures by > simply fixing Emacs' file detection, instead of relying on libmagic or > file. Given that libmagic/file isn't always going to be present, and > there's no intention of removing our file detection code, why not make > sure the latter works? Sure, we need to support the existing file detection code for the case of absent libmagic/file. This means manually copying necessary parts of the magic database to `magic-fallback-mode-alist', `image-type-header-regexps', `archive-find-type'. > Are there any situations we are inherently incapable of detecting, > and why? One situation is when the number of formats to copy from the magic database is too high, e.g. for all ImageMagick formats. Also the magic database has simple rules for detecting C, Lisp and Perl programs, but these rules are unreliable. Another useful case for libmagic/file is getting MIME types and mailcap commands to run on them as demonstrated by my patch. But it seems this feature is not too important to justify adding libmagic to Emacs instead of running `file'. -- Juri Linkov http://www.jurta.org/emacs/