From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Stephen J. Turnbull" Newsgroups: gmane.emacs.devel Subject: Re: using libmagic in Emacs? Date: Thu, 20 Aug 2009 13:50:13 +0900 Message-ID: <87bpmb5bsq.fsf@uwakimon.sk.tsukuba.ac.jp> References: <87hbw35mar.fsf@uwakimon.sk.tsukuba.ac.jp> <83zl9vgovc.fsf@gnu.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1250743237 24691 80.91.229.12 (20 Aug 2009 04:40:37 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 20 Aug 2009 04:40:37 +0000 (UTC) Cc: monnier@IRO.UMontreal.CA, joakim@verona.se, emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Aug 20 06:40:30 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 1MdzRs-0005Om-JM for ged-emacs-devel@m.gmane.org; Thu, 20 Aug 2009 06:40:28 +0200 Original-Received: from localhost ([127.0.0.1]:33476 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MdzRs-0004iO-2f for ged-emacs-devel@m.gmane.org; Thu, 20 Aug 2009 00:40:28 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MdzRj-0004fx-JJ for emacs-devel@gnu.org; Thu, 20 Aug 2009 00:40:19 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MdzRe-0004ai-Fh for emacs-devel@gnu.org; Thu, 20 Aug 2009 00:40:18 -0400 Original-Received: from [199.232.76.173] (port=46216 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MdzRe-0004aT-5Y for emacs-devel@gnu.org; Thu, 20 Aug 2009 00:40:14 -0400 Original-Received: from mtps01.sk.tsukuba.ac.jp ([130.158.97.223]:47607) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MdzRb-00069j-EY; Thu, 20 Aug 2009 00:40:11 -0400 Original-Received: from uwakimon.sk.tsukuba.ac.jp (uwakimon.sk.tsukuba.ac.jp [130.158.99.156]) by mtps01.sk.tsukuba.ac.jp (Postfix) with ESMTP id 73E6B1535AC; Thu, 20 Aug 2009 13:40:09 +0900 (JST) Original-Received: by uwakimon.sk.tsukuba.ac.jp (Postfix, from userid 1000) id 3AEC1126E40; Thu, 20 Aug 2009 13:50:13 +0900 (JST) In-Reply-To: <83zl9vgovc.fsf@gnu.org> X-Mailer: VM 8.0.12-devo-585 under 21.5 (beta29) "garbanzo" 891381effa11+ XEmacs Lucid (x86_64-unknown-linux) 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:114430 Archived-At: Eli Zaretskii writes: > > I think the main interface should be just "file-magic", even if it's > > not in file.el. It's analogous to "file-attributes", etc. > > Actually, I think the interface should be `file-type' or some such. Seriously, "file-type" is a terrible, ambiguous name. DOS vs. Unix, the extension of the file's name (!!), what program uses it, text vs. binary, MIME type, endianness of the platform, Unicode vs. legacy coding, copyleft vs. permissive vs. proprietary vs. public domain, I could go on. Sure, it's about "files", but the "type" is what file(1) infers from magic numbers in the file, no more and no less ... and exactly the people you expect to say "huh?" will proceed to guess anything but the truth about the semantics of `file-type'. > Like `file-attributes' that is a wrapper for `stat', the API name > should have a good semantic value, instead of just inheriting the name > of the low-level C functions it uses to do the job. `file-magic' does have a good semantic value. It means "look at the first few bytes of a file and infer various metadata about it, based on a published database of 'magic numbers'." It tells not only the purpose but the exact semantics. I suppose the more explicit `file-type-by-magic' might be better.