From: Paul Eggert <eggert@cs.ucla.edu>
To: "João Távora" <joaotavora@gmail.com>
Cc: Pip Cet <pipcet@gmail.com>, emacs-devel <emacs-devel@gnu.org>
Subject: Re: 31395511: "Don’t attempt to modify constant strings"
Date: Wed, 3 Jun 2020 18:19:54 -0700 [thread overview]
Message-ID: <e105032e-8f4f-e143-ecb5-de8ea7d5e032@cs.ucla.edu> (raw)
In-Reply-To: <1abe5965-b48e-6dee-1516-c5c233f09d01@cs.ucla.edu>
[-- Attachment #1: Type: text/plain, Size: 804 bytes --]
On 6/3/20 5:43 PM, Paul Eggert wrote:
> On 6/3/20 4:48 PM, João Távora wrote:
>> I think I'd rather this previous behavior were retained, or at least
>> achievable by request.
>
> It's tricky, as make-text-button in emacs-27 (and earlier) modifies its string
> argument, which is buggy because string constants are not always unique.
On second thought, I'll work on coming up with a better workaround for the
problem along the lines I suggested in my previous message: make-text-button can
copy the button label string only if the string's not mutable. I hope this helps
with SLY (as I hope SLY is not trying to modify string literals...). In the
meantime I've reverted the change by installing the attached patch; this means
the bug I mentioned in my previous message remains unfixed.
[-- Attachment #2: 0001-Revert-make-text-button-string-copy.patch --]
[-- Type: text/x-patch, Size: 1295 bytes --]
From dd3484bedb7f0207c64ed391d1d7e699741e9917 Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Wed, 3 Jun 2020 18:15:54 -0700
Subject: [PATCH] Revert make-text-button string copy
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
* lisp/button.el (make-text-button): Don’t make a copy of
a button’s string label. This reverts the change made in
2020-05-17T05:23:28Z!eggert@cs.ucla.edu, which broke SLY.
Problem reported by João Távora in:
https://lists.gnu.org/r/emacs-devel/2020-06/msg00117.html
However, we’ll need a better fix for this once string
literals become contents, if SLY uses string constants
for text button labels.
---
lisp/button.el | 1 -
1 file changed, 1 deletion(-)
diff --git a/lisp/button.el b/lisp/button.el
index a91b0482ac..3a6a6de774 100644
--- a/lisp/button.el
+++ b/lisp/button.el
@@ -349,7 +349,6 @@ make-text-button
(or (plist-member properties 'type)
(plist-member properties :type))))
(when (stringp beg)
- (setq beg (copy-sequence beg)) ;; In case BEG is not mutable.
(setq object beg beg 0 end (length object)))
;; Disallow setting the `category' property directly.
(when (plist-get properties 'category)
--
2.25.4
next prev parent reply other threads:[~2020-06-04 1:19 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-03 21:52 31395511: "Don’t attempt to modify constant strings" João Távora
2020-06-03 22:41 ` Paul Eggert
2020-06-03 22:52 ` Pip Cet
2020-06-03 23:20 ` Paul Eggert
2020-06-03 23:20 ` Basil L. Contovounesios
2020-06-03 22:41 ` Pip Cet
2020-06-03 23:08 ` Basil L. Contovounesios
2020-06-03 23:31 ` Basil L. Contovounesios
2020-06-03 23:48 ` João Távora
2020-06-04 0:43 ` Paul Eggert
2020-06-04 1:19 ` Paul Eggert [this message]
2020-06-04 7:26 ` Pip Cet
2020-06-04 11:11 ` Basil L. Contovounesios
2020-06-04 19:46 ` Paul Eggert
2020-06-04 20:25 ` João Távora
2020-06-04 20:29 ` Paul Eggert
2020-06-04 21:21 ` Drew Adams
2020-06-04 20:43 ` Pip Cet
2020-06-04 21:27 ` Stefan Monnier
2020-06-04 21:42 ` Pip Cet
2020-06-04 23:10 ` Paul Eggert
2020-06-05 2:09 ` Clément Pit-Claudel
2020-06-05 6:44 ` Paul Eggert
2020-06-05 12:44 ` Stefan Monnier
2020-06-05 17:01 ` Drew Adams
2020-06-05 9:48 ` Pip Cet
2020-06-05 18:37 ` Paul Eggert
2020-06-04 22:33 ` Basil L. Contovounesios
2020-06-05 15:25 ` João Távora
2020-06-05 17:14 ` Dmitry Gutov
2020-06-05 23:19 ` João Távora
2020-06-05 23:32 ` Dmitry Gutov
2020-06-06 1:34 ` FW: " Drew Adams
2020-06-06 0:23 ` Drew Adams
2020-06-06 1:43 ` Paul Eggert
2020-06-06 4:06 ` Richard Stallman
2020-06-06 11:41 ` João Távora
2020-06-06 11:47 ` João Távora
2020-06-04 4:38 ` Pip Cet
2020-06-04 9:31 ` João Távora
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=e105032e-8f4f-e143-ecb5-de8ea7d5e032@cs.ucla.edu \
--to=eggert@cs.ucla.edu \
--cc=emacs-devel@gnu.org \
--cc=joaotavora@gmail.com \
--cc=pipcet@gmail.com \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.