* [BUG] org-element-cache: The inherited property is set wrong
@ 2022-01-20 11:42 Anders Johansson
2022-01-20 13:34 ` Anders Johansson
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Anders Johansson @ 2022-01-20 11:42 UTC (permalink / raw)
To: org-mode-email
Hi,
I had some trouble with completing tags, where the already set tags
were wrongly identified. I have dug this down to a problem with
caching.
with org-element-use-cache=t and org-use-tag-inheritance=t
--- Org
* headline 1 :tag1:
** headline 2 :tag2:
--- end org
When invoking org-set-tags-command (and quitting), on headline 1,
then headline 2, then headline 1 again, "tag1" is no longer shown as
one of the existing tags in the minibuffer. This is because it has
erronously been assigned an :inherited property in the
cache-representation for headline 1 when inherited tags were
calculated for headline 2. This happens in org-get-tags, where
inherited tags are parsed from the cache and given the :inherited
property, but unfortunately this is done to the same string objects,
so that this property is added in the cache tree both for the taglist
of headline 1 and headline 2.
(cl-copy-list cached-tags) is used there, but only copies the list and
not the string objects.
A solution that seems to work for me was to change
(cl-copy-list cached-tags)
to
(mapcar #'copy-sequence cached-tags)
(found it here: https://stackoverflow.com/a/47794586)
I don’t know if this is the best solution though.
Perhaps this is needed also in org--get-local-tags where a similar
thing is done? (but only the fontification seems to matter there)
Best,
Anders Johansson (who is otherwise as mentioned in an earlier
discussion very appreciative of org-element-cache)
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [BUG] org-element-cache: The inherited property is set wrong
2022-01-20 11:42 [BUG] org-element-cache: The inherited property is set wrong Anders Johansson
@ 2022-01-20 13:34 ` Anders Johansson
2022-01-21 11:56 ` Ihor Radchenko
2022-01-20 18:16 ` Kaushal Modi
2022-01-21 11:54 ` [BUG] org-element-cache: The inherited property is set wrong Ihor Radchenko
2 siblings, 1 reply; 7+ messages in thread
From: Anders Johansson @ 2022-01-20 13:34 UTC (permalink / raw)
To: org-mode-email
> I don’t know if this is the best solution though.
> Perhaps this is needed also in org--get-local-tags where a similar
> thing is done? (but only the fontification seems to matter there)
I now noted that this differed in Ihor's org-fold-universal-core
branch which I use and main (org-get-tags has an extra argument
fontify for org-fold). But I believe the caching issue is relevant on
both branches (and in either case a topic for Ihor).
Best,
Anders
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [BUG] org-element-cache: The inherited property is set wrong
2022-01-20 13:34 ` Anders Johansson
@ 2022-01-21 11:56 ` Ihor Radchenko
0 siblings, 0 replies; 7+ messages in thread
From: Ihor Radchenko @ 2022-01-21 11:56 UTC (permalink / raw)
To: Anders Johansson; +Cc: org-mode-email
Anders Johansson <mejlaandersj@gmail.com> writes:
>> I don’t know if this is the best solution though.
>> Perhaps this is needed also in org--get-local-tags where a similar
>> thing is done? (but only the fontification seems to matter there)
>
> I now noted that this differed in Ihor's org-fold-universal-core
> branch which I use and main (org-get-tags has an extra argument
> fontify for org-fold). But I believe the caching issue is relevant on
> both branches (and in either case a topic for Ihor).
Yep, it is a common bug. I have also fixed the issue in my branch now.
By the way, I am almost done with preparing merge for org-fold. Once I
figure out an issue with pixel string-width in older Emacs, it should be
properly ready to be merged(;
Best,
Ihor
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [BUG] org-element-cache: The inherited property is set wrong
2022-01-20 11:42 [BUG] org-element-cache: The inherited property is set wrong Anders Johansson
2022-01-20 13:34 ` Anders Johansson
@ 2022-01-20 18:16 ` Kaushal Modi
2022-01-21 11:58 ` Ihor Radchenko
2022-01-21 11:54 ` [BUG] org-element-cache: The inherited property is set wrong Ihor Radchenko
2 siblings, 1 reply; 7+ messages in thread
From: Kaushal Modi @ 2022-01-20 18:16 UTC (permalink / raw)
To: Anders Johansson; +Cc: org-mode-email
Hi Anders,
I have also been seeing some issues when adding/modidying heading tags
(C-c C-q), and I was able to narrow it down to the element caching
mechanism.
Issue: Org mode/Emacs hangs kind of indefinitely when I do C-c C-q,
but that doesn't happen each time.
Once I set org-element-use-cache to nil, Emacs stopped hanging.
Looking at your bug report, I believe that the issue I am seeing with
cache and Org tags could be very much related. So thanks for
submitting this.
--
Kaushal Modi
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [BUG] org-element-cache: The inherited property is set wrong
2022-01-20 18:16 ` Kaushal Modi
@ 2022-01-21 11:58 ` Ihor Radchenko
2022-01-21 14:50 ` org-element-cache: org-set-tags (C-c C-q) makes Emacs unresponsive at times Kaushal Modi
0 siblings, 1 reply; 7+ messages in thread
From: Ihor Radchenko @ 2022-01-21 11:58 UTC (permalink / raw)
To: Kaushal Modi; +Cc: org-mode-email, Anders Johansson
Kaushal Modi <kaushal.modi@gmail.com> writes:
> I have also been seeing some issues when adding/modidying heading tags
> (C-c C-q), and I was able to narrow it down to the element caching
> mechanism.
>
> Issue: Org mode/Emacs hangs kind of indefinitely when I do C-c C-q,
> but that doesn't happen each time.
>
> Once I set org-element-use-cache to nil, Emacs stopped hanging.
>
> Looking at your bug report, I believe that the issue I am seeing with
> cache and Org tags could be very much related. So thanks for
> submitting this.
The issue here had nothing to do with hanging. You are probably seeing
yet another bug.
By hang, do you mean that even C-g does not restore responsiveness?
Best,
Ihor
^ permalink raw reply [flat|nested] 7+ messages in thread
* org-element-cache: org-set-tags (C-c C-q) makes Emacs unresponsive at times
2022-01-21 11:58 ` Ihor Radchenko
@ 2022-01-21 14:50 ` Kaushal Modi
0 siblings, 0 replies; 7+ messages in thread
From: Kaushal Modi @ 2022-01-21 14:50 UTC (permalink / raw)
To: Ihor Radchenko; +Cc: org-mode-email
Hello Ihor,
> The issue here had nothing to do with hanging. You are probably seeing
> yet another bug.
ok.
> By hang, do you mean that even C-g does not restore responsiveness?
Typically, within a second of doing C-c C-q, I would know that the
buffer is going to freeze, and if I do C-g soon enough, Emacs would
recover in a second or two.
But if I wait 5-6 seconds and then do C-g, it could take minutes to
recover, and I often do pkill SIGUSR2 from the terminal to get back.
Sorry, but since then I set org-element-use-cache to nil once that
issue comes back. It's usually that I am between something and I don't
think of getting a backtrace on C-g (Now I have made a note to self to
provide a backtrace in this thread when that issue repeats).
---
Right now, I set org-element-use-cache back to t, did M-x
toggle-debug-on-quit and did a couple of C-c C-q in a 10k line Org
buffer .. this time, it's responsive and snappy :|
I'll keep you posted. Thanks!!
---
Org mode version 9.5 (release_9.5-415-g9b58ea)
Emacs version: GNU Emacs 28.0.91 (build 5, x86_64-pc-linux-gnu, GTK+
Version 3.22.30, cairo version 1.15.12) of 2022-01-18, built using
commit f393d0d441c3746f98007ae54341870a296bf809.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [BUG] org-element-cache: The inherited property is set wrong
2022-01-20 11:42 [BUG] org-element-cache: The inherited property is set wrong Anders Johansson
2022-01-20 13:34 ` Anders Johansson
2022-01-20 18:16 ` Kaushal Modi
@ 2022-01-21 11:54 ` Ihor Radchenko
2 siblings, 0 replies; 7+ messages in thread
From: Ihor Radchenko @ 2022-01-21 11:54 UTC (permalink / raw)
To: Anders Johansson; +Cc: org-mode-email
Anders Johansson <mejlaandersj@gmail.com> writes:
> Hi,
> I had some trouble with completing tags, where the already set tags
> were wrongly identified. I have dug this down to a problem with
> caching.
>
> with org-element-use-cache=t and org-use-tag-inheritance=t
> --- Org
> * headline 1 :tag1:
> ** headline 2 :tag2:
> --- end org
>
> ...
> A solution that seems to work for me was to change
> (cl-copy-list cached-tags)
> to
> (mapcar #'copy-sequence cached-tags)
Fixed.
Thanks for the detailed analysis and the solution! I have seen this bug
myself in the past, but was not able to reproduce reliably.
Best,
Ihor
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2022-01-21 14:54 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-01-20 11:42 [BUG] org-element-cache: The inherited property is set wrong Anders Johansson
2022-01-20 13:34 ` Anders Johansson
2022-01-21 11:56 ` Ihor Radchenko
2022-01-20 18:16 ` Kaushal Modi
2022-01-21 11:58 ` Ihor Radchenko
2022-01-21 14:50 ` org-element-cache: org-set-tags (C-c C-q) makes Emacs unresponsive at times Kaushal Modi
2022-01-21 11:54 ` [BUG] org-element-cache: The inherited property is set wrong Ihor Radchenko
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.