emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nicolas Goaziou <mail@nicolasgoaziou.fr>
To: Ihor Radchenko <yantar92@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: Bug: org-element-at-point on headline does not contain :parent property [9.3 (release_9.3 @ /home/yantar92/.emacs.d/straight/build/org/)]
Date: Wed, 05 Feb 2020 15:46:00 +0100	[thread overview]
Message-ID: <8736bp2itz.fsf@nicolasgoaziou.fr> (raw)
In-Reply-To: <87y2thrvnn.fsf@localhost> (Ihor Radchenko's message of "Wed, 05 Feb 2020 21:49:48 +0800")

Ihor Radchenko <yantar92@gmail.com> writes:

> Thanks for the clarification. I was not sure if it is intended.
> I was mislead about this 2 times because of docstring, though it is
> clear from the source code.

I fixed the docstring. Thank you.

>> Luckily, headlines are exactly where you do _not_ need Element library.
>> `org-back-to-heading' and `org-up-heading-safe' will always be faster,
>> and as accurate. I.e., the code operating on headlines is usually
>> distinct from the code handling other elements.
>
> Well. `org-back-to-heading` + `org-up-heading-safe` take more than 15% of
> my agenda generation time (I have really huge number of headings +
> multiple custom skip functions). I was hoping to use cache for speed
> up. 

Cache will not help you here. `org-up-heading-safe' and
`org-back-to-heading' are faster than `org-element-at-point' + cache.

Moreover, custom skip functions are a pain. They prevent any form of
caching during agenda creation. IMO, Agenda (or its re-implementation)
should do without them.

>> You can parse the full document and get all the :parent properties
>> filled. That's not the job for `org-element-at-point'.
>
> I once tried to do exactly this, but I did not manage to figure out how
> to obtain element at point from full parse tree (from inside an agenda
> skip function). Is it possible?

It is possible but not implemented.

>> Note that `org-element-cache' was disabled a while ago because it could
>> introduce freezes. I think this is related to how this part handles
>> `before-change-functions' and `after-change-functions'. Anyway, YMMV.
>
> I see... I don't know how useful the cache is except my idea about
> using cache to speed up agenda. But I was stuck with the :parent
> property issue and did not play much further since that time.

I once started to implement Agenda-specific caching, but stopped as it
would have entailed rewriting much of the Agenda code. It would have
been a pain. Even switching "org-agenda.el" to lexical binding is
difficult (and isn't done yet).

Some re-implementation of Agenda (e.g., org-super-agenda + org-ql) may
be better wrt caching.

      reply	other threads:[~2020-02-05 14:46 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-16 12:17 Bug: org-element-at-point on headline does not contain :parent property [9.3 (release_9.3 @ /home/yantar92/.emacs.d/straight/build/org/)] Ihor Radchenko
2020-02-05  7:19 ` Bastien
2020-02-05  9:55   ` Ihor Radchenko
2020-02-05 10:13     ` Bastien
2020-02-05 12:55     ` Nicolas Goaziou
2020-02-05 13:49       ` Ihor Radchenko
2020-02-05 14:46         ` Nicolas Goaziou [this message]

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.orgmode.org/

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

  git send-email \
    --in-reply-to=8736bp2itz.fsf@nicolasgoaziou.fr \
    --to=mail@nicolasgoaziou.fr \
    --cc=emacs-orgmode@gnu.org \
    --cc=yantar92@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/org-mode.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).