From 64c0d992e4ca5b820a87b6bcd3efc60cf266d2a4 Mon Sep 17 00:00:00 2001 From: Richard Hansen Date: Sat, 4 Jun 2022 23:25:11 -0400 Subject: [PATCH] Fix documentation of `aset' on strings, `store-substring' * doc/lispref/strings.texi (Modifying Strings): `aref` and `store-substring` automatically convert the string to multibyte if necessary, and support characters with different sized encodings. --- doc/lispref/strings.texi | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/doc/lispref/strings.texi b/doc/lispref/strings.texi index 413e17750e..82bed43e4e 100644 --- a/doc/lispref/strings.texi +++ b/doc/lispref/strings.texi @@ -466,9 +466,11 @@ Modifying Strings The most basic way to alter the contents of an existing string is with @code{aset} (@pxref{Array Functions}). @code{(aset @var{string} @var{idx} @var{char})} stores @var{char} into @var{string} at index -@var{idx}. Each character occupies one or more bytes, and if @var{char} -needs a different number of bytes from the character already present at -that index, @code{aset} signals an error. +@var{idx}. Unibyte strings are converted to multibyte if necessary +(@pxref{Text Representations}). If the size of the internal encoding +of @var{char} differs from that of the character already present at +@var{idx}, the string's representation is adjusted to accommodate the +change. A more powerful function is @code{store-substring}: @@ -478,9 +480,7 @@ Modifying Strings may be either a character or a (smaller) string. Since it is impossible to change the length of an existing string, it is -an error if @var{obj} doesn't fit within @var{string}'s actual length, -or if any new character requires a different number of bytes from the -character currently present at that point in @var{string}. +an error if @var{obj} doesn't fit within @var{string}'s actual length. @end defun To clear out a string that contained a password, use -- 2.36.1