From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id oErJCv29imBYjQAAgWs5BA (envelope-from ) for ; Thu, 29 Apr 2021 16:09:01 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id KB1aBv29imCqWAAAB5/wlQ (envelope-from ) for ; Thu, 29 Apr 2021 14:09:01 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id A7BFE21CEB for ; Thu, 29 Apr 2021 16:09:00 +0200 (CEST) Received: from localhost ([::1]:41980 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lc7Lf-0001q7-R2 for larch@yhetil.org; Thu, 29 Apr 2021 10:08:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42220) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lc7LI-0001pe-TQ for emacs-orgmode@gnu.org; Thu, 29 Apr 2021 10:08:36 -0400 Received: from mail-lf1-x135.google.com ([2a00:1450:4864:20::135]:33596) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lc7LG-0001TF-36 for emacs-orgmode@gnu.org; Thu, 29 Apr 2021 10:08:36 -0400 Received: by mail-lf1-x135.google.com with SMTP id j4so65612085lfp.0 for ; Thu, 29 Apr 2021 07:08:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:in-reply-to:references:cc:date:message-id :mime-version; bh=VABVtRyaxk7ufu3aGzQsNBvnHRHf7cA5gT2YXmyjLZA=; b=NoI7bVkhnMrLGfUkj0r48Fq/3yxNOljXvV26yvLORL5HLetI2yNwIWcArlwQ4yqycV v8FQ0rp6VaiPv+hqJ/uS3E3Xfp8u/JTHlDGtJxHwmnYHaXfZpJpbKMtwGVI2aqnXVNwk xBKoX6UpNt+2791pb4zw/+SlhAq3MDhBwPR+YoT3rVZZZpPqlBOsxyYuMMKSDocSYbEL 18opigQVg3GrSKvSmbQCTKymrham7JnZrMqr2kmXb9RLuB80ycXAaU2NA1I03kroL/V3 N1MAeKTUUqnbktsWqZE/5kWvwpT+B9Uf2eGAjylWe45DQCM13a0RShYD3PMNVJeUaTay PUyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:in-reply-to:references:cc:date :message-id:mime-version; bh=VABVtRyaxk7ufu3aGzQsNBvnHRHf7cA5gT2YXmyjLZA=; b=i4xbY+momouEN0BQ/L9RtLGVfLmrYfBLkLxppoIqbsuYF9wsehZK3Ou4/ukxlskbOI ifKH5ZpkNefB3NtzNRg2owPiNvG7fj/uYgjRJpvdHl/EeHHSvlsKnueWFMeBK9vT6sO4 RsjaSoHlOUedgC54xcRgTNNMpU/4FmP0cc+vI1IR3k1LNf87LGCpVA/eJ3yCJuVRH9iJ wpDGrlJVfsMMd2T8069jgUKK7iZOW0KFE+okIZSHMYTcxx1R/M/sgqICgLOYqBcUX5oX dHGFNNAHnjlZX1D4vLnCGBmPIGlnv4AiVXwQzgqfbtSSYxtqglwJPxadusDtrsUoEOsi abeA== X-Gm-Message-State: AOAM5331zrT3VIZySK6f7Nc6Lqn2gBNylOOCXqAUYZRtyFkwMEGFbrbz WnE8rFdht64Gw30Wa0f2LVs= X-Google-Smtp-Source: ABdhPJzzBsDrMtQ8HMHvDXjQGV6chX3jltvekACbGtPQw00K+eaXCTECSgsTD+3odZWSzfMgjFVhGQ== X-Received: by 2002:a05:6512:146:: with SMTP id m6mr24818110lfo.628.1619705312061; Thu, 29 Apr 2021 07:08:32 -0700 (PDT) Received: from localhost ([158.255.2.9]) by smtp.gmail.com with ESMTPSA id w4sm539911lfu.105.2021.04.29.07.08.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Apr 2021 07:08:31 -0700 (PDT) From: Ihor Radchenko To: Maxim Nikulin Subject: Re: [PATCH] Bug: fragile org refile cache In-Reply-To: References: <87v98598un.fsf@localhost> Date: Thu, 29 Apr 2021 22:12:56 +0800 Message-ID: <87k0olxjpz.fsf@localhost> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=2a00:1450:4864:20::135; envelope-from=yantar92@gmail.com; helo=mail-lf1-x135.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: emacs-orgmode@gnu.org Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1619705340; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=VABVtRyaxk7ufu3aGzQsNBvnHRHf7cA5gT2YXmyjLZA=; b=Hce8xvQW4w//lPqWB9kSS1YbzVC0VtZ4z4yV4UWjwDk/IWDzctaWhX7ylaon3rnFrL4TZk 5d/h++15YZMPD12ORyOLI05C18O/J4Lz0prUdy6vDtVe2RN61tlBC4IZUbiphdUdQJaX9E RnNUR7LcN83VmwBUmTxSvTJCnDm5IB+0RMBK6viyERlmBw+N6Lq93nAhg/PA8n0yBw66Bw zssfczv99ffh7rZh8VDZwH6TmvNacsc6iaUMxHS0b6TzKA2yybaM034Rm+QT0DVsLLq1mv Lx4zG0BgTLI7s1EL80P8Uhgs36XHd7nnGd1GRmVQrdxyF1Qgm3VS04XL8LryPQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1619705340; a=rsa-sha256; cv=none; b=pPk5DWXCzH+WtRpxg43LkzCQDBgeTtbdvtBr2jliBNXqgcOdklZghhGeU/DDXVypeGTCdb X1+WDqzuLY1E9OrXnan2puhVdT5FmNeXaETVUQVWejjsnUe8f7JP9dZ1LW8/vtMciJRgMy yyjjRcv6s/gYyR3OaKY16gFKEZkgZgUiroXSoqj5L3YYBALpoThbAglCXx+z26BRyXj50U SbGD3wX4KU4ZWmPMoO9YVY/brV0KYf5W9Y3wWN95KmV7OAiAZYfeOuqvZKNc6XA557KK2v Ha4RMeRVMSJxu/vlF1Wog3MljnDGrHo0r+doysrU6duPStJQOzggWZ0cxlqUAw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=NoI7bVkh; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Spam-Score: -2.66 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=NoI7bVkh; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Queue-Id: A7BFE21CEB X-Spam-Score: -2.66 X-Migadu-Scanner: scn0.migadu.com X-TUID: Au1qP5P+HpQH Maxim Nikulin 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