Received: (at 80256-done) by debbugs.gnu.org; 7 Feb 2026 12:23:29 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sat Feb 07 07:23:29 2026 Received: from localhost ([127.0.0.1]:34035 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1vohLU-0007wv-R3 for submit <at> debbugs.gnu.org; Sat, 07 Feb 2026 07:23:29 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:56864) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1vohLQ-0007wY-GE for 80256-done <at> debbugs.gnu.org; Sat, 07 Feb 2026 07:23:27 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <eliz@HIDDEN>) id 1vohLJ-0005mv-Oz; Sat, 07 Feb 2026 07:23:17 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=ImC3J9QJmkDCiQfvqqjDA/PAgUcN3XEZfx4krmvkvIc=; b=SRBAQRiEAPFe cpMFMIoLnDJ8F74yiWdCxAMcxjdX30+CurjmLGUXF+Dx+iXinqX+tKiw/1Uvg8RHSVR6z9+t/XtNd Twjm8AIGAswYZIv1sSurZzkNULC/ATJIZv9MpbWXrwmnEmhZDMqtWe44JfBdazw18fnVUfVQj1hiz +mlDRkMEAGDEv8hrnrtR0aPQOVA09nC695Twx/9Kynq+clKMYn66woUmwJ7BEl6RMJpSnNjWcxhOV C3DB7J2SppHnKnd4xlXqCob6YAHEbqtNvlPjv45hdu+S5YzyQJhcj3rChqbO5FEXCQmqj2LusoB0g U7iWpZ6nzSAbDUVgsSgcNw==; Date: Sat, 07 Feb 2026 14:23:14 +0200 Message-Id: <86tsvsvj2l.fsf@HIDDEN> From: Eli Zaretskii <eliz@HIDDEN> To: Sean Whitton <spwhitton@HIDDEN> In-Reply-To: <87cy2xlgji.fsf@HIDDEN> (message from Sean Whitton on Sun, 25 Jan 2026 17:59:29 +0000) Subject: Re: bug#80256: 30.2; [PATCH] Add function `string-repeat' References: <2b69ac05b8137abde0b15b48d2bebf43@HIDDEN> <86ikcpeuye.fsf@HIDDEN> <87cy2xlgji.fsf@HIDDEN> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 80256-done Cc: psainty@HIDDEN, 80256-done <at> debbugs.gnu.org, monnier@HIDDEN X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) > From: Sean Whitton <spwhitton@HIDDEN> > Cc: Phil Sainty <psainty@HIDDEN>, Stefan Monnier > <monnier@HIDDEN>, 80256 <at> debbugs.gnu.org > Date: Sun, 25 Jan 2026 17:59:29 +0000 > > Hello, > > Eli Zaretskii [25/Jan 2:30pm +02] wrote: > >> Date: Mon, 26 Jan 2026 01:09:12 +1300 > >> From: Phil Sainty <psainty@HIDDEN> > >> > >> At present we have `make-string' for creating a string that > >> repeats a single character N times, but I don't believe we > >> have an equivalent for repeating an arbitrary string N times. > >> > >> This came up as a Q&A at https://emacs.stackexchange.com/a/84946/454 > >> and I think my answer there provides an efficient implementation > >> and that it seems like a reasonable thing to add: > >> > >> (defun string-repeat (string n) > >> "Return a new string consisting of STRING repeated N times." > >> (cond ((string-equal string "") > >> "") > >> ((eql (length string) 1) > >> (make-string n (aref string 0))) > >> (t > >> (apply #'concat (make-list n string))))) > >> > >> What do you think? > >> > >> If you agree, I'll write the relevant documentation to go with it. > > > > How about showing the example > > > > (apply #'concat (make-list n string)) > > > > in the ELisp manual instead? Because I wonder whether a simple > > one-liner really justifies yet another function that we need to add, > > document, maintain, etc. > > > > Sean, Stefan: WDYT? > > It is something that comes up from time-to-time, but the > (apply #'concat ...) example is elegant and easy to read, so I too would > be in favour of documenting that instead of adding a new function. Now done, and closing the bug.
Phil Sainty <psainty@HIDDEN>:Eli Zaretskii <eliz@HIDDEN>:Received: (at 80256) by debbugs.gnu.org; 25 Jan 2026 17:59:41 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jan 25 12:59:41 2026 Received: from localhost ([127.0.0.1]:54900 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1vk4Oj-0005Cb-11 for submit <at> debbugs.gnu.org; Sun, 25 Jan 2026 12:59:41 -0500 Received: from sendmail.purelymail.com ([34.202.193.197]:48018) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <spwhitton@HIDDEN>) id 1vk4Og-0005CJ-5K for 80256 <at> debbugs.gnu.org; Sun, 25 Jan 2026 12:59:39 -0500 DKIM-Signature: a=rsa-sha256; b=hpvSBME3lajmIYbIclW3KyusDJkLCOCNjGzMZUh3RKULndsp5VTiY6+lRQeb1zx/AVludOy4HE48rwtUsAgdsuiABrRec24ZpoOjaqGgQMyOVrHU0Wf5/LDrM9YTPj9y/Ej6yE7J6YL0WIx6+P4KmKjcquI5JhLEyeCYKRkCbnZzKWpZ2r/GLpIFUcESzABJqM/2y+O4tKri/G5BH5A3dAvGsgl5uIEeAUWdZMdKkzCnFDwEbX3nwC2jHnPwg7eqmy6nO/jVNzfoYPkjOiL8d/jjDkw2Cd0oxYRMwW1e1DPbDmiptI3viUIUKYnypOHD+bZ68YHAEOLd2VZwW48gYg==; s=purelymail1; d=spwhitton.name; v=1; bh=NPRE2zex6WM43BkqpetBxNP3fCUfwrQKcxlRoB6aKTU=; h=Received:Received:From:To:Subject:Date; DKIM-Signature: a=rsa-sha256; b=k+OH9MQSrteP8QLvS7vI1z6JEGzjK2LdhxG6d+CwYgv5eEpwSSKlBVKQs1vFcxicokSVueCYny+uq+95hhR4eNp7ZI932pmPoZlci/yHFDDvKTjDds1Slt7BVf63VolDdSPLXM69aQPJxysQN9rcKEhHEgkyGAZFhob/7zQtG6HCfiB4x1sl32UHr4eaxzirrpYbdSGM/te+RsKhfRio4tOcKtYk/uIFR1W8J1541V6tvwFTo+dia89kpVdhv0TGh/lGmzxaegBQz5SvhCWXpXajvxPePcy9G1cz7JwOrq60sAEahy53TzZV1dOXl9YmtGble3JTbJOLxdbpgKyw4A==; s=purelymail1; d=purelymail.com; v=1; bh=NPRE2zex6WM43BkqpetBxNP3fCUfwrQKcxlRoB6aKTU=; h=Feedback-ID:Received:Received:From:To:Subject:Date; Feedback-ID: 20115:3760:null:purelymail X-Pm-Original-To: 80256 <at> debbugs.gnu.org Received: by smtp.purelymail.com (Purelymail SMTP) with ESMTPSA id 1047435411; (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Sun, 25 Jan 2026 17:59:30 +0000 (UTC) Received: by melete.silentflame.com (Postfix, from userid 1000) id C13DF7E0D85; Sun, 25 Jan 2026 17:59:29 +0000 (GMT) From: Sean Whitton <spwhitton@HIDDEN> To: Eli Zaretskii <eliz@HIDDEN> Subject: Re: bug#80256: 30.2; [PATCH] Add function `string-repeat' In-Reply-To: <86ikcpeuye.fsf@HIDDEN> References: <2b69ac05b8137abde0b15b48d2bebf43@HIDDEN> <86ikcpeuye.fsf@HIDDEN> Date: Sun, 25 Jan 2026 17:59:29 +0000 Message-ID: <87cy2xlgji.fsf@HIDDEN> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -1.0 (-) X-Debbugs-Envelope-To: 80256 Cc: Phil Sainty <psainty@HIDDEN>, 80256 <at> debbugs.gnu.org, Stefan Monnier <monnier@HIDDEN> X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -2.0 (--) Hello, Eli Zaretskii [25/Jan 2:30pm +02] wrote: >> Date: Mon, 26 Jan 2026 01:09:12 +1300 >> From: Phil Sainty <psainty@HIDDEN> >> >> At present we have `make-string' for creating a string that >> repeats a single character N times, but I don't believe we >> have an equivalent for repeating an arbitrary string N times. >> >> This came up as a Q&A at https://emacs.stackexchange.com/a/84946/454 >> and I think my answer there provides an efficient implementation >> and that it seems like a reasonable thing to add: >> >> (defun string-repeat (string n) >> "Return a new string consisting of STRING repeated N times." >> (cond ((string-equal string "") >> "") >> ((eql (length string) 1) >> (make-string n (aref string 0))) >> (t >> (apply #'concat (make-list n string))))) >> >> What do you think? >> >> If you agree, I'll write the relevant documentation to go with it. > > How about showing the example > > (apply #'concat (make-list n string)) > > in the ELisp manual instead? Because I wonder whether a simple > one-liner really justifies yet another function that we need to add, > document, maintain, etc. > > Sean, Stefan: WDYT? It is something that comes up from time-to-time, but the (apply #'concat ...) example is elegant and easy to read, so I too would be in favour of documenting that instead of adding a new function. -- Sean Whitton
bug-gnu-emacs@HIDDEN:bug#80256; Package emacs.
Full text available.Received: (at 80256) by debbugs.gnu.org; 25 Jan 2026 15:37:35 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jan 25 10:37:35 2026 Received: from localhost ([127.0.0.1]:52770 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1vk2BC-00047y-LV for submit <at> debbugs.gnu.org; Sun, 25 Jan 2026 10:37:34 -0500 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:58610) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <monnier@HIDDEN>) id 1vk2B9-00047g-TS for 80256 <at> debbugs.gnu.org; Sun, 25 Jan 2026 10:37:32 -0500 Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 9021181BB1; Sun, 25 Jan 2026 10:37:26 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1769355445; bh=kIFC1ShNLPLnLn42pjX4mNusuOK6u5W8IgkVyEQufkU=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=F9jOWVVcy5QSwnk9kdbKRSNAb+c8xxtavICAZ004DWp7ktkdIE5TTBJ06XIhGyP+g p0wkdDqWGt57xVFTwkCkI8yvbOpysEXKAzgw2L64FVC0bMuddzSi0CVGSeqHX7OXch zQ0czi88PsLC8GGR+qwzZlI+loeqEWvvRUu39mCgQ9FfEhcEoRSjBNQ/kPMJVA3FnX r3DcAymsHfXshU9w/SKYaCzY8OhymJwLlQ/Fc3wq8TGueTnpJaK4H+oCRmV6AWN0UP QB6EmN+45FuUdZhRPPfNAAB/JJj6+Yp7QqmipkowVFy34CVttrA2gTcAt2o/4JJa4r SoWqpwpriVucA== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id CCC2B808F9; Sun, 25 Jan 2026 10:37:25 -0500 (EST) Received: from pastel (104-195-243-38.cpe.teksavvy.com [104.195.243.38]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 86F53120437; Sun, 25 Jan 2026 10:37:25 -0500 (EST) From: Stefan Monnier <monnier@HIDDEN> To: Eli Zaretskii <eliz@HIDDEN> Subject: Re: bug#80256: 30.2; [PATCH] Add function `string-repeat' In-Reply-To: <86ikcpeuye.fsf@HIDDEN> Message-ID: <jwvecndu2ki.fsf-monnier+emacs@HIDDEN> References: <2b69ac05b8137abde0b15b48d2bebf43@HIDDEN> <86ikcpeuye.fsf@HIDDEN> Date: Sun, 25 Jan 2026 10:37:24 -0500 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL -0.135 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 80256 Cc: Phil Sainty <psainty@HIDDEN>, 80256 <at> debbugs.gnu.org, Sean Whitton <spwhitton@HIDDEN> X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) >> At present we have `make-string' for creating a string that >> repeats a single character N times, but I don't believe we >> have an equivalent for repeating an arbitrary string N times. How often have you needed that? > How about showing the example > > (apply #'concat (make-list n string)) > > in the ELisp manual instead? Because I wonder whether a simple > one-liner really justifies yet another function that we need to add, > document, maintain, etc. +1 === Stefan
bug-gnu-emacs@HIDDEN:bug#80256; Package emacs.
Full text available.
Received: (at 80256) by debbugs.gnu.org; 25 Jan 2026 12:55:35 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jan 25 07:55:35 2026
Received: from localhost ([127.0.0.1]:49536 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1vjzeQ-0001pJ-Kc
for submit <at> debbugs.gnu.org; Sun, 25 Jan 2026 07:55:35 -0500
Received: from mta-07-3.privateemail.com ([198.54.118.214]:49354)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.84_2) (envelope-from <basil@HIDDEN>)
id 1vjzeN-0001or-9Q
for 80256 <at> debbugs.gnu.org; Sun, 25 Jan 2026 07:55:32 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=contovou.net;
s=default; t=1769345724;
bh=yee9dGxzeOgn3W4e2l3gNUhCNEUuS19KntfMRTRjkIc=;
h=From:To:Cc:Subject:In-Reply-To:References:Date:From;
b=Y+70KogmSUX/1SMaXnOW3A7N6Kq2RRQa6ForgUQlWDcixoQcx3LKa6tJSUp9ATl+3
1f2KJhRb4eLK5WSKjsD11OlMCOBcBGdI+AVH1BVQIVti7tuv8KIYFhqnY8bwCbO+Jb
vZcIdbbywuMX8OuduWhxSTUvtKSyqS2zNqep99r5j3jLwMw495xXZ3AAbpYfoz1QZj
VWwdqsS1s3fkjJMQLgb25tyCNjQxvB6CcXC4YP0S8YmdP1Jk+QoKMR/QwCoLxY+KkX
icJXYuhsE+qe9LbqhK/Kisl5zWAqoAAfU7yXnm95sUpKG396M8OK3Kg9/8s6OqwIoR
2IicA9EHxzAQA==
Received: from localhost (1F2EF5C1.nat.pool.telekom.hu [31.46.245.193])
by mta-07.privateemail.com (Postfix) with ESMTPA id 4dzWqH1YhVz3hhTD;
Sun, 25 Jan 2026 07:55:23 -0500 (EST)
From: "Basil L. Contovounesios" <basil@HIDDEN>
To: Phil Sainty <psainty@HIDDEN>
Subject: Re: bug#80256: 30.2; [PATCH] Add function `string-repeat'
In-Reply-To: <2b69ac05b8137abde0b15b48d2bebf43@HIDDEN>
References: <2b69ac05b8137abde0b15b48d2bebf43@HIDDEN>
Date: Sun, 25 Jan 2026 13:55:19 +0100
Message-ID: <87pl6xvolk.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 80256
Cc: 80256 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)
Phil Sainty [2026-01-26 01:09 +1300] wrote:
> (defun string-repeat (string n)
> "Return a new string consisting of STRING repeated N times."
> (cond ((string-equal string "")
> "")
> ((eql (length string) 1)
> (make-string n (aref string 0)))
How about preserving the input's multibyteness,
and checking for small N up front? E.g.
(let ((len (length string)))
(cond ((< n 1) "")
((or (= n 1) (= len 0)) string)
((= len 1)
(make-string n (string-to-char string)
(multibyte-string-p string)))
(...)))
--
Basil
bug-gnu-emacs@HIDDEN:bug#80256; Package emacs.
Full text available.Received: (at 80256) by debbugs.gnu.org; 25 Jan 2026 12:30:47 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jan 25 07:30:47 2026 Received: from localhost ([127.0.0.1]:49140 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1vjzGQ-0007pW-T9 for submit <at> debbugs.gnu.org; Sun, 25 Jan 2026 07:30:47 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:58000) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1vjzGN-0007Xw-JP for 80256 <at> debbugs.gnu.org; Sun, 25 Jan 2026 07:30:44 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <eliz@HIDDEN>) id 1vjzGF-0000Mn-3J; Sun, 25 Jan 2026 07:30:37 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=+esO7oO6/kwrv1CgPRYyL/vJ2tMKUiqmX+flXacGglw=; b=NzVlv8xzqAId IxWGbEAfY/2DO9QyOOJX77sdIHloK0gwakUFzXuWt78w89nnHEsxIQkVTpmmyAohADZlR275S/nlr UBrfHWxFsX5HKSPyKqfjYrqXliQWj20JM2rYZh4e8elqH3Mdp0EW5glaV5sJUGTNh6CsYvyuPPLVG aklGeZILPush7tfCCdwPjo0kn3Jwnai50KrlC54qL968QefF92KqEIX0FcQ4mt4aozLVq+5BW41QZ JKQ+V3LsnIj3rG1a/6ivRt/EjRDKPmoWfp8y58qG+90K/I3BCQJ6Dz4cKA6Zri3OfRrljeSJkN3cq EPpdTcfcJuC0Ixp3Kyex5Q==; Date: Sun, 25 Jan 2026 14:30:01 +0200 Message-Id: <86ikcpeuye.fsf@HIDDEN> From: Eli Zaretskii <eliz@HIDDEN> To: Phil Sainty <psainty@HIDDEN>, Sean Whitton <spwhitton@HIDDEN>, Stefan Monnier <monnier@HIDDEN> In-Reply-To: <2b69ac05b8137abde0b15b48d2bebf43@HIDDEN> (message from Phil Sainty on Mon, 26 Jan 2026 01:09:12 +1300) Subject: Re: bug#80256: 30.2; [PATCH] Add function `string-repeat' References: <2b69ac05b8137abde0b15b48d2bebf43@HIDDEN> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 80256 Cc: 80256 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) > Date: Mon, 26 Jan 2026 01:09:12 +1300 > From: Phil Sainty <psainty@HIDDEN> > > At present we have `make-string' for creating a string that > repeats a single character N times, but I don't believe we > have an equivalent for repeating an arbitrary string N times. > > This came up as a Q&A at https://emacs.stackexchange.com/a/84946/454 > and I think my answer there provides an efficient implementation > and that it seems like a reasonable thing to add: > > (defun string-repeat (string n) > "Return a new string consisting of STRING repeated N times." > (cond ((string-equal string "") > "") > ((eql (length string) 1) > (make-string n (aref string 0))) > (t > (apply #'concat (make-list n string))))) > > What do you think? > > If you agree, I'll write the relevant documentation to go with it. How about showing the example (apply #'concat (make-list n string)) in the ELisp manual instead? Because I wonder whether a simple one-liner really justifies yet another function that we need to add, document, maintain, etc. Sean, Stefan: WDYT?
bug-gnu-emacs@HIDDEN:bug#80256; Package emacs.
Full text available.
Received: (at submit) by debbugs.gnu.org; 25 Jan 2026 12:09:55 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jan 25 07:09:55 2026
Received: from localhost ([127.0.0.1]:48759 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1vjywE-0004Vq-4H
for submit <at> debbugs.gnu.org; Sun, 25 Jan 2026 07:09:55 -0500
Received: from lists.gnu.org ([2001:470:142::17]:48220)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.84_2) (envelope-from <psainty@HIDDEN>)
id 1vjyw8-0004Um-WA
for submit <at> debbugs.gnu.org; Sun, 25 Jan 2026 07:09:52 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10])
by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.90_1) (envelope-from <psainty@HIDDEN>)
id 1vjyvf-000531-Uj
for bug-gnu-emacs@HIDDEN; Sun, 25 Jan 2026 07:09:20 -0500
Received: from smtp-2.orcon.net.nz ([60.234.4.43])
by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.90_1) (envelope-from <psainty@HIDDEN>)
id 1vjyvb-0003m8-TY
for bug-gnu-emacs@HIDDEN; Sun, 25 Jan 2026 07:09:19 -0500
Received: from [10.253.37.70] (port=36295 helo=webmail.orcon.net.nz)
by smtp-2.orcon.net.nz with esmtpa (Exim 4.90_1)
(envelope-from <psainty@HIDDEN>) id 1vjyvY-0007Gw-9p
for bug-gnu-emacs@HIDDEN; Mon, 26 Jan 2026 01:09:12 +1300
Received: from ip-116-251-163-208.as55850.net ([116.251.163.208])
via [10.253.37.253] by webmail.orcon.net.nz
with HTTP (HTTP/1.1 POST); Mon, 26 Jan 2026 01:09:12 +1300
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII;
format=flowed
Content-Transfer-Encoding: 7bit
Date: Mon, 26 Jan 2026 01:09:12 +1300
From: Phil Sainty <psainty@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: 30.2; [PATCH] Add function `string-repeat'
Message-ID: <2b69ac05b8137abde0b15b48d2bebf43@HIDDEN>
X-Sender: psainty@HIDDEN
User-Agent: Orcon Webmail
X-GeoIP: --
Received-SPF: pass client-ip=60.234.4.43; envelope-from=psainty@HIDDEN;
helo=smtp-2.orcon.net.nz
X-Spam_score_int: -25
X-Spam_score: -2.6
X-Spam_bar: --
X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, FREEMAIL_FROM=0.001,
RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001,
RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001,
SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 0.7 (/)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.3 (/)
At present we have `make-string' for creating a string that
repeats a single character N times, but I don't believe we
have an equivalent for repeating an arbitrary string N times.
This came up as a Q&A at https://emacs.stackexchange.com/a/84946/454
and I think my answer there provides an efficient implementation
and that it seems like a reasonable thing to add:
(defun string-repeat (string n)
"Return a new string consisting of STRING repeated N times."
(cond ((string-equal string "")
"")
((eql (length string) 1)
(make-string n (aref string 0)))
(t
(apply #'concat (make-list n string)))))
What do you think?
If you agree, I'll write the relevant documentation to go with it.
-Phil
In GNU Emacs 30.2 (build 2, x86_64-pc-linux-gnu, X toolkit, cairo
version 1.16.0, Xaw scroll bars) of 2025-09-02 built on phil-lp
Repository revision: 636f166cfc86aa90d63f592fd99f3fdd9ef95ebd
Repository branch: HEAD
Windowing system distributor 'The X.Org Foundation', version
11.0.12101004
System Description: Ubuntu 22.04.5 LTS
Configured using:
'configure --prefix=/home/phil/emacs/30.x.nc/usr/local
--with-native-compilation=aot --with-x-toolkit=lucid --without-sound
'--program-transform-name=s/^ctags$/ctags_emacs/''
Configured features:
CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
LCMS2 LIBSELINUX LIBXML2 MODULES NATIVE_COMP NOTIFY INOTIFY PDUMPER PNG
RSVG SECCOMP SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS TREE_SITTER WEBP
X11 XDBE XIM XPM LUCID ZLIB
Important settings:
value of $LC_MONETARY: en_NZ.UTF-8
value of $LC_NUMERIC: en_NZ.UTF-8
value of $LC_TIME: en_NZ.UTF-8
value of $LANG: en_GB.UTF-8
value of $XMODIFIERS: @im=ibus
locale-coding-system: utf-8
Major mode: ELisp/d
Minor modes in effect:
outline-minor-mode: t
magit-wip-mode: t
global-git-commit-mode: t
global-window-tool-bar-mode: t
window-tool-bar-mode: t
goto-address-prog-mode: t
lexbind-mode: t
hl-sexp-mode: t
fic-mode: t
elide-head-mode: t
idle-highlight-mode: t
completion-preview-mode: t
magit-auto-revert-mode: t
auto-revert-mode: t
minibuffer-line-mode: t
server-mode: t
savehist-mode: t
global-anzu-mode: t
anzu-mode: t
my-contextual-help-mode: t
global-so-long-mode: t
global-visible-mark-mode: t
visible-mark-mode: t
repeat-mode: t
display-battery-mode: t
my-visible-bell-mode: t
global-display-fill-column-indicator-mode: t
display-fill-column-indicator-mode: t
minibuffer-depth-indicate-mode: t
which-key-mode: t
keep-buffers-mode: t
global-subword-mode: t
subword-mode: t
global-hl-line-mode: t
display-time-mode: t
recentf-mode: t
my-global-keys-local-minor-mode: t
my-keys-local-minor-mode: t
windmove-mode: t
url-handler-mode: t
auto-compile-on-load-mode: t
auto-compile-on-save-mode: t
auto-compile-mode: t
tooltip-mode: t
global-eldoc-mode: t
eldoc-mode: t
show-paren-mode: t
electric-indent-mode: t
mouse-wheel-mode: t
tab-bar-history-mode: t
tab-bar-mode: t
menu-bar-mode: t
file-name-shadow-mode: t
global-font-lock-mode: t
font-lock-mode: t
undelete-frame-mode: t
minibuffer-regexp-mode: t
column-number-mode: t
line-number-mode: t
transient-mark-mode: t
auto-composition-mode: t
auto-encryption-mode: t
auto-compression-mode: t
Load-path shadows:
/home/phil/.emacs.d/el-get/scratch/el-get hides
/home/phil/.emacs.d/el-get/el-get/el-get
/home/phil/.emacs.d/el-get/avy/avy hides
/home/phil/.emacs.d/elpa/avy-0.5.0/avy
/home/phil/.emacs.d/el-get/dash/dash hides
/home/phil/.emacs.d/elpa/dash-2.19.1/dash
/home/phil/.emacs.d/el-get/iedit/iedit hides
/home/phil/.emacs.d/elpa/iedit-0.9.9.9.9/iedit
/home/phil/.emacs.d/my-lisp/psysh hides
/home/phil/.emacs.d/elpa/psysh-0.4.9/psysh
/home/phil/.emacs.d/el-get/transient/lisp/transient hides
/home/phil/emacs/30.x.nc/usr/local/share/emacs/30.2/lisp/transient
/home/phil/.emacs.d/el-get/which-key/which-key hides
/home/phil/emacs/30.x.nc/usr/local/share/emacs/30.2/lisp/which-key
/home/phil/.emacs.d/el-get/compat/compat hides
/home/phil/emacs/30.x.nc/usr/local/share/emacs/30.2/lisp/emacs-lisp/compat
Features:
(shadow sort ecomplete mail-extr project emacsbug noutline outline
info-look whitespace magit-patch ucs-normalize tramp-cache time-stamp
tramp-sh shortdoc hi-lock help-fns winnow tramp trampver
tramp-integration files-x tramp-message tramp-compat xdg parse-time
iso8601 tramp-loaddefs term disp-table ehelp executable jinx
magit-extras face-remap magit-submodule magit-blame magit-stash
magit-reflog magit-bisect magit-push magit-pull magit-fetch magit-clone
magit-remote magit-commit magit-sequence magit-notes magit-worktree
magit-tag magit-merge magit-branch magit-reset magit-files magit-refs
magit-status magit magit-repos magit-apply magit-wip magit-log
which-func imenu magit-diff smerge-mode diff git-commit log-edit message
sendmail yank-media puny rfc822 mml mml-sec epa epg rfc6068 epg-config
gnus-util mm-decode mm-bodies mm-encode mail-parse rfc2231 rfc2047
rfc2045 mm-util ietf-drums mail-prsvr mailabbrev mail-utils gmm-utils
mailheader pcvs-util add-log magit-core magit-margin magit-transient
dired-aux window-tool-bar tab-line adaptive-wrap view mule-util holidays
holiday-loaddefs cal-julian lunar solar cal-dst vc-git diff-mode
track-changes vc-dispatcher autoinsert bug-reference goto-addr
magit-process with-editor shell pcomplete magit-mode transient edmacro
benchmark magit-git magit-base magit-section format-spec cursor-sensor
crm llama cond-let compat appt diary-lib diary-loaddefs cal-menu
calendar cal-loaddefs lexbind-mode hl-sexp fic-mode elide-head
idle-highlight-mode completion-preview sockit magit-autorevert
autorevert filenotify tabify minibuffer-line server derived ibuf-ext
ibuf-macs ibuffer ibuffer-loaddefs my-org my-projects my-session
savehist desktop frameset my-mail my-libraries sudo anzu
my-version-control magit-autoloads my-text my-programming so-long
my-rectangles rect my-utilities browse-kill-ring my-configuration
visible-mark cus-edit pp cus-load dired-details dired-x repeat
highlight-parentheses battery delight delsel ffap thingatpt
display-fill-column-indicator mb-depth which-key easy-mmode keep-buffers
cap-words superword subword hl-line time recentf tree-widget wid-edit
atomic-chrome websocket bindat let-alist my-whitespace ws-trim
my-externals .loaddefs pcase rainbow-mode notify dbus xml mo-git-blame
cl iedit el-get autoload loaddefs-gen radix-tree lisp-mnt dired
dired-loaddefs my-holidays my-local kmacro my-mahara grep tks generic-x
catalyst redshift-indent my-keybindings framemove advice windmove
my-startup-log time-date adaptive-wrap-autoloads company-autoloads
dape-autoloads docker-autoloads dockerfile-mode-autoloads eat-autoloads
eldoc-box-autoloads elfeed-autoloads feature-mode-autoloads
haskell-mode-autoloads helpful-autoloads ...)
Memory information:
((conses 16 837010 197846) (symbols 48 41891 8)
(strings 32 185475 19094) (string-bytes 1 6418909) (vectors 16 73796)
(vector-slots 8 937097 289715) (floats 8 778 9382)
(intervals 56 55014 2845) (buffers 992 34))
Phil Sainty <psainty@HIDDEN>:bug-gnu-emacs@HIDDEN.
Full text available.bug-gnu-emacs@HIDDEN:bug#80256; Package emacs.
Full text available.
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.