From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Juanma Barranquero" Newsgroups: gmane.emacs.devel Subject: Docstring of `decode-coding-string' a bit misleading about insertion in buffer Date: Fri, 17 Oct 2008 16:19:25 +0200 Message-ID: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1224253226 2085 80.91.229.12 (17 Oct 2008 14:20:26 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 17 Oct 2008 14:20:26 +0000 (UTC) To: emacs-devel Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Oct 17 16:21:27 2008 connect(): Connection refused 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 1KqqCd-00010o-7Q for ged-emacs-devel@m.gmane.org; Fri, 17 Oct 2008 16:21:19 +0200 Original-Received: from localhost ([127.0.0.1]:37152 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KqqBY-0005hV-8y for ged-emacs-devel@m.gmane.org; Fri, 17 Oct 2008 10:20:12 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KqqAu-0005Lq-KF for emacs-devel@gnu.org; Fri, 17 Oct 2008 10:19:33 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KqqAo-0005HW-SM for emacs-devel@gnu.org; Fri, 17 Oct 2008 10:19:28 -0400 Original-Received: from [199.232.76.173] (port=42412 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KqqAo-0005HK-4A for emacs-devel@gnu.org; Fri, 17 Oct 2008 10:19:26 -0400 Original-Received: from rn-out-0910.google.com ([64.233.170.184]:50871) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KqqAn-0003iw-Sm for emacs-devel@gnu.org; Fri, 17 Oct 2008 10:19:26 -0400 Original-Received: by rn-out-0910.google.com with SMTP id k32so229815rnd.7 for ; Fri, 17 Oct 2008 07:19:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:mime-version:content-type:content-transfer-encoding :content-disposition; bh=IqIkT5OIc+CruYRMiHf4vaLJkSNohl0fNWJGZaeWKQ4=; b=jT8b9mHajGRaOvgbP9ZRuw+P7sv8EtRfj20v9UTWo6hFQ7I2BE/qK/62nwrgcJGUgT NHT1gqqDKV4h2CqBP/ywcsxtoxkLU+EwlRDb0cJfjYqw5qXgsFkuOOY2/Mzrw+pHDpjt hY16IVIrD4SnHlaQSb7S/Zr7RA38rp3FNIiSc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:mime-version:content-type :content-transfer-encoding:content-disposition; b=f5N0CqPu530Qefc9GI5PQcUOhVNSg/gJHf6cMv+W+u1FBKdtnuyEkFEQrVH1phsHqM Lb8pnceyw3dOquxu2WD81gFOhZbakGiDeC+h9ARvnpcRRgfQy/W8eBktyMSF7klfPXXq SV5ht4qm5ikK5usmF7hQl7aDbb9Bj9mY1u+gk= Original-Received: by 10.100.96.10 with SMTP id t10mr5330659anb.32.1224253165244; Fri, 17 Oct 2008 07:19:25 -0700 (PDT) Original-Received: by 10.100.13.13 with HTTP; Fri, 17 Oct 2008 07:19:25 -0700 (PDT) Content-Disposition: inline X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) 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:104574 Archived-At: (with-temp-buffer (insert "line 1\n") (decode-coding-string "line 2\n" 'cp1252 nil (current-buffer)) (insert "line 3\n") (buffer-string)) => "line 1\nline 3\nline 2\n" That's not a bug, I think, because decode-coding-string's docstring says nothing about the point: Optional fourth arg buffer non-nil means that the decoded text is inserted in buffer instead of returned as a string. In this case, the return value is the length of the decoded text. And I can see how decode-coding-string parallels decode-coding-region, where the decoded text replaces the original text without moving the point. However, the use of "inserted" in the docstring is a bit misleading, as `insert' does move the point. I know that "inserted" here does not mean that `insert' is used, but still it led me astray for a while. Juanma