unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Ihor Radchenko <yantar92@posteo.net>
To: Gustavo Barros <gusbrs.2016@gmail.com>
Cc: Eli Zaretskii <eliz@gnu.org>, 62847@debbugs.gnu.org
Subject: bug#62847: 29.0.90; Propertized space in Org Agenda's mode-name
Date: Sat, 15 Apr 2023 12:08:17 +0000	[thread overview]
Message-ID: <87cz45e4b2.fsf@localhost> (raw)
In-Reply-To: <CAM9ALR9axpOMKfc8gv=YSpSn3QVH-KLnwMUbkZez-Lty3=+Lkg@mail.gmail.com>

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

Gustavo Barros <gusbrs.2016@gmail.com> writes:

> On Sat, 15 Apr 2023 at 08:41, Ihor Radchenko <yantar92@posteo.net> wrote:
>
>> Gustavo, what happens if you put (load "org-agenda.el") in your init.el?
>
> Problem gone, the space is not propertized.

So, it really looks like compilation problem.

I am now looking into Elisp manual

    2.9 Mutability
    
       When similar constants occur as parts of a program, the Lisp
    interpreter might save time or space by reusing existing constants or
    their components.  For example, ‘(eq "abc" "abc")’ returns ‘t’ if the
    interpreter creates only one instance of the string literal ‘"abc"’, and
    returns ‘nil’ if it creates two instances.  Lisp programs should be
    written so that they work regardless of whether this optimization is in
    use.

So, it should be a good idea to avoid setting text properties in string
constants in general.

See the attached patch.
Though I have no clue if this is enough to fix the bug...


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-lisp-org-agenda.el-Try-not-to-modify-string-constant.patch --]
[-- Type: text/x-patch, Size: 2771 bytes --]

From 6e74e7746936a5584fce9c8539dd1ad96b37bb7e Mon Sep 17 00:00:00 2001
Message-Id: <6e74e7746936a5584fce9c8539dd1ad96b37bb7e.1681560403.git.yantar92@posteo.net>
From: Ihor Radchenko <yantar92@posteo.net>
Date: Sat, 15 Apr 2023 14:04:19 +0200
Subject: [PATCH] * lisp/org-agenda.el: Try not to modify string constants by
 side effect

(org-agenda-propertize-selected-todo-keywords):
(org-agenda-format-item):
(org-agenda-highlight-todo): Make sure that we use a fresh string
constant copy when adding properties.  This avoids race modifications
when compiler use shared object for several string constants in
org-agenda.

See Emacs bug#62847.

Reported-by: Gustavo Barros <gusbrs.2016@gmail.com>
Link: https://orgmode.org/list/CAM9ALR95F_ZHV2_WsqAz0-35-S2rwxbHqsA5VGftvq51Yz3ZAQ@mail.gmail.com
---
 lisp/org-agenda.el | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index 2ec2f4c00..8e6b84362 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -4923,7 +4923,9 @@ (defun org-agenda-propertize-selected-todo-keywords (keywords)
   "Use `org-todo-keyword-faces' for the selected todo KEYWORDS."
   (concat
    (if (or (equal keywords "ALL") (not keywords))
-       (propertize "ALL" 'face 'org-agenda-structure-filter)
+       (propertize
+        (copy-sequence "ALL") ; Avoid modifying `eq' string constants.
+        'face 'org-agenda-structure-filter)
      (mapconcat
       (lambda (kw)
         (propertize kw 'face (list (org-get-todo-face kw) 'org-agenda-structure)))
@@ -7251,7 +7253,9 @@         (defvar level) (defvar tag) (defvar time))
 			     "")))
 	     (category-icon (org-agenda-get-category-icon category))
 	     (category-icon (if category-icon
-				(propertize " " 'display category-icon)
+				(propertize
+                                 (copy-sequence " ") ; Avoid modifying `eq' " ".
+                                 'display category-icon)
 			      ""))
 	     (effort (and (not (string= txt ""))
 			  (get-text-property 1 'effort txt)))
@@ -7724,8 +7728,10 @@ (defun org-agenda-highlight-todo (x)
                    (unless (string= org-agenda-todo-keyword-format "")
                      ;; Remove `display' property as the icon could leak
                      ;; on the white space.
-                     (org-add-props " " (org-plist-delete (text-properties-at 0 x)
-                                                          'display)))
+                     (org-add-props
+                         (copy-sequence " ") ; Avoid modifying `eq' " ".
+                         (org-plist-delete (text-properties-at 0 x)
+                                           'display)))
                    (substring x (match-end 3)))))))
       x)))
 
-- 
2.40.0


[-- Attachment #3: Type: text/plain, Size: 224 bytes --]


-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>

  reply	other threads:[~2023-04-15 12:08 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-14 23:04 bug#62847: 29.0.90; Propertized space in Org Agenda's mode-name Gustavo Barros
2023-04-15  9:38 ` Ihor Radchenko
2023-04-15  9:49   ` Eli Zaretskii
2023-04-15 10:02     ` Ihor Radchenko
2023-04-15 10:24       ` Eli Zaretskii
2023-04-15 10:40         ` Ihor Radchenko
2023-04-15 10:55           ` Eli Zaretskii
2023-04-15 11:28             ` Gustavo Barros
2023-04-15 11:44             ` Ihor Radchenko
2023-04-15 11:49               ` Gustavo Barros
2023-04-15 12:08                 ` Ihor Radchenko [this message]
2023-04-15 13:21                   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-04-16 11:23                     ` Ihor Radchenko
2023-04-16 11:49                       ` Gustavo Barros
2023-04-15 11:38           ` Eli Zaretskii
2023-04-15 11:44             ` Ihor Radchenko
2023-04-15 11:45               ` Eli Zaretskii
2023-04-15 13:15                 ` Mattias Engdegård
2023-04-16 11:29                   ` Ihor Radchenko
2023-04-16 12:02                     ` Mattias Engdegård
2023-04-16 12:17                       ` Ihor Radchenko
2023-04-16 12:58                         ` Eli Zaretskii
2023-04-16 13:14                           ` Ihor Radchenko
2023-04-16 14:43                             ` Eli Zaretskii
2023-04-16 14:52                               ` Ihor Radchenko
2023-04-16 15:17                                 ` Eli Zaretskii
2023-04-16 14:51                       ` Mattias Engdegård
2023-04-16 14:53                         ` Mattias Engdegård
2023-04-16 12:38 ` Daniel Mendler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87cz45e4b2.fsf@localhost \
    --to=yantar92@posteo.net \
    --cc=62847@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=gusbrs.2016@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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).