[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] Bug: fragile org refile cache
From: |
Ihor Radchenko |
Subject: |
Re: [PATCH] Bug: fragile org refile cache |
Date: |
Thu, 29 Apr 2021 22:12:56 +0800 |
Maxim Nikulin <manikulin@gmail.com> writes:
> Maybe I could avoid org-goto as well. Actual reason to use it was that
> it does not ask for file name as the first step in the case of
> (org-refile-use-outline-path 'file). It took enough time to me to
> realize how to jump/refile to non-leaf heading without such settings.
Note that Org mode has integration with imenu. It is an alternative you
can use to jump around current buffer.
> Just an idea. Is it possible to implement some specific text property
> for heading lines, namely cleaned out heading text (no cookies, tags,
> hidden parts of links), that is updated after each editing (likely
> something like font locks)? It could significantly speed up scanning
> buffer for goto/refile targets. Unfortunately it would not help for
> files that have not opened yet.
There is org-outline-path-cache used by org-get-outline-cache. It avoids
computing parent's outline path multiple times, which is already a great
improvement.
For the cleaned heading text, I do not think that re-calculating the
heading text on each change is a good idea. It may degrade typing
latency. Yet, an acceptable approach could be simply invalidating cache
for the changed headings. Then, outline paths can be re-calculated on
changed headings when needed. This should be an improvement compared to
blanket (setq org-outline-path-cache nil) in org-refile-get-targets.
> To be clear, org-refile and org-goto share the same cache and it is the
> source of the problem.
I would say that the problem is rather org-goto (ab)using org-refile
incorrectly. I have the following piece of elisp using org-refile
mechanism for headline selection:
(let ((org-refile-history (append saved-id parent-project))
(org-refile-cache nil)
(org-refile-target-verify-function #'org-att-id-skip-function))
(let ((prompt-ans (org-refile-get-location "Link to attachment from")))
(prog1
(org-id-get (seq-find #'markerp
prompt-ans)
'create))))
org-refile-cache can be simply let-bound to nil (in my case) or
alternative cache variable, if the alternative cache should persist.
Best,
Ihor
- [PATCH] Bug: fragile org refile cache, Maxim Nikulin, 2021/04/28
- Re: [PATCH] Bug: fragile org refile cache, Samuel Wales, 2021/04/28
- Re: [PATCH] Bug: fragile org refile cache, Ihor Radchenko, 2021/04/28
- Re: [PATCH] Bug: fragile org refile cache, Samuel Wales, 2021/04/28
- Re: [PATCH] Bug: fragile org refile cache, Maxim Nikulin, 2021/04/29
- Re: [PATCH] Bug: fragile org refile cache,
Ihor Radchenko <=
- Re: [PATCH] Bug: fragile org refile cache, Maxim Nikulin, 2021/04/29
- Re: [PATCH] Bug: fragile org refile cache, Ihor Radchenko, 2021/04/29
- Re: [PATCH] Bug: fragile org refile cache, Maxim Nikulin, 2021/04/29
- Re: [PATCH] Bug: fragile org refile cache, Maxim Nikulin, 2021/04/30
- Re: [PATCH] Bug: fragile org refile cache, Ihor Radchenko, 2021/04/29
- Re: [PATCH] Bug: fragile org refile cache, Tim Cross, 2021/04/29
- Re: [PATCH] Bug: fragile org refile cache, Samuel Wales, 2021/04/29