all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Juanma Barranquero" <lekktu@gmail.com>
To: emacs-devel <emacs-devel@gnu.org>
Subject: Docstring of `decode-coding-string' a bit misleading about insertion in buffer
Date: Fri, 17 Oct 2008 16:19:25 +0200	[thread overview]
Message-ID: <f7ccd24b0810170719k3d743191na6c059938cf59c2@mail.gmail.com> (raw)

(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




             reply	other threads:[~2008-10-17 14:19 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-17 14:19 Juanma Barranquero [this message]
2008-10-20  7:04 ` Docstring of `decode-coding-string' a bit misleading about insertion in buffer Kenichi Handa
2008-10-20  7:18   ` Juanma Barranquero
2008-10-20  8:12     ` Kenichi Handa
2008-10-20  8:21       ` Juanma Barranquero
2008-10-20 10:43         ` Kenichi Handa
2008-10-21 15:57           ` Eli Zaretskii
2008-10-21 22:47             ` Juanma Barranquero
2008-10-22  1:23             ` Kenichi Handa
2008-10-20 17:04         ` Richard M. Stallman
2008-10-21  2:53           ` Kenichi Handa
2008-10-21 19:40             ` Richard M. Stallman
2008-10-20 17:04         ` Richard M. Stallman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f7ccd24b0810170719k3d743191na6c059938cf59c2@mail.gmail.com \
    --to=lekktu@gmail.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.