emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Docstring of `decode-coding-string' a bit misleading about insertion in


From: Juanma Barranquero
Subject: Docstring of `decode-coding-string' a bit misleading about insertion in buffer
Date: Fri, 17 Oct 2008 16:19:25 +0200

(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 via email to

[Prev in Thread] Current Thread [Next in Thread]