unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: "Mattias Engdegård" <mattiase@acm.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 42296@debbugs.gnu.org
Subject: bug#42296: 27.0.91; Correct manual entry for 'concat' w.r.t. allocation [PATCH]
Date: Thu, 9 Jul 2020 19:56:59 +0200	[thread overview]
Message-ID: <669987BB-B825-4C2C-B9FD-31F04E0D6013@acm.org> (raw)
In-Reply-To: <83wo3cppc5.fsf@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 359 bytes --]

9 juli 2020 kl. 19.31 skrev Eli Zaretskii <eliz@gnu.org>:

> This loses too much useful information, IMO.  Let's please say that
> the result is sometimes ("frequently"?), but not always, a new string,
> and that programs should not rely on that aspect.

Here is a new version that adds this information, and recommends copy-sequence for mutability.


[-- Attachment #2: 0001-Correct-concat-manual-entry.patch --]
[-- Type: application/octet-stream, Size: 1768 bytes --]

From 4fcd3b13509ab94ddd552d3478c7c3cd9fe95279 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Mattias=20Engdeg=C3=A5rd?= <mattiase@acm.org>
Date: Thu, 9 Jul 2020 17:32:13 +0200
Subject: [PATCH] Correct 'concat' manual entry

* 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).
---
 doc/lispref/strings.texi | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/doc/lispref/strings.texi b/doc/lispref/strings.texi
index 2ef88b9025..455f3efc27 100644
--- a/doc/lispref/strings.texi
+++ b/doc/lispref/strings.texi
@@ -248,7 +248,7 @@ Creating Strings
 @defun concat &rest sequences
 @cindex copying 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 may be strings, lists of numbers, or vectors of numbers; they
 are not themselves changed.  If @code{concat} receives no arguments, it
@@ -269,9 +269,9 @@ Creating Strings
 @end example
 
 @noindent
-This function always constructs a new string that is not @code{eq} to
-any existing string, except when the result is the empty string (to
-save space, Emacs makes only one empty multibyte string).
+The returned string cannot be relied upon to be unique or newly
+allocated; it should be considered immutable.  Use
+@code{copy-sequence} on the result if a mutable string is needed.
 
 For information about other concatenation functions, see the
 description of @code{mapconcat} in @ref{Mapping Functions},
-- 
2.21.1 (Apple Git-122.3)


  reply	other threads:[~2020-07-09 17:56 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-09 15:54 bug#42296: 27.0.91; Correct manual entry for 'concat' w.r.t. allocation [PATCH] Mattias Engdegård
2020-07-09 17:31 ` Eli Zaretskii
2020-07-09 17:56   ` Mattias Engdegård [this message]
2020-07-09 18:51     ` Eli Zaretskii
2020-07-09 19:17       ` Mattias Engdegård
2020-07-09 19:24         ` Eli Zaretskii
2020-07-10 17:04           ` Mattias Engdegård
2020-07-10 18:08             ` Eli Zaretskii
2020-07-11 11:15               ` Mattias Engdegård
2020-07-11 11:52                 ` Eli Zaretskii
2020-07-11 12:51                   ` Mattias Engdegård
2020-07-11 13:07                     ` Eli Zaretskii
2020-07-11 13:16                       ` Mattias Engdegård
2020-07-11 13:37                         ` Eli Zaretskii
2020-07-11 13:47                           ` Mattias Engdegård
2020-07-11 16:17                       ` Drew Adams
2020-07-12  3:03                       ` Richard Stallman
2020-07-09 19:20       ` 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=669987BB-B825-4C2C-B9FD-31F04E0D6013@acm.org \
    --to=mattiase@acm.org \
    --cc=42296@debbugs.gnu.org \
    --cc=eliz@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).