From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#17865: 24.3.92; encode-coding-string returns 1 Date: Sat, 28 Jun 2014 10:00:40 +0300 Message-ID: <83d2dt7c2v.fsf@gnu.org> References: <83lhsi6reh.fsf@gnu.org> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1403938949 26793 80.91.229.3 (28 Jun 2014 07:02:29 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 28 Jun 2014 07:02:29 +0000 (UTC) Cc: 17865@debbugs.gnu.org To: Leo Liu Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Jun 28 09:02:18 2014 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1X0meQ-00076J-0X for geb-bug-gnu-emacs@m.gmane.org; Sat, 28 Jun 2014 09:02:18 +0200 Original-Received: from localhost ([::1]:53756 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X0meP-000666-3W for geb-bug-gnu-emacs@m.gmane.org; Sat, 28 Jun 2014 03:02:17 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:47772) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X0meG-00064x-It for bug-gnu-emacs@gnu.org; Sat, 28 Jun 2014 03:02:14 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X0meA-0001ej-Lu for bug-gnu-emacs@gnu.org; Sat, 28 Jun 2014 03:02:08 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:44497) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X0meA-0001ec-Iv for bug-gnu-emacs@gnu.org; Sat, 28 Jun 2014 03:02:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1X0meA-0006hi-1S for bug-gnu-emacs@gnu.org; Sat, 28 Jun 2014 03:02:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 28 Jun 2014 07:02:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 17865 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 17865-submit@debbugs.gnu.org id=B17865.140393886225679 (code B ref 17865); Sat, 28 Jun 2014 07:02:01 +0000 Original-Received: (at 17865) by debbugs.gnu.org; 28 Jun 2014 07:01:02 +0000 Original-Received: from localhost ([127.0.0.1]:35646 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1X0mdB-0006fj-GL for submit@debbugs.gnu.org; Sat, 28 Jun 2014 03:01:02 -0400 Original-Received: from mtaout20.012.net.il ([80.179.55.166]:43229) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1X0md8-0006fN-6y for 17865@debbugs.gnu.org; Sat, 28 Jun 2014 03:00:59 -0400 Original-Received: from conversion-daemon.a-mtaout20.012.net.il by a-mtaout20.012.net.il (HyperSendmail v2007.08) id <0N7V009009E3SB00@a-mtaout20.012.net.il> for 17865@debbugs.gnu.org; Sat, 28 Jun 2014 10:00:51 +0300 (IDT) Original-Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout20.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0N7V0096HA5FK990@a-mtaout20.012.net.il>; Sat, 28 Jun 2014 10:00:51 +0300 (IDT) In-reply-to: X-012-Sender: halo1@inter.net.il X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:90931 Archived-At: > From: Leo Liu > Cc: 17865@debbugs.gnu.org > Date: Sat, 28 Jun 2014 07:56:53 +0800 > > On 2014-06-27 23:15 +0300, Eli Zaretskii wrote: > > Not a bug: you inserted one character. > > But without `(set-buffer-multibyte nil)' you get 3. Normal? Yes, because then you insert 3 multibyte characters that represent 3 8-bit bytes. The value you get counts characters produced by the encoding. How to count characters in a unibyte buffer is a question that has no easy answers. If, after all this, you will conclude that the return value is not very useful for high-level programming, I will agree with you. The return value is set up to provide what some internal use cases need, and that's it. It just returns some member of the structure used to convert the string; how that member is computed is an implementation detail that rarely, if at all, is exposed to Lisp applications. It could be that the return value of 1 in a unibyte buffer was never bumped into before, and thus never scrutinized. It could also be that some Lisp application actually needs that value to be 1. What is the real-life use case behind this? Maybe if we talk in the context of that use case, the discussion will be more meaningful.