emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Anders Johansson <mejlaandersj@gmail.com>
To: org-mode-email <emacs-orgmode@gnu.org>
Subject: [BUG] org-element-cache: The inherited property is set wrong
Date: Thu, 20 Jan 2022 12:42:04 +0100	[thread overview]
Message-ID: <CAKJdtO_O4-pmhattRF3M=QFtWG-S8qbOGYX2bY6LOjkefzBXyQ@mail.gmail.com> (raw)

I had some trouble with completing tags, where the already set tags
were wrongly identified. I have dug this down to a problem with

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)
(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)

Anders Johansson (who is otherwise as mentioned in an earlier
discussion very appreciative of org-element-cache)

             reply	other threads:[~2022-01-20 15:37 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-20 11:42 Anders Johansson [this message]
2022-01-20 13:34 ` [BUG] org-element-cache: The inherited property is set wrong 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

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:

  List information: https://www.orgmode.org/

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

  git send-email \
    --in-reply-to='CAKJdtO_O4-pmhattRF3M=QFtWG-S8qbOGYX2bY6LOjkefzBXyQ@mail.gmail.com' \
    --to=mejlaandersj@gmail.com \
    --cc=emacs-orgmode@gnu.org \


* 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


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).