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: Mon, 24 Aug 2009 09:33:33 +0200 Message-ID: References: <87ocqco7fi.fsf@mail.jurta.org> <87y6pb8lqh.fsf@mail.jurta.org> <87my5qngab.fsf@mail.jurta.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1251099318 20940 80.91.229.12 (24 Aug 2009 07:35:18 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 24 Aug 2009 07:35:18 +0000 (UTC) Cc: emacs-devel@gnu.org, rms@gnu.org, monnier@IRO.UMontreal.CA To: Juri Linkov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Aug 24 09:35:10 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 1MfU54-0004dz-Mx for ged-emacs-devel@m.gmane.org; Mon, 24 Aug 2009 09:35:09 +0200 Original-Received: from localhost ([127.0.0.1]:34684 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MfU52-00074Z-S6 for ged-emacs-devel@m.gmane.org; Mon, 24 Aug 2009 03:35:04 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MfU4B-0006z1-9q for emacs-devel@gnu.org; Mon, 24 Aug 2009 03:34:11 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MfU45-0006yZ-74 for emacs-devel@gnu.org; Mon, 24 Aug 2009 03:34:10 -0400 Original-Received: from [199.232.76.173] (port=42453 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MfU44-0006yV-Vt for emacs-devel@gnu.org; Mon, 24 Aug 2009 03:34:05 -0400 Original-Received: from mx20.gnu.org ([199.232.41.8]:50484) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MfU3v-0004L0-67; Mon, 24 Aug 2009 03:33:57 -0400 Original-Received: from iwfs.imcode.com ([82.115.149.64] helo=gate.verona.se) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MfU3o-0001yj-S7; Mon, 24 Aug 2009 03:33:49 -0400 Original-Received: from localhost.localdomain (IDENT:1005@localhost [127.0.0.1]) by gate.verona.se (8.13.4/8.11.4) with ESMTP id n7O7XZtw029800; Mon, 24 Aug 2009 09:33:36 +0200 In-Reply-To: <87my5qngab.fsf@mail.jurta.org> (Juri Linkov's message of "Mon, 24 Aug 2009 03:17:18 +0300") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux) X-Detected-Operating-System: by mx20.gnu.org: GNU/Linux 2.4-2.6 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:114552 Archived-At: Juri Linkov writes: > > Of course, before adding code to link with libmagic we should analyze > how useful it would be. I see its usefulness at least in the following > areas: > > 1. Archive file types ... > > We can't track and add all new formats. This is the main task of libmagic. > > 2. Image file types > > Using ImageMagick in Emacs can support over 100 image file formats. > It won't possible to recognize all them without libmagic. > > 3. MIME-types handling > > Emacs can process different MIME-type detected by libmagic. > Even when Emacs has no special handling for a file type, it is > still useful to let Emacs run an external program associated > with its MIME-type for users who prefer running programs > (including GUI programs) from Emacs instead of using a window > manager's application menu. I agree completely with Juri, it is these two cases that motivates me to work on the libmagic support. There are a great deal of formats Emacs is able to open, but not to recognize, such as all the many different Java archive formats Juri mentions. There are compressed image formats like SVG. Also, if we decide to merge the imagemagick patch, hundreds of new image file formats will be supported, that libmagic will help identify. Notice that I do not propose to replace Emacs current file recognition, only to expand it when libmagic is available. We can also expand a bit of the current handling to take care of a few well known cases, such as the jpeg one. If no libmagic, then Emacs will behave as today, or slightly better. If libmagic, many new file formats will open correctly. I honestly cant see any drawbacks with this aproach, other than me consuming some list resources while developing the patch. I hope to be able to reciprocate with improved documentation for developing Emacs primitives. Lets also not forget the friendly competition from other free text editors. Emacs IMHO does the right thing with files more often than other editors, lets improve on this strength! -- Joakim Verona