From unknown Sat Aug 16 12:45:29 2025 X-Loop: help-debbugs@gnu.org Subject: bug#51292: 27.2; Reversing strings with unicode combining characters Resent-From: Howard Melman Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 19 Oct 2021 19:17:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 51292 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 51292@debbugs.gnu.org X-Debbugs-Original-To: GNU Emacs Received: via spool by submit@debbugs.gnu.org id=B.163467099422762 (code B ref -1); Tue, 19 Oct 2021 19:17:02 +0000 Received: (at submit) by debbugs.gnu.org; 19 Oct 2021 19:16:34 +0000 Received: from localhost ([127.0.0.1]:52031 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mcubC-0005v3-EQ for submit@debbugs.gnu.org; Tue, 19 Oct 2021 15:16:34 -0400 Received: from lists.gnu.org ([209.51.188.17]:53306) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mcubB-0005ux-H6 for submit@debbugs.gnu.org; Tue, 19 Oct 2021 15:16:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52278) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcubB-0001W7-CY for bug-gnu-emacs@gnu.org; Tue, 19 Oct 2021 15:16:33 -0400 Received: from mail-qk1-x72e.google.com ([2607:f8b0:4864:20::72e]:35404) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mcub9-0007nY-7A for bug-gnu-emacs@gnu.org; Tue, 19 Oct 2021 15:16:33 -0400 Received: by mail-qk1-x72e.google.com with SMTP id bj31so989190qkb.2 for ; Tue, 19 Oct 2021 12:16:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:content-transfer-encoding:mime-version:subject:message-id:date :to; bh=CgfEGIDMvY10n6XneaTG1oLgoL5en/bai/9PLBz2Ew4=; b=P0W/j2Q91Zr9l6rbtOpteqEjCYadW0TQsqtv9G1rqA1dntZUUmE+uF/hv9yLcR/cBB f97eZNGnbb9S4u7jYQASWjzHCpVIKuIWvQ3VoWS9q4xzkxpKkjLU3mGYucNyY5p0lDxn 3h2ZAFTpDi0yHj3CKpbNHAL4bNiEdA0ASyuw82Nwywzbnim41tPiK/DU19/Hl3r8a4Kc qbpGuM1V7+wAojYxaUby8KDVkLMlVl0Eb1kDuISBgjAt8RT8w+5+NJxDpywhE2p9hHII PmEc5L0+2DwhQpWt1i3xTcbLS2AUIBrBde5NQDovhPviycrukYkn2ry7gS07n5hHnWfT Wy+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:content-transfer-encoding:mime-version :subject:message-id:date:to; bh=CgfEGIDMvY10n6XneaTG1oLgoL5en/bai/9PLBz2Ew4=; b=KwFyVxnitxDlTCU/0ESAldxbxpgmLBhBEh0qvjfVQjldkZDoIuw2GtDxVqJc8ORikT iGWrCT+dTbh8A0ZhkNhFoDsFvw0k9BXkc2MLwWrP36NhbB5oBSXXqwjbSHHVzd1IXIYk 5q7Ghv5hdRuIlCgMys73m5nwr/NFiKMKW5ReaiucihY1mcJ6eweCkpXPpCoIwNT8x9j9 XHJJrLQFib5SaEMHUmHg+o6N/1H38XCNSZxsa/Dc7F+qumMdWgoZXXkhR6nB/SJbj1Df yDPwHhSnGzGjqS1mSHDcvj7mzeB9eQAY1XKDgS50ZTd+BwQDNQmTOTyFRfqtd0cJSsVU Hsqg== X-Gm-Message-State: AOAM530zy3RkvP+LYqG/pkmrs68pO9SBeUgd5VApWjSSXKlqVn0s+EiF DrBJKu+c3kodJ0usFzcGFZnuT5oxk4P2fA== X-Google-Smtp-Source: ABdhPJyrUkmbDL5cA6NnZLoocGKmPuDclVuTqEWGmRv+MAmlo9D9DJz8+PRe5TOYxmbTuLKinQhIpg== X-Received: by 2002:a05:620a:7c6:: with SMTP id 6mr1643993qkb.218.1634670988520; Tue, 19 Oct 2021 12:16:28 -0700 (PDT) Received: from smtpclient.apple (pool-108-26-204-101.bstnma.fios.verizon.net. [108.26.204.101]) by smtp.gmail.com with ESMTPSA id c19sm8169406qkj.132.2021.10.19.12.16.28 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 19 Oct 2021 12:16:28 -0700 (PDT) From: Howard Melman Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.13\)) Message-Id: <2AC0A88D-4F2F-41A5-B945-8BB55260C0E8@gmail.com> Date: Tue, 19 Oct 2021 15:16:27 -0400 X-Mailer: Apple Mail (2.3654.120.0.1.13) Received-SPF: pass client-ip=2607:f8b0:4864:20::72e; envelope-from=hmelman@gmail.com; helo=mail-qk1-x72e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.3 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) Reversing a string fails to account for unicode combining characters (reverse "nai\u0308ve") "ev=CC=88ian" Note the diaeresis is now on the v and not the i. s-reverse gets it = right: (s-reverse "nai\u0308ve") "evi=CC=88an" I tried on both: GNU Emacs 27.2 (build 1, x86_64-apple-darwin18.7.0, Carbon Version 158 = AppKit 1671.6) of 2021-03-27 GNU Emacs 27.1 (build 1, x86_64-apple-darwin18.7.0, NS appkit-1671.60 = Version 10.14.6 (Build 18G95)) of 2020-08-12 --=20 Howard From unknown Sat Aug 16 12:45:29 2025 X-Loop: help-debbugs@gnu.org Subject: bug#51292: 27.2; Reversing strings with unicode combining characters Resent-From: Lars Ingebrigtsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 19 Oct 2021 19:27:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 51292 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Howard Melman Cc: 51292@debbugs.gnu.org Received: via spool by 51292-submit@debbugs.gnu.org id=B51292.163467160323714 (code B ref 51292); Tue, 19 Oct 2021 19:27:02 +0000 Received: (at 51292) by debbugs.gnu.org; 19 Oct 2021 19:26:43 +0000 Received: from localhost ([127.0.0.1]:52045 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mcul0-0006AQ-Pv for submit@debbugs.gnu.org; Tue, 19 Oct 2021 15:26:42 -0400 Received: from quimby.gnus.org ([95.216.78.240]:38604) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mcukz-0006AC-0M for 51292@debbugs.gnu.org; Tue, 19 Oct 2021 15:26:41 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Message-ID :In-Reply-To:Date:References:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=xcD96/l08IXSr+QpXXVwsRCVItk6e98e+RT14zcvjRM=; b=DLKogdkERLj+oPim3II6RChMEz eZRcYrVulFTG7rayxyRJXsXbenS72U0iSHnB2jOLE+GXKuNujheve4jZUhdKSf9SkkWcyDCNditi1 021zcaOXJyi2ie2uClDIa3NJXvLcnU5UBxwyq7D0CPJK9LGbRrpuioXJNBtut46MjtKU=; Received: from [84.212.220.105] (helo=elva) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mcukp-0000Kp-SJ; Tue, 19 Oct 2021 21:26:34 +0200 From: Lars Ingebrigtsen References: <2AC0A88D-4F2F-41A5-B945-8BB55260C0E8@gmail.com> Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwAgMAAAAqbBEUAAAABGdBTUEAALGPC/xhBQAAACBj SFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAADFBMVEXJtobs1Zp1aE// //9M4vXjAAAAAWJLR0QDEQxM8gAAAAd0SU1FB+UKExMZCX79zNQAAAGwSURBVCjPVdLNitswEADg kbHL1qc4aELJqV26JdVTJCGFRKdYSGLxqe1p8VPExoZlT9sS99BTHGKQ5ikrt2V/5qRPg2YEM5CY p9CAzzAvoeHpFvYa/r7hg5lwOkGyqUzx5iCIyEMia3O3sOE8D9gCFy4k7osRi5jGuIQM3Lma6EzU Sw+xPPwidhTUlyGT1jO66ct/oLom3Kb+Q0BK0ZwSmzYq8iAdU+QofcBQOu3xvZPkZKY8RD0uQFC7 NQHpZXK+Jwe3+aeADluFBO+q7wE/GNOGfb1KQoFy2HTGrq4Fhr8JF6PhOyUK2UPpY9R8okgWfegz 8M9GWZqrI8TNJSZjI6emHbCPTUwTm7qi7iA5V5oyPXO3J4T492Ap2Uyd6huI5oOk1q5d4TcAxYh9 FLAcUQZklepzgLItqeF7sEMOb0UnqOPTx9lNDrvrjqhlP4+c5fCtCEhwxvlVDkvZElUcYw4ZrMrm gQ5fcMMxgx02gi4tcs5WsLPjoKqEc4cg05MIAzxl1hlY0omcboWXXsOaaPZoG+HH0a/JK9CQnlED MMzx/67sX2wI6tfr8grsGfs/fFvGWKicQyIAAAAldEVYdGRhdGU6Y3JlYXRlADIwMjEtMTAtMTlU MTk6MjU6MDkrMDA6MDAVSSAhAAAAJXRFWHRkYXRlOm1vZGlmeQAyMDIxLTEwLTE5VDE5OjI1OjA5 KzAwOjAwZBSYnQAAAABJRU5ErkJggg== X-Now-Playing: Flux of Pink Indians's _The Fucking Cunts Treat Us Like Pricks_: "Mickey on Tuneoil" Date: Tue, 19 Oct 2021 21:26:31 +0200 In-Reply-To: <2AC0A88D-4F2F-41A5-B945-8BB55260C0E8@gmail.com> (Howard Melman's message of "Tue, 19 Oct 2021 15:16:27 -0400") Message-ID: <87fsswbyu0.fsf@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: Howard Melman writes: > Reversing a string fails to account for unicode combining characters > > (reverse "nai\u0308ve") > "=?UTF-8?Q?ev=CC=88ian?=" > > Note the diaeresis is now on the v and not the i. s-reverse gets it right: > > (s-rev [...] Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Howard Melman writes: > Reversing a string fails to account for unicode combining characters > > (reverse "nai\u0308ve") > "ev=CC=88ian" > > Note the diaeresis is now on the v and not the i. s-reverse gets it righ= t: > > (s-reverse "nai\u0308ve") > "evi=CC=88an" So I wondered what s-reverse did, and indeed: (defun s-reverse (s) "Return the reverse of S." (declare (pure t) (side-effect-free t)) (save-match-data (if (multibyte-string-p s) (let ((input (string-to-list s)) output) (require 'ucs-normalize) (while input ;; Handle entire grapheme cluster as a single unit (let ((grapheme (list (pop input)))) (while (memql (car input) ucs-normalize-combining-chars) (push (pop input) grapheme)) (setq output (nconc (nreverse grapheme) output)))) (concat output)) (concat (nreverse (string-to-list s)))))) Emacs has string-reverse, obsolete since 25.1. Perhaps we should reintroduce it and use the definition from s? --=20 (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From unknown Sat Aug 16 12:45:29 2025 X-Loop: help-debbugs@gnu.org Subject: bug#51292: 27.2; Reversing strings with unicode combining characters Resent-From: Lars Ingebrigtsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 19 Oct 2021 20:51:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 51292 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Howard Melman Cc: 51292@debbugs.gnu.org Received: via spool by 51292-submit@debbugs.gnu.org id=B51292.16346766297501 (code B ref 51292); Tue, 19 Oct 2021 20:51:01 +0000 Received: (at 51292) by debbugs.gnu.org; 19 Oct 2021 20:50:29 +0000 Received: from localhost ([127.0.0.1]:52098 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mcw45-0001wu-8A for submit@debbugs.gnu.org; Tue, 19 Oct 2021 16:50:29 -0400 Received: from quimby.gnus.org ([95.216.78.240]:39368) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mcw42-0001wg-3E for 51292@debbugs.gnu.org; Tue, 19 Oct 2021 16:50:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=vVsxAkfWuzUw8tUfULuUHWU1nY8A9VFkZ/Y7lBhoago=; b=TeJ+APm+edw0rA/YNFVGONYSTF 4uDe2WSnPz2MQTP/80alGrBmP32wMhkNemsIaXHxH7CrAbY9PEA51aQuMl8HtUSPnnMc8zYEcmZRk g9w5H0d3ps6Ed1Yd6pjQ9ZwKFZEnpsLI6qFRvZFm+W8iKNBywWX+Nu0H4f5eS5nFkIZ8=; Received: from [84.212.220.105] (helo=elva) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mcw3t-0000wN-5V; Tue, 19 Oct 2021 22:50:19 +0200 From: Lars Ingebrigtsen References: <2AC0A88D-4F2F-41A5-B945-8BB55260C0E8@gmail.com> <87fsswbyu0.fsf@gnus.org> X-Now-Playing: Band Apart's _Band Apart_: "Eve Ryonne" Date: Tue, 19 Oct 2021 22:50:15 +0200 In-Reply-To: <87fsswbyu0.fsf@gnus.org> (Lars Ingebrigtsen's message of "Tue, 19 Oct 2021 21:26:31 +0200") Message-ID: <87y26oage0.fsf@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: Lars Ingebrigtsen writes: > Emacs has string-reverse, obsolete since 25.1. Perhaps we should > reintroduce it and use the definition from s? Or... well, that might break some people's code, so let's not do that. Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Lars Ingebrigtsen writes: > Emacs has string-reverse, obsolete since 25.1. Perhaps we should > reintroduce it and use the definition from s? Or... well, that might break some people's code, so let's not do that. And I'm not quite sure that such a function really makes sense. How often do you reverse a string for display purposes, anyway? But it might make sense to add function to tokenize a string into grapheme clusters -- I can see that being useful. Then the caller can chop and reverse the list of clusters as they wish. `string-tokenize-graphemes'? -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From unknown Sat Aug 16 12:45:29 2025 X-Loop: help-debbugs@gnu.org Subject: bug#51292: 27.2; Reversing strings with unicode combining characters In-Reply-To: <2AC0A88D-4F2F-41A5-B945-8BB55260C0E8@gmail.com> Resent-From: Howard Melman Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 19 Oct 2021 21:22:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 51292 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 51292@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.163467851318661 (code B ref -1); Tue, 19 Oct 2021 21:22:01 +0000 Received: (at submit) by debbugs.gnu.org; 19 Oct 2021 21:21:53 +0000 Received: from localhost ([127.0.0.1]:52135 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mcwYS-0004qv-OW for submit@debbugs.gnu.org; Tue, 19 Oct 2021 17:21:52 -0400 Received: from lists.gnu.org ([209.51.188.17]:45654) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mcwYR-0004qo-LS for submit@debbugs.gnu.org; Tue, 19 Oct 2021 17:21:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49716) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcwYR-0001qs-DD for bug-gnu-emacs@gnu.org; Tue, 19 Oct 2021 17:21:51 -0400 Received: from ciao.gmane.io ([116.202.254.214]:39810) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcwYP-0007mq-B8 for bug-gnu-emacs@gnu.org; Tue, 19 Oct 2021 17:21:51 -0400 Received: from list by ciao.gmane.io with local (Exim 4.92) (envelope-from ) id 1mcwYL-000947-Jo for bug-gnu-emacs@gnu.org; Tue, 19 Oct 2021 23:21:45 +0200 X-Injected-Via-Gmane: http://gmane.org/ From: Howard Melman Date: Tue, 19 Oct 2021 17:21:36 -0400 Message-ID: References: <2AC0A88D-4F2F-41A5-B945-8BB55260C0E8@gmail.com> <87fsswbyu0.fsf@gnus.org> <87y26oage0.fsf@gnus.org> Mime-Version: 1.0 Content-Type: text/plain User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (darwin) Cancel-Lock: sha1:cq7gnNPshN+Xw2hxcRtvinM3nA4= Received-SPF: pass client-ip=116.202.254.214; envelope-from=geb-bug-gnu-emacs@m.gmane-mx.org; helo=ciao.gmane.io X-Spam_score_int: 5 X-Spam_score: 0.5 X-Spam_bar: / X-Spam_report: (0.5 / 5.0 requ) BAYES_00=-1.9, DKIM_ADSP_CUSTOM_MED=0.001, FORGED_GMAIL_RCVD=1, FREEMAIL_FORGED_FROMDOMAIN=0.248, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.248, NML_ADSP_CUSTOM_MED=0.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-Spam-Score: 0.1 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.9 (/) Lars Ingebrigtsen writes: > Lars Ingebrigtsen writes: > >> Emacs has string-reverse, obsolete since 25.1. Perhaps we should >> reintroduce it and use the definition from s? > > Or... well, that might break some people's code, so let's not do that. > > And I'm not quite sure that such a function really makes sense. How > often do you reverse a string for display purposes, > anyway? FWIW, I'm not invested in the outcome. I haven't had a need to do this but found the behavior curious. > But it might make sense to add function to tokenize a string into > grapheme clusters -- I can see that being useful. Then the caller can > chop and reverse the list of clusters as they wish. > > `string-tokenize-graphemes'? I agree that seems potentially useful. -- Howard From unknown Sat Aug 16 12:45:29 2025 X-Loop: help-debbugs@gnu.org Subject: bug#51292: 27.2; Reversing strings with unicode combining characters Resent-From: Stefan Kangas Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 19 Oct 2021 23:14:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 51292 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Lars Ingebrigtsen Cc: Howard Melman , 51292@debbugs.gnu.org Received: via spool by 51292-submit@debbugs.gnu.org id=B51292.163468524129087 (code B ref 51292); Tue, 19 Oct 2021 23:14:02 +0000 Received: (at 51292) by debbugs.gnu.org; 19 Oct 2021 23:14:01 +0000 Received: from localhost ([127.0.0.1]:52227 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mcyIz-0007Z4-0c for submit@debbugs.gnu.org; Tue, 19 Oct 2021 19:14:01 -0400 Received: from mail-pj1-f52.google.com ([209.85.216.52]:39869) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mcyIu-0007Ym-RZ for 51292@debbugs.gnu.org; Tue, 19 Oct 2021 19:14:00 -0400 Received: by mail-pj1-f52.google.com with SMTP id ls18-20020a17090b351200b001a00250584aso1053567pjb.4 for <51292@debbugs.gnu.org>; Tue, 19 Oct 2021 16:13:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:in-reply-to:references:user-agent :mime-version:date:message-id:subject:to:cc; bh=KFMLj67tnrzGC56reREmvVt1HNqsZ8o7mXU2eKlp01U=; b=iWs4+gfRRwAu46Hu0WoPnRIgOqbf0sxcQQ6JWS4zrMSGJLu/1tsBN7nNwc5aekUgw+ YW9DVvD3I00SMlwr+qIvlyHaw8aRPOS0kqXaa9qJ5OBkMehA20okSkEv076UIUWi1nOv 6tN/VbHTW1ZDlxHVKgETV1kDylf/LhzEpBy+oop1Amqj+AB4oMi7RV9vFMZVb0GfEhGq Fq6qcFBnmHq6R/v/7QVWgl5AdWrubVh7B7lSwgk6ta3mBEcf9v6jAWuCD5z0T9EWI+4a F/2l3YYPJCnFsZn2nqngMMc7VSVcfGP1qV2hxPBXG+a0wlHAcmVJtn34aERXFuJvldTk eeDw== X-Gm-Message-State: AOAM5336Us9XGraL2+RMLTRGqZMnNYGkRzr1WAIqYhRiEI2ndFXJsmhy 2H+5PmIfjiz0Xd5tZZKzwBpwMgjp3uEeqZ1Uo64= X-Google-Smtp-Source: ABdhPJxO/RwT/XzEkVbuw5X18Nn5NJGhaLCZ4UbnSgBw3bvXZndg8JwFfDIZiJvNn5eHF570GeNPDjBhhniItSJSOB4= X-Received: by 2002:a17:902:e74a:b0:13f:3538:fca0 with SMTP id p10-20020a170902e74a00b0013f3538fca0mr35742866plf.22.1634685231436; Tue, 19 Oct 2021 16:13:51 -0700 (PDT) Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Tue, 19 Oct 2021 16:13:51 -0700 From: Stefan Kangas In-Reply-To: <87y26oage0.fsf@gnus.org> (Lars Ingebrigtsen's message of "Tue, 19 Oct 2021 22:50:15 +0200") References: <2AC0A88D-4F2F-41A5-B945-8BB55260C0E8@gmail.com> <87fsswbyu0.fsf@gnus.org> <87y26oage0.fsf@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) MIME-Version: 1.0 Date: Tue, 19 Oct 2021 16:13:51 -0700 Message-ID: Content-Type: text/plain; charset="UTF-8" X-Spam-Score: 0.5 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.5 (/) Lars Ingebrigtsen writes: > And I'm not quite sure that such a function really makes sense. How > often do you reverse a string for display purposes, anyway? I guess not often, if I'm reading the results of this GitHub search right: https://github.com/search?l=Emacs+Lisp&o=desc&q=s-reverse+-filename%3Aexamples.el+-filename%3As-tests.el&s=&type=Code From unknown Sat Aug 16 12:45:29 2025 X-Loop: help-debbugs@gnu.org Subject: bug#51292: 27.2; Reversing strings with unicode combining characters Resent-From: Lars Ingebrigtsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 20 Oct 2021 08:12:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 51292 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Stefan Kangas Cc: Howard Melman , 51292@debbugs.gnu.org Received: via spool by 51292-submit@debbugs.gnu.org id=B51292.163471749318759 (code B ref 51292); Wed, 20 Oct 2021 08:12:01 +0000 Received: (at 51292) by debbugs.gnu.org; 20 Oct 2021 08:11:33 +0000 Received: from localhost ([127.0.0.1]:52625 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1md6hB-0004sU-L9 for submit@debbugs.gnu.org; Wed, 20 Oct 2021 04:11:33 -0400 Received: from quimby.gnus.org ([95.216.78.240]:44498) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1md6hA-0004sJ-Ao for 51292@debbugs.gnu.org; Wed, 20 Oct 2021 04:11:32 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=DZDT+i6HtWHuc8QSNGsum3zR8S1jXigcHNzmh3rxBf8=; b=SCpKAWP1DQ9Upnfj7V/WBwKhem vYXNS5FnvdQsOt37v9Q609WRJbCnWOjSVKsrb6Vtdkcq4oZxBadXyaR4KIIn5sgnHj7LdRUIRirES yMgw3APNk0hEwlPTFxcZeEb87mS1M2wsTpdeg3aI4xlBFBKCWpxk8ynhSCmYw3BGYO7c=; Received: from [84.212.220.105] (helo=elva) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1md6h2-0005pd-3p; Wed, 20 Oct 2021 10:11:26 +0200 From: Lars Ingebrigtsen References: <2AC0A88D-4F2F-41A5-B945-8BB55260C0E8@gmail.com> <87fsswbyu0.fsf@gnus.org> <87y26oage0.fsf@gnus.org> X-Now-Playing: The Soft Pink Truth's _Am I Free To Go?_: "Police Bastard (Doom cover)" Date: Wed, 20 Oct 2021 10:11:23 +0200 In-Reply-To: (Stefan Kangas's message of "Tue, 19 Oct 2021 16:13:51 -0700") Message-ID: <8735owp13o.fsf@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: Stefan Kangas writes: > I guess not often, if I'm reading the results of this GitHub search > right: > > https://github.com/search?l=Emacs+Lisp&o=desc&q=s-reverse+-filename%3Aexamples.el+-filename%3As-tests.el&s=&type=Code Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Stefan Kangas writes: > I guess not often, if I'm reading the results of this GitHub search > right: > > https://github.com/search?l=Emacs+Lisp&o=desc&q=s-reverse+-filename%3Aexamples.el+-filename%3As-tests.el&s=&type=Code I'm not sure how to read it. :-) It says: 2,671 code results and then the page is blank? -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From unknown Sat Aug 16 12:45:29 2025 X-Loop: help-debbugs@gnu.org Subject: bug#51292: 27.2; Reversing strings with unicode combining characters Resent-From: Lars Ingebrigtsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 20 Oct 2021 08:59:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 51292 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Howard Melman Cc: 51292@debbugs.gnu.org Received: via spool by 51292-submit@debbugs.gnu.org id=B51292.163472034115891 (code B ref 51292); Wed, 20 Oct 2021 08:59:02 +0000 Received: (at 51292) by debbugs.gnu.org; 20 Oct 2021 08:59:01 +0000 Received: from localhost ([127.0.0.1]:52707 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1md7R6-00048F-T4 for submit@debbugs.gnu.org; Wed, 20 Oct 2021 04:59:01 -0400 Received: from quimby.gnus.org ([95.216.78.240]:45074) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1md7R5-000482-Sb for 51292@debbugs.gnu.org; Wed, 20 Oct 2021 04:59:00 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Message-ID :In-Reply-To:Date:References:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=nSSEiu91JcyshOyw2RkC8GnvagCh8X6OM8KYVLNoXWY=; b=Iq0BQtgoIjLPRUIqtTvXvI2xYv AKQVOvvIN/FYlFSwhT1VVpksMzlJ+xxvBMw/zVnc7MDUKcr7/q6NaYWgbHdTNdSHCLXk3QJasWc0/ czsYeGrkmgv8OPEXKz+P7D4rx3/okHLA+Xs5TuiWNThWf+bv/nwNfuW0mug8qkOubojQ=; Received: from [84.212.220.105] (helo=elva) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1md7Qx-0006DY-59; Wed, 20 Oct 2021 10:58:53 +0200 From: Lars Ingebrigtsen References: <2AC0A88D-4F2F-41A5-B945-8BB55260C0E8@gmail.com> <87fsswbyu0.fsf@gnus.org> <87y26oage0.fsf@gnus.org> X-Now-Playing: Mochipet's _Godzillafather Rick Owens Fogachine_: "Godzillafather Rick Owens Fogachine (Runway Mix)" Date: Wed, 20 Oct 2021 10:58:50 +0200 In-Reply-To: (Howard Melman's message of "Tue, 19 Oct 2021 17:21:36 -0400") Message-ID: <875ytsnkc5.fsf@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: Howard Melman writes: >> But it might make sense to add function to tokenize a string into >> grapheme clusters -- I can see that being useful. Then the caller can >> chop and reverse the list of clusters as they wish. >> [...] Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Howard Melman writes: >> But it might make sense to add function to tokenize a string into >> grapheme clusters -- I can see that being useful. Then the caller can >> chop and reverse the list of clusters as they wish. >> >> `string-tokenize-graphemes'? > > I agree that seems potentially useful. It's not that common to have un-normalised strings, though, and if you normalise the string first you get (reverse (ucs-normalize-NFC-string "nai\u0308ve")) =3D> "ev=C3=AFan" as expected. So I think adding more utility functions here wouldn't be productive (i.e., I don't think they would actually be useful for people -- they'd just complicate things for users further). So I think everything here is basically working as designed in Emacs, and that the design is fine. (And that the s-reverse isn't good.) So I'm closing this bug report. --=20 (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From debbugs-submit-bounces@debbugs.gnu.org Wed Oct 20 04:59:11 2021 Received: (at control) by debbugs.gnu.org; 20 Oct 2021 08:59:11 +0000 Received: from localhost ([127.0.0.1]:52711 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1md7RA-00048s-52 for submit@debbugs.gnu.org; Wed, 20 Oct 2021 04:59:11 -0400 Received: from quimby.gnus.org ([95.216.78.240]:45088) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1md7R9-000487-F9 for control@debbugs.gnu.org; Wed, 20 Oct 2021 04:59:03 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Subject:From:To:Message-Id:Date:Sender:Reply-To:Cc: MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=g34ma+Hth2cBysThDElUCqQ+tF43gtkLCUovTD2eslE=; b=vKb+f1Tdw95xOuKU3bOeVtSIm4 ynxbYYF5l6HXOUSkKBU8VnK6H81V5WCOQNcDYhSkk52bVywuqG9Pl9Lo+w/I6Kji3ZDlZYV0KdcDk iW9olCDXI1kgIE1v7q2UQHutjequTC86V7X9sKS1gSJYcdFOKhs9qcQbZGTTJ5xCGu6g=; Received: from [84.212.220.105] (helo=elva) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1md7R1-0006Dh-Vg for control@debbugs.gnu.org; Wed, 20 Oct 2021 10:58:57 +0200 Date: Wed, 20 Oct 2021 10:58:55 +0200 Message-Id: <874k9cnkc0.fsf@gnus.org> To: control@debbugs.gnu.org From: Lars Ingebrigtsen Subject: control message for bug #51292 X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: tags 51292 wontfix close 51292 quit Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) tags 51292 wontfix close 51292 quit From unknown Sat Aug 16 12:45:29 2025 X-Loop: help-debbugs@gnu.org Subject: bug#51292: 27.2; Reversing strings with unicode combining characters Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 20 Oct 2021 11:46:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 51292 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: wontfix To: Lars Ingebrigtsen Cc: hmelman@gmail.com, 51292@debbugs.gnu.org Received: via spool by 51292-submit@debbugs.gnu.org id=B51292.163473035825024 (code B ref 51292); Wed, 20 Oct 2021 11:46:01 +0000 Received: (at 51292) by debbugs.gnu.org; 20 Oct 2021 11:45:58 +0000 Received: from localhost ([127.0.0.1]:52879 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mdA2g-0006VX-8Y for submit@debbugs.gnu.org; Wed, 20 Oct 2021 07:45:58 -0400 Received: from eggs.gnu.org ([209.51.188.92]:35448) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mdA2e-0006VL-Ka for 51292@debbugs.gnu.org; Wed, 20 Oct 2021 07:45:57 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:34930) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mdA2Y-0000Y4-9A; Wed, 20 Oct 2021 07:45:50 -0400 Received: from [87.69.77.57] (port=3800 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mdA2I-00006D-Tj; Wed, 20 Oct 2021 07:45:42 -0400 Date: Wed, 20 Oct 2021 14:45:46 +0300 Message-Id: <83pmrzc42d.fsf@gnu.org> From: Eli Zaretskii In-Reply-To: <87fsswbyu0.fsf@gnus.org> (message from Lars Ingebrigtsen on Tue, 19 Oct 2021 21:26:31 +0200) References: <2AC0A88D-4F2F-41A5-B945-8BB55260C0E8@gmail.com> <87fsswbyu0.fsf@gnus.org> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Lars Ingebrigtsen > Date: Tue, 19 Oct 2021 21:26:31 +0200 > Cc: 51292@debbugs.gnu.org > > Howard Melman writes: > > > Reversing a string fails to account for unicode combining characters > > > > (reverse "nai\u0308ve") > > "ev̈ian" > > > > Note the diaeresis is now on the v and not the i. s-reverse gets it right: > > > > (s-reverse "nai\u0308ve") > > "evïan" > > So I wondered what s-reverse did, and indeed: > > (defun s-reverse (s) > "Return the reverse of S." > (declare (pure t) (side-effect-free t)) > (save-match-data > (if (multibyte-string-p s) > (let ((input (string-to-list s)) > output) > (require 'ucs-normalize) > (while input > ;; Handle entire grapheme cluster as a single unit > (let ((grapheme (list (pop input)))) > (while (memql (car input) ucs-normalize-combining-chars) > (push (pop input) grapheme)) > (setq output (nconc (nreverse grapheme) output)))) > (concat output)) > (concat (nreverse (string-to-list s)))))) > > Emacs has string-reverse, obsolete since 25.1. Perhaps we should > reintroduce it and use the definition from s? I don't understand the use case(s) where this could be useful. If this is for display, then displaying text needs much more than just combining accents with the base characters. E.g., what if the accent should not combine when the order is reversed, i.e. the composition rules depend on the following characters as well? And what if character composition is not due to normalization rules. Or what if the text includes bidirectional scripts, whose reversal rules are either very complex or simply undefined? If this is not for display, then where is this useful and why? If someone can describe real-life use cases, we could reason whether doing something like that could be useful enough. Without that, the code in s-reverse seems like an incomplete semi-feature which supports some limited use cases that someone needed in some specific situation, not a useful general feature that handles the issue anywhere close to completeness. From unknown Sat Aug 16 12:45:29 2025 X-Loop: help-debbugs@gnu.org Subject: bug#51292: 27.2; Reversing strings with unicode combining characters Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 20 Oct 2021 11:51:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 51292 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: wontfix To: Lars Ingebrigtsen Cc: hmelman@gmail.com, 51292@debbugs.gnu.org Received: via spool by 51292-submit@debbugs.gnu.org id=B51292.163473066125658 (code B ref 51292); Wed, 20 Oct 2021 11:51:02 +0000 Received: (at 51292) by debbugs.gnu.org; 20 Oct 2021 11:51:01 +0000 Received: from localhost ([127.0.0.1]:52892 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mdA7Y-0006fm-NM for submit@debbugs.gnu.org; Wed, 20 Oct 2021 07:51:00 -0400 Received: from eggs.gnu.org ([209.51.188.92]:36614) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mdA7X-0006fZ-FZ for 51292@debbugs.gnu.org; Wed, 20 Oct 2021 07:50:59 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:35074) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mdA7R-0005Bb-U1; Wed, 20 Oct 2021 07:50:53 -0400 Received: from [87.69.77.57] (port=4116 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mdA7H-0000hi-V0; Wed, 20 Oct 2021 07:50:53 -0400 Date: Wed, 20 Oct 2021 14:50:56 +0300 Message-Id: <83mtn3c3tr.fsf@gnu.org> From: Eli Zaretskii In-Reply-To: <87y26oage0.fsf@gnus.org> (message from Lars Ingebrigtsen on Tue, 19 Oct 2021 22:50:15 +0200) References: <2AC0A88D-4F2F-41A5-B945-8BB55260C0E8@gmail.com> <87fsswbyu0.fsf@gnus.org> <87y26oage0.fsf@gnus.org> X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Lars Ingebrigtsen > Date: Tue, 19 Oct 2021 22:50:15 +0200 > Cc: 51292@debbugs.gnu.org > > But it might make sense to add function to tokenize a string into > grapheme clusters -- I can see that being useful. Then the caller can > chop and reverse the list of clusters as they wish. We have find-composition; isn't that sufficient? Especially since we don't really understand the use case? From unknown Sat Aug 16 12:45:29 2025 X-Loop: help-debbugs@gnu.org Subject: bug#51292: 27.2; Reversing strings with unicode combining characters Resent-From: Stefan Kangas Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 20 Oct 2021 13:03:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 51292 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: wontfix To: Lars Ingebrigtsen Cc: Howard Melman , 51292@debbugs.gnu.org Received: via spool by 51292-submit@debbugs.gnu.org id=B51292.1634734956481 (code B ref 51292); Wed, 20 Oct 2021 13:03:02 +0000 Received: (at 51292) by debbugs.gnu.org; 20 Oct 2021 13:02:36 +0000 Received: from localhost ([127.0.0.1]:53008 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mdBEp-00007h-Vf for submit@debbugs.gnu.org; Wed, 20 Oct 2021 09:02:36 -0400 Received: from mail-pj1-f54.google.com ([209.85.216.54]:34350) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mdBEo-00007V-1G for 51292@debbugs.gnu.org; Wed, 20 Oct 2021 09:02:34 -0400 Received: by mail-pj1-f54.google.com with SMTP id q2-20020a17090a2e0200b001a0fd4efd49so3772193pjd.1 for <51292@debbugs.gnu.org>; Wed, 20 Oct 2021 06:02:33 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:in-reply-to:references:mime-version:date :message-id:subject:to:cc; bh=UYCwC74vHMRaNxcs6OW5k5orwICKwyQBa7lmTfYaOS4=; b=rs0ntnMjiPYD1TB115hZnBKMV2SiONcPCGQlifrjQatSVkBm907c0X9K++AuGneHsq LIc1y/N9cKyLFJTLVI3sO+N7OMN0Ex486rIg9kaiKFg6AA5qQ+GwuKl9fCOGBjcJ1cjM LC5HVbMTGFr8jwpjXuEtJNzs8nSEmQVhFGVtdRj0tGSTZonCCpNzgz7s8c/dbApgJbD1 zzC6VO4N0o0JTsbMzGYA5Frku+G3AaQk2sqyp2ugfpsJo1hfaoj6DHX0D8VUD4FabPZ1 IhkIg5AAW0VDPY8V9Fp1CHGsUBNvsr32zF3zBNqY62Ioe72cXZzwKwB3Z7k39Uprq+bv XGXw== X-Gm-Message-State: AOAM5300BKHG9FS1Vucy0NNnQ2Afmd9vuyObXljH9m6Slgu93v4qagy/ GZYesOITYsWwI9AAbyOWnnqN/kJqwInMeMCd9mQ= X-Google-Smtp-Source: ABdhPJyKzyJqanfQDLhSg+VCCTXMbyXs+Vp6oHzlXxPFObTRGmXL1BS7yRWENTSIG8cEdZW1v8GlMaiLhtnJ9sj3+1g= X-Received: by 2002:a17:90b:17d2:: with SMTP id me18mr7220689pjb.132.1634734947898; Wed, 20 Oct 2021 06:02:27 -0700 (PDT) Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Wed, 20 Oct 2021 06:02:27 -0700 From: Stefan Kangas In-Reply-To: <8735owp13o.fsf@gnus.org> References: <2AC0A88D-4F2F-41A5-B945-8BB55260C0E8@gmail.com> <87fsswbyu0.fsf@gnus.org> <87y26oage0.fsf@gnus.org> <8735owp13o.fsf@gnus.org> MIME-Version: 1.0 Date: Wed, 20 Oct 2021 06:02:27 -0700 Message-ID: Content-Type: text/plain; charset="UTF-8" X-Spam-Score: 0.5 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.5 (/) Lars Ingebrigtsen writes: > Stefan Kangas writes: > >> I guess not often, if I'm reading the results of this GitHub search >> right: >> >> https://github.com/search?l=Emacs+Lisp&o=desc&q=s-reverse+-filename%3Aexamples.el+-filename%3As-tests.el&s=&type=Code > > I'm not sure how to read it. :-) It says: > > 2,671 code results > > and then the page is blank? OK, so it's not just here that happens... I believe this means that there is no match? Try removing e.g. "-filename:examples.el" and you should see matches again, but all of them are for that file. Add that restriction again, and you see no matches. I think. From unknown Sat Aug 16 12:45:29 2025 X-Loop: help-debbugs@gnu.org Subject: bug#51292: 27.2; Reversing strings with unicode combining characters Resent-From: Lars Ingebrigtsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 21 Oct 2021 02:51:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 51292 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: wontfix To: Stefan Kangas Cc: Howard Melman , 51292@debbugs.gnu.org Received: via spool by 51292-submit@debbugs.gnu.org id=B51292.163478462321478 (code B ref 51292); Thu, 21 Oct 2021 02:51:01 +0000 Received: (at 51292) by debbugs.gnu.org; 21 Oct 2021 02:50:23 +0000 Received: from localhost ([127.0.0.1]:55808 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mdO9v-0005aL-95 for submit@debbugs.gnu.org; Wed, 20 Oct 2021 22:50:23 -0400 Received: from quimby.gnus.org ([95.216.78.240]:53886) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mdO9t-0005a4-QJ for 51292@debbugs.gnu.org; Wed, 20 Oct 2021 22:50:22 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=ww9xtg+8iZPI/3l4Ang172Vvx7QGTXEU2gwNYhn4AzE=; b=OSWKi/33huUdlB7Nqu7xyqKzMa sYIzTar4wffuaNbz1VCpd5NYf2/dBuPdc9PP8zdx97ekUOuzRiC3P4WbsRsPQUEVQftub6kMS20+U YsamDOQ288hYjMAkKgeFu7gkOEbTPjpyKo0XEl5es++/dVs1nz+6NoHNTm/oIBkA0wlM=; Received: from [84.212.220.105] (helo=elva) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mdO9l-0005GU-Gu; Thu, 21 Oct 2021 04:50:16 +0200 From: Lars Ingebrigtsen References: <2AC0A88D-4F2F-41A5-B945-8BB55260C0E8@gmail.com> <87fsswbyu0.fsf@gnus.org> <87y26oage0.fsf@gnus.org> <8735owp13o.fsf@gnus.org> Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAACBj SFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAD1BMVEVPSZeWZJemqNJL J1z///9SRQkfAAAAAWJLR0QEj2jZUQAAAAd0SU1FB+UKFQIpL0s56UEAAAGPSURBVDjLbZSLscQg CEUhNCDaQLQCMvTf2+OjxrxZd3Ym4Xj5KQGYC0euDt9Vx/hJLrdwQef3P0EBIAU28gG3kIo9EIzB rx19u9uRtB5hmMFIahAOZ6blQupLsFxbcnXT6FwCVJdk3MhNN3HJnTWUWsJGlrAKwwQ4kIm2QtG2 JmAuoseyrVm9RYA0ccSy8lclkuBJINahFIDSAhx5LVB0ecp6eEaHFXuBiydYuU5XigvsRPlJgLMp /tIOhWBEVwfUngTN0y2zEENmonDl4I1BCitGlF4DqFeC4WQW+CyFvWOYnieB7QQJ8laSp+iORK3C CaZCKADtyj1IKCRC03FKloGhTFXgPFdz1xLQihBZ+b9MyeyVX604QQfyAsQAD5PYnZx2v7NeYfMm MkF7ARa2wejooDxlhSDB7rPUvWPWDLvx6/bwqDFrzN3bvyUQs2fAf7UJvKD7dA5r8jBwjCDWmOde HZUDQO3pzZPjE1zDNlcrxgfwlOD+MNi9+fja34zPd+ElHX6v63iWEyDti/wHpVlir3d8zIMAAAAl dEVYdGRhdGU6Y3JlYXRlADIwMjEtMTAtMjFUMDI6NDE6NDYrMDA6MDDcWq4VAAAAJXRFWHRkYXRl Om1vZGlmeQAyMDIxLTEwLTIxVDAyOjQxOjQ2KzAwOjAwrQcWqQAAAABJRU5ErkJggg== X-Now-Playing: Alice Coltrane's _Kirtan Turiya Sings_: "Rama Katha" Date: Thu, 21 Oct 2021 04:50:10 +0200 In-Reply-To: (Stefan Kangas's message of "Wed, 20 Oct 2021 06:02:27 -0700") Message-ID: <87o87jjdlp.fsf@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: Stefan Kangas writes: > I believe this means that there is no match? Try removing > e.g. "-filename:examples.el" and you should see matches again, but all > of them are for that file. Add that restriction again, and you se [...] Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Stefan Kangas writes: > I believe this means that there is no match? Try removing > e.g. "-filename:examples.el" and you should see matches again, but all > of them are for that file. Add that restriction again, and you see no > matches. I think. There's something very odd going on with that seach. If I remove "-filename:examples.el", then I get a bunch of matches from files like src/gdi/gdiTools.f? Very odd. https://github.com/search?q=s-reverse+-filename%3As-tests.el&type=Code But none of the matches on the first few pages refer to the s.el s-reverse, so I think the conclusion is the same -- it's not a function that's actually used for anything. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From unknown Sat Aug 16 12:45:29 2025 X-Loop: help-debbugs@gnu.org Subject: bug#51292: 27.2; Reversing strings with unicode combining characters Resent-From: Stefan Kangas Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 21 Oct 2021 03:52:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 51292 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: wontfix To: Lars Ingebrigtsen Cc: Howard Melman , 51292@debbugs.gnu.org Received: via spool by 51292-submit@debbugs.gnu.org id=B51292.163478828920139 (code B ref 51292); Thu, 21 Oct 2021 03:52:01 +0000 Received: (at 51292) by debbugs.gnu.org; 21 Oct 2021 03:51:29 +0000 Received: from localhost ([127.0.0.1]:55901 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mdP73-0005El-1t for submit@debbugs.gnu.org; Wed, 20 Oct 2021 23:51:29 -0400 Received: from mail-pj1-f54.google.com ([209.85.216.54]:38718) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mdP71-0005EY-Ev for 51292@debbugs.gnu.org; Wed, 20 Oct 2021 23:51:27 -0400 Received: by mail-pj1-f54.google.com with SMTP id n8-20020a17090a2bc800b00196286963b9so2113639pje.3 for <51292@debbugs.gnu.org>; Wed, 20 Oct 2021 20:51:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:in-reply-to:references:mime-version:date :message-id:subject:to:cc; bh=SUITNxq84Lu14P8QwPdyDbjW0mvO3brQU0kHNZQRPxE=; b=slfoH2OZDFPR5SvKYR3xlrgrPTiO7vvK8WCgHvnHNxEbKnV0HBx3hDACk+JFUgzY3j ODzGLWaspfFjK4EPnRogr3pqi0VnNKRrekHjoG+diXOoIVBs1dW9GU9PR+rRXXB9WMnx GukePWPDjvugTzQ+FCbfp+ZS9vBG85Y3LKlEyDuaQrO88uIHyXpbM9FXY/DmFYjkp0pY D/nTBLU8FcRjRX5muvH0SZtpsVXxCQRIGA1Mr+desgsW7+4gs49f4okjYwyQqwITSuXL a4eIkV/zQyj/qwTjdM8s0NYX4dGEYBYgIWRO6F972VvPc+R55hDXoHQn0FuvWjOpvGWA wVYA== X-Gm-Message-State: AOAM530Vl9aD51ftZLCciqET0EvLV5Xtrpdgn1Eh5I16tWV4E4xCvXKe +WoBDwID13UvfuahrypotkMhLLo/qkOzQqZqPgU= X-Google-Smtp-Source: ABdhPJyX0USNfNLlDysU+Sornu6vZ0JS7Ew2gCqLVUdpwKL11qo/J+1wJcBJnxIp9+EHBdOPk4Sz/g9+NxpBPTCItdo= X-Received: by 2002:a17:902:e74a:b0:13f:3538:fca0 with SMTP id p10-20020a170902e74a00b0013f3538fca0mr2983838plf.22.1634788281656; Wed, 20 Oct 2021 20:51:21 -0700 (PDT) Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Wed, 20 Oct 2021 20:51:21 -0700 From: Stefan Kangas In-Reply-To: <87o87jjdlp.fsf@gnus.org> References: <2AC0A88D-4F2F-41A5-B945-8BB55260C0E8@gmail.com> <87fsswbyu0.fsf@gnus.org> <87y26oage0.fsf@gnus.org> <8735owp13o.fsf@gnus.org> <87o87jjdlp.fsf@gnus.org> MIME-Version: 1.0 Date: Wed, 20 Oct 2021 20:51:21 -0700 Message-ID: Content-Type: text/plain; charset="UTF-8" X-Spam-Score: 0.5 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.5 (/) Lars Ingebrigtsen writes: > There's something very odd going on with that seach. If I remove > "-filename:examples.el", then I get a bunch of matches from files like > src/gdi/gdiTools.f? Very odd. Indeed, the Github search is not working very well. > https://github.com/search?q=s-reverse+-filename%3As-tests.el&type=Code > > But none of the matches on the first few pages refer to the s.el With that link, I think you need to click the "Emacs Lisp" button to see them? I do that and see 2743 matches, but all of them copies of examples.el from s.el itself. Ah, on page 10 I see some matches in ensime-completion-util.el, but then from page 18 or so I start seeing only matches in s.el itself again. I didn't go much further, but it doesn't seem to be very popular. When I sort by "Recently indexed", I see only matches in s.el again. (The GitHub user interface is horrible, BTW.) > s-reverse, so I think the conclusion is the same -- it's not a function > that's actually used for anything. I agree. It was probably added because it is there in Clojure, where it makes sense as they tend to favour immutable data. Whereas we just do `replace-match', etc.