all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Ihor Radchenko <yantar92@gmail.com>
To: Maxim Nikulin <manikulin@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: [PATCH] Bug: fragile org refile cache
Date: Thu, 29 Apr 2021 22:12:56 +0800	[thread overview]
Message-ID: <87k0olxjpz.fsf@localhost> (raw)
In-Reply-To: <s6e9pv$4n1$1@ciao.gmane.io>

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


  reply	other threads:[~2021-04-29 14:09 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-28 16:09 [PATCH] Bug: fragile org refile cache Maxim Nikulin
2021-04-29  0:50 ` Samuel Wales
2021-04-29  1:29   ` Ihor Radchenko
2021-04-29  1:34     ` Samuel Wales
2021-04-29 12:45       ` Maxim Nikulin
2021-04-29 14:12         ` Ihor Radchenko [this message]
2021-04-29 15:04           ` Maxim Nikulin
2021-04-29 16:08             ` Ihor Radchenko
2021-04-29 16:51               ` Maxim Nikulin
2021-04-30 16:56               ` Maxim Nikulin
2021-05-01 14:48               ` Maxim Nikulin
2021-05-02  6:59                 ` Ihor Radchenko
2021-05-04 16:55                   ` Maxim Nikulin
2021-05-05  0:53                     ` Ihor Radchenko
2021-04-29 13:30       ` Ihor Radchenko
2021-04-29 19:17         ` Tim Cross
2021-04-29 22:43           ` Samuel Wales
2021-05-02  7:03           ` 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:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

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

  git send-email \
    --in-reply-to=87k0olxjpz.fsf@localhost \
    --to=yantar92@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=manikulin@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 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.