From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id UDt/OwnWKWMqFwAAbAwnHQ (envelope-from ) for ; Tue, 20 Sep 2022 17:02:34 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id aEl8OwnWKWOifAAA9RJhRA (envelope-from ) for ; Tue, 20 Sep 2022 17:02:33 +0200 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 F1060FBEB for ; Tue, 20 Sep 2022 17:02:32 +0200 (CEST) Received: from localhost ([::1]:44290 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oaelc-0007dm-2x for larch@yhetil.org; Tue, 20 Sep 2022 11:02:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48622) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oacbs-0002IA-5e for emacs-orgmode@gnu.org; Tue, 20 Sep 2022 08:44:23 -0400 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:34699) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oacbp-0004Cz-UM for emacs-orgmode@gnu.org; Tue, 20 Sep 2022 08:44:19 -0400 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 908E25C00A6; Tue, 20 Sep 2022 08:44:14 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Tue, 20 Sep 2022 08:44:14 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ypei.org; h=cc :cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm3; t=1663677854; x= 1663764254; bh=y2EZNn3t9EOO4xTVsug5Tk9ObFkW4wH5+R48IIqo9T8=; b=b /EBbHtc9zbM9FtgkLlaUWHpSsDijgZGjGL0muoRJruUW7gVcCQeNADhx/HSi3JZy ecZq34GZTRYVQeHsYiaok052fuKfkuSlx9t8NrmOqN56DZ9fxUqlgHP4RfbjoKnw M15RpV5Bed2d2dL2734JOS1Ia6PtC75lKWtwbCZs8/UwPsZgbfEfAji29KHpJHfi ySLOVku+25xunMt9ht+rWtOZfq8YZWXN691PDJZSCiqDa1m9nJyxtRNKO5NX2DTz alNxbnWLGdXVXo+20NhaTW5e/nkn+W0NJ2Ho8Z1nYvQuJsb81uS+DyEuK7xL7VsU sE82D5vL5IXhmrfF1kPuQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1663677854; x= 1663764254; bh=y2EZNn3t9EOO4xTVsug5Tk9ObFkW4wH5+R48IIqo9T8=; b=X y2f8uI35H2mKeMtmnCsbVjvB1dPiGH3l906XGT8Wbrdi8dHPnXLHO7G2l8GyBShR Oj1mc/JSzvoDjQmAYZ4IEaQR23Uf6ZMK7gmjFRAIdfK5MP6fxI5y5GqJF6c+U0Fy QYpYkZvXf/OlwecSGGxV5GQSYlLr3AJ6PGTo2GQFP42u6wEMAabDy0qAPEKgyNmG 47BQ+aiFyuae9OhcmXWF2gUSCH7BUg+weupF8Kup91jeRxmmP7DCvvJbnKobxua2 VgXTo21JLnjHAxCbykOiJvzSxtGd5UUSqr6w3kcwmvu3pfPmT4FSpnNyYr3gqpS+ 6F/sKwe5bba6hTl+6Lx1g== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrfedvledgheejucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufhffjgfkfgggtgfgsehtqhertddtreejnecuhfhrohhmpegjuhgt hhgvnhcurfgvihcuoehiugeshihpvghirdhorhhgqeenucggtffrrghtthgvrhhnpeduff ejkeevieekjeelgfegteefvedthfegleefgfehgfffuddthfdvveefjedugeenucffohhm rghinhepmhgrgihlvghvvghlrdhorhhgpdhorhhgmhhouggvrdhorhhgpdhgnhhurdhorh hgpdihphgvihdrohhrghenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgr ihhlfhhrohhmpehiugeshihpvghirdhorhhg X-ME-Proxy: Feedback-ID: i51b146f9:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 20 Sep 2022 08:44:12 -0400 (EDT) From: Yuchen Pei To: Max Nikulin Cc: emacs-orgmode mailing list Subject: Re: [PATCH] Fixing refile cache use for org-goto in indirect buffers. References: <87zgevvs6e.fsf@ypei.org> <7b2b5134-46c4-2db2-1322-a2d1257cbf30@gmail.com> Date: Tue, 20 Sep 2022 22:44:07 +1000 In-Reply-To: <7b2b5134-46c4-2db2-1322-a2d1257cbf30@gmail.com> (Max Nikulin's message of "Mon, 19 Sep 2022 22:48:34 +0700") Message-ID: <87h712tduw.fsf@ypei.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=66.111.4.27; envelope-from=id@ypei.org; helo=out3-smtp.messagingengine.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.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, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_PASS=-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.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1663686153; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=y2EZNn3t9EOO4xTVsug5Tk9ObFkW4wH5+R48IIqo9T8=; b=VjU8vVnSu/U72p5HP+Z8inr/yn5pZ85MSqOnydExjpvwbKYBYx1aNBaScdM4DaWJPESKjz ijVHWWewvILBVDapCBPcvnyHKmLpmUzNQslKMpOoBNUat/pirGGX6XrnremXjFggmM8JI+ t8j0LqQ14B9Olz0P6/tp4ajFN8Py9wtepElaFTfbyVQxf7Jk/UviUriWubtK3NmsTOhI82 T3DROlBtMbQDqkjhVhqggzNw5pYqp0yFcflpgCXweYyRAOEnDlJ5Ai6QTetxThDPwr/jbC 2D++40XANOskHGcjh4bbawuGGLCQ0wZBFNDjNyZq/L6wc2DelP+2pPaBPudpVQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1663686153; a=rsa-sha256; cv=none; b=jfnQ6JqoQhXYvMYSP9+J71PLRRF+dGreK1JknM49313QDu0eqvBUAW+qq8Sz178mgRDbHV nC7LL8PKkwkXHAniqafvJkP/Jz/FbdOTHbsxQ47lxjT2IEjFYUnmJyoYyGZ0/C+xB4yr+B CaPS/Ie1hRkYFbdeuYv/MNgN7n8NmSo6kccQvGgeMjGnfYayVfEr2IAXBP9T8FN3/djqfz M2PoQIH2akK07+EEfGr6TeLmHoN/G41Jsa7FB5V4rIuvMMgWHKXIdVLStznq1lIoKLILov flGPu5uL29GU6F7H+Z2VLhyInxWldwkzZYwtjL23xd9Qi7VPnIFIeUHLbBDuWA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=ypei.org header.s=fm3 header.b="b /EBbHt"; dkim=fail ("headers rsa verify failed") header.d=messagingengine.com header.s=fm2 header.b="X y2f8uI"; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: 2.77 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=ypei.org header.s=fm3 header.b="b /EBbHt"; dkim=fail ("headers rsa verify failed") header.d=messagingengine.com header.s=fm2 header.b="X y2f8uI"; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: F1060FBEB X-Spam-Score: 2.77 X-Migadu-Scanner: scn1.migadu.com X-TUID: Bw5s89JDkV98 Thanks for the reply. On Mon 2022-09-19 22:48:34 +0700, Max Nikulin wrote: > On 19/09/2022 12:16, Yuchen Pei wrote: >> To reprod: >> - make sure the org-refile-targets generates a big enough list where >> the refile cache makes a difference >> - visit an org file in org-refile-targets >> - M-x clone-indirect-buffer-other-window >> - C-0 C-c C-w to clear cache >> - M-: (org-refile-get-targets) > > Have you tried to execute this command in the indirect buffer? Yes, and it would be instant (assuming (org-refile-get-targets) has been run in the original buffer). This is because the code path from org-goto has an overriding local binding of org-refile-targets to `((nil . (:maxlevel . ,org-goto-max-level)) before calling org-refile-get-location which calls org-refile-get-targets. > >> - org-goto in the original buffer takes no effort >> - but, org-goto in the indirect buffer takes time, which is unexpected. > >> diff --git a/lisp/org-refile.el b/lisp/org-refile.el >> index 16cff25bd..7189ef595 100644 >> --- a/lisp/org-refile.el >> +++ b/lisp/org-refile.el >> @@ -306,7 +306,10 @@ converted to a headline before refiling." >> (dolist (f files) >> (with-current-buffer (if (bufferp f) f (org-get-agenda-file-buffer = f)) >> (or >> - (setq tgs (org-refile-cache-get (buffer-file-name) descre)) >> + (setq tgs (org-refile-cache-get >> + (buffer-file-name (when (bufferp f) >> + (buffer-base-buffer f))) >> + descre)) > > Thank you for the attempt to improve handling of indirect buffers. > > I am afraid, more serious refactoring is required to reuse result of > `buffer-base-buffer', for the previous attempt to avoid issues with > `buffer-file-name' see > satotake to emacs-orgmode=E2=80=A6 [PATCH] org-refile.el: Fix the case of > *scratch* buffer. Sat, 15 May 2021 19:38:39 > +0900. https://list.orgmode.org/20210515103839.8574-2-doublequotation@gma= il.com > > There are several corner cases with `org-refile-cache', `org-goto', > and buffers. > - Perhaps buffer name, not file name should be used as the cache key > if some buffer is not associated with any file. Alternatively cache > should not be used at all. It seems there may be problem with this idea. If buffer name is the key, that will mean a buffer and its indirect clone will generate two caches, which duplicates the work, no? > - When an indirect buffer is narrowed down to some region > (e.g. created using `org-tree-to-indirect-buffer') jump targets > should be filtered to the displayed range. > > So the change is an improvement (I would prefer `and' instead of > `when' in such expression, but it does not really matter). Leaving > aside other issues and more serious refactoring, it seems, storing > results to the cache requires a similar fix, so perhaps it is possible > to move "(setq f ...)" code above of "(or ...)" and reuse f as the > cache key. Sure, I will update my patch when I get around to it again. > > Please, send patches produced by "git format-patch" command. > I guess you had some problem applying the patch? I did use (ma)git-format-patch, but had some difficulty of getting gnus to send the formatted patch (I basically visited the patch file and ran (message-mode), but it was missing a few header fields compared to composing a new mail from gnus, so I manually copied over these fields). This was why I sent two emails. The first one[1] had an odd extra bit of Message-ID at the bottom of the message. Is this the one you were referring to as not being "standard", or is the other one[2] also not quite right? [1] https://lists.gnu.org/archive/html/emacs-orgmode/2022-09/msg00322.html [2] https://lists.gnu.org/archive/html/emacs-orgmode/2022-09/msg00323.html Best, Yuchen --=20 PGP Key: 47F9 D050 1E11 8879 9040 4941 2126 7E93 EF86 DFD0