From: Richard Hansen <rhansen@rhansen.org>
To: 55801@debbugs.gnu.org
Subject: bug#55801: [PATCH] Fix documentation of `aset' on strings, `store-substring'
Date: Sat, 4 Jun 2022 23:30:29 -0400 [thread overview]
Message-ID: <1d60b9cc-c6a5-e42b-7ed0-5ded2dcbab65@rhansen.org> (raw)
[-- Attachment #1.1.1: Type: text/plain, Size: 218 bytes --]
See attached patch:
* 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.
[-- Attachment #1.1.2: 0001-Fix-documentation-of-aset-on-strings-store-substring.patch --]
[-- Type: text/x-patch, Size: 1987 bytes --]
From 64c0d992e4ca5b820a87b6bcd3efc60cf266d2a4 Mon Sep 17 00:00:00 2001
From: Richard Hansen <rhansen@rhansen.org>
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
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next reply other threads:[~2022-06-05 3:30 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-05 3:30 Richard Hansen [this message]
2022-06-05 8:30 ` bug#55801: [PATCH] Fix documentation of `aset' on strings, `store-substring' Eli Zaretskii
2022-06-05 19:22 ` Richard Hansen
2022-06-05 19:27 ` Eli Zaretskii
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1d60b9cc-c6a5-e42b-7ed0-5ded2dcbab65@rhansen.org \
--to=rhansen@rhansen.org \
--cc=55801@debbugs.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 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).