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: Fri, 21 Aug 2009 15:18:33 -0400 Message-ID: References: <83k50xh1m8.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 1250882335 32357 80.91.229.12 (21 Aug 2009 19:18:55 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 21 Aug 2009 19:18:55 +0000 (UTC) Cc: schwab@linux-m68k.org, joakim@verona.se, emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Aug 21 21:18:48 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 1MeZdP-0000XX-Di for ged-emacs-devel@m.gmane.org; Fri, 21 Aug 2009 21:18:48 +0200 Original-Received: from localhost ([127.0.0.1]:39348 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MeZdO-0005yf-G3 for ged-emacs-devel@m.gmane.org; Fri, 21 Aug 2009 15:18:46 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MeZdJ-0005ww-AW for emacs-devel@gnu.org; Fri, 21 Aug 2009 15:18:41 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MeZdD-0005pc-Re for emacs-devel@gnu.org; Fri, 21 Aug 2009 15:18:40 -0400 Original-Received: from [199.232.76.173] (port=38638 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MeZdD-0005pH-Ma for emacs-devel@gnu.org; Fri, 21 Aug 2009 15:18:35 -0400 Original-Received: from ironport2-out.pppoe.ca ([206.248.154.182]:20392 helo=ironport2-out.teksavvy.com) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MeZdC-0002V7-Fv; Fri, 21 Aug 2009 15:18:34 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AqIEAE+PjkpFxIrq/2dsb2JhbACBU9UshBoFh1Y X-IronPort-AV: E=Sophos;i="4.44,252,1249272000"; d="scan'208";a="43940448" Original-Received: from 69-196-138-234.dsl.teksavvy.com (HELO pastel.home) ([69.196.138.234]) by ironport2-out.teksavvy.com with ESMTP; 21 Aug 2009 15:17:52 -0400 Original-Received: by pastel.home (Postfix, from userid 20848) id 39BA37F36; Fri, 21 Aug 2009 15:18:33 -0400 (EDT) In-Reply-To: <83k50xh1m8.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 21 Aug 2009 14:01:35 +0300") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux) X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. 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:114493 Archived-At: >> + magic_setflags (cookie, MAGIC_MIME_ENCODING | MAGIC_ERROR); >> + rvs=magic_file (cookie, f); >> + if (rvs == NULL) goto libmagic_error; >> + Lisp_Object file_encoding = intern(rvs); > Is file_encoding supposed to be a valid encoding, one of those for > which Emacs has a coding-system? If so, perhaps you should make sure > you indeed return a valid coding-system or its alias, or otherwise > tell in the doc string that it's not guaranteed to be valid (so that > the caller should validate it before using). The simplest route is to return a string rather than a symbol. That should clearly convey the idea that this may or may not be a valid coding-system. Stefan