unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Docstring of `decode-coding-string' a bit misleading about insertion in buffer
@ 2008-10-17 14:19 Juanma Barranquero
  2008-10-20  7:04 ` Kenichi Handa
  0 siblings, 1 reply; 13+ messages in thread
From: Juanma Barranquero @ 2008-10-17 14:19 UTC (permalink / raw)
  To: emacs-devel

(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




^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2008-10-22  1:23 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-17 14:19 Docstring of `decode-coding-string' a bit misleading about insertion in buffer Juanma Barranquero
2008-10-20  7:04 ` 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

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).