1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-17 11:20:39 -08:00

Correct 'concat' manual entry (bug#42296)

* doc/lispref/strings.texi (Creating Strings): 'concat' does not
necessarily return a newly allocated string.  This has been the case
at least since 1997 (Emacs 20.3).
This commit is contained in:
Mattias Engdegård 2020-07-09 17:32:13 +02:00
parent b1ad0380d2
commit bdf716bba1

View file

@ -248,7 +248,7 @@ properties removed.
@defun concat &rest sequences @defun concat &rest sequences
@cindex copying strings @cindex copying strings
@cindex concatenating strings @cindex concatenating strings
This function returns a new string consisting of the characters in the This function returns a string consisting of the characters in the
arguments passed to it (along with their text properties, if any). The arguments passed to it (along with their text properties, if any). The
arguments may be strings, lists of numbers, or vectors of numbers; they arguments may be strings, lists of numbers, or vectors of numbers; they
are not themselves changed. If @code{concat} receives no arguments, it are not themselves changed. If @code{concat} receives no arguments, it
@ -269,9 +269,14 @@ returns an empty string.
@end example @end example
@noindent @noindent
This function always constructs a new string that is not @code{eq} to This function does not always allocate a new string. Callers are
any existing string, except when the result is the empty string (to advised not rely on the result being a new string nor on it being
save space, Emacs makes only one empty multibyte string). @code{eq} to an existing string.
In particular, mutating the returned value may inadvertently change
another string, alter a constant string in the program, or even raise
an error. To obtain a string that you can safely mutate, use
@code{copy-sequence} on the result.
For information about other concatenation functions, see the For information about other concatenation functions, see the
description of @code{mapconcat} in @ref{Mapping Functions}, description of @code{mapconcat} in @ref{Mapping Functions},