[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#62847: 29.0.90; Propertized space in Org Agenda's mode-name
From: |
Mattias Engdegård |
Subject: |
bug#62847: 29.0.90; Propertized space in Org Agenda's mode-name |
Date: |
Sat, 15 Apr 2023 15:15:12 +0200 |
15 apr. 2023 kl. 13.45 skrev Eli Zaretskii <eliz@gnu.org>:
>>> So maybe replace " " with (copy-sequence " ").
>>
>> But that should not be necessary, right?
Ideally not -- setting properties on literal strings should indeed be avoided
for a variety of reasons, one being that the byte compiler shares equal string
literals:
(defun ff ()
(list "abc" (let ((s "abc"))
(put-text-property 0 3 'aa 'bb s)
s)))
(ff)
-> ("abc" #("abc" 0 3 (aa bb))) ; interpreted
-> (#("abc" 0 3 (aa bb)) #("abc" 0 3 (aa bb))) ; byte-compiled
`org-agenda-set-mode-name` uses the literal " " twice so if either is modified
the other will appear to be, too. Where this setting of properties is done I
have no idea
There is currently no automatic sharing of string literals between byte-code
functions but this may change, and I've no idea what the native compiler is up
to in this respect.
`propertize` is safe because it makes a copy of its string argument, so there
shouldn't be any reason to copy that argument explicitly.
`org-add-props` calls `add-text-properties` and is clearly destructive.
Interpreted code is less affected by the problem because literals aren't shared
throughout a function, but trouble can still occur:
(defun hh (x)
(let ((s "abc"))
(when x
(put-text-property 0 3 'aa 'bb s))
s))
(hh nil) -> "abc"
(hh t) -> #("abc" 0 3 (aa bb))
(hh nil) -> #("abc" 0 3 (aa bb))
...
- bug#62847: 29.0.90; Propertized space in Org Agenda's mode-name, (continued)
- bug#62847: 29.0.90; Propertized space in Org Agenda's mode-name, Gustavo Barros, 2023/04/15
- bug#62847: 29.0.90; Propertized space in Org Agenda's mode-name, Ihor Radchenko, 2023/04/15
- bug#62847: 29.0.90; Propertized space in Org Agenda's mode-name, Gustavo Barros, 2023/04/15
- bug#62847: 29.0.90; Propertized space in Org Agenda's mode-name, Ihor Radchenko, 2023/04/15
- bug#62847: 29.0.90; Propertized space in Org Agenda's mode-name, Stefan Monnier, 2023/04/15
- bug#62847: 29.0.90; Propertized space in Org Agenda's mode-name, Ihor Radchenko, 2023/04/16
- bug#62847: 29.0.90; Propertized space in Org Agenda's mode-name, Gustavo Barros, 2023/04/16
- bug#62847: 29.0.90; Propertized space in Org Agenda's mode-name, Eli Zaretskii, 2023/04/15
- bug#62847: 29.0.90; Propertized space in Org Agenda's mode-name, Ihor Radchenko, 2023/04/15
- bug#62847: 29.0.90; Propertized space in Org Agenda's mode-name, Eli Zaretskii, 2023/04/15
- bug#62847: 29.0.90; Propertized space in Org Agenda's mode-name,
Mattias Engdegård <=
- bug#62847: 29.0.90; Propertized space in Org Agenda's mode-name, Ihor Radchenko, 2023/04/16
- bug#62847: 29.0.90; Propertized space in Org Agenda's mode-name, Mattias Engdegård, 2023/04/16
- bug#62847: 29.0.90; Propertized space in Org Agenda's mode-name, Ihor Radchenko, 2023/04/16
- bug#62847: 29.0.90; Propertized space in Org Agenda's mode-name, Eli Zaretskii, 2023/04/16
- bug#62847: 29.0.90; Propertized space in Org Agenda's mode-name, Ihor Radchenko, 2023/04/16
- bug#62847: 29.0.90; Propertized space in Org Agenda's mode-name, Eli Zaretskii, 2023/04/16
- bug#62847: 29.0.90; Propertized space in Org Agenda's mode-name, Ihor Radchenko, 2023/04/16
- bug#62847: 29.0.90; Propertized space in Org Agenda's mode-name, Eli Zaretskii, 2023/04/16
- bug#62847: 29.0.90; Propertized space in Org Agenda's mode-name, Mattias Engdegård, 2023/04/16
- bug#62847: 29.0.90; Propertized space in Org Agenda's mode-name, Mattias Engdegård, 2023/04/16