From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.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 eIydErKTKGNG/wAAbAwnHQ (envelope-from ) for ; Mon, 19 Sep 2022 18:07:14 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id OGKKErKTKGOwlQAAauVa8A (envelope-from ) for ; Mon, 19 Sep 2022 18:07:14 +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 DA1675918 for ; Mon, 19 Sep 2022 18:07:13 +0200 (CEST) Received: from localhost ([::1]:34630 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oaJ1z-0008IJ-2Z for larch@yhetil.org; Mon, 19 Sep 2022 11:49:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51868) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oaJ0p-0008Fx-31 for emacs-orgmode@gnu.org; Mon, 19 Sep 2022 11:48:47 -0400 Received: from mail-lj1-x232.google.com ([2a00:1450:4864:20::232]:46995) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oaJ0m-00089v-BE for emacs-orgmode@gnu.org; Mon, 19 Sep 2022 11:48:46 -0400 Received: by mail-lj1-x232.google.com with SMTP id p5so34347867ljc.13 for ; Mon, 19 Sep 2022 08:48:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :sender:from:to:cc:subject:date; bh=flWfrFJFCQTEgNgClfpIogjYV6PxeSSE7pF/tJoU8QI=; b=j/oxTU7Ev635UzVpubVrmpHpi2vBrIFY1NdirR6SYjjfdduh72nrQIpuswfQ6IFofW b+ApuP362pz8OycrdPabMiPpnhspbRYzAl5qUjZguwC3HZwT9zwD+BE5ZJwXgLPcvieR wjBsRKdpDz206Z+G0k6gxZoxdUJyHG9Xl+uH3X1lAlYYZxW2ta8JGH69wIhYo7cQDJAl OHB5fzj2ipyq3MWJLKodv7uRdoNuMZ2kTZ9KUk28W9/CeGzfO96JZRDUtfoNYOJKX5OT 2QTApxFV1lksuLbm7r37Bm99ApF2xdD2nT9IYeC7ZE4eAIYNeJpt1HyU9xeIiuro8Xmw qKNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :sender:x-gm-message-state:from:to:cc:subject:date; bh=flWfrFJFCQTEgNgClfpIogjYV6PxeSSE7pF/tJoU8QI=; b=0Zv9cmesG7Cf3Iaz1A/dIKZHlgujgELzaH94i1s3VGqlCVk+aBTv4rIR5bzyxBw3Z6 1TaiCfbIwdaOa5RPp5BzK+HoQ6/zokQGIPWzgDeOcKWDz7g2eR2EtmmwPRifyTUhPSUY OGWXraUPgSLs7j9sby8ccc6YIO3t4nq0S7RfyjeiGqSjWe4HWNF8YaLQur2xKvitBivQ pBf3elVPD+WnjsgqBKS6QRmzZfl2ox2ZfhJqiiiAeoJRd487ZUHUJgf+IkYFh5qxB8Tc nW50GQ3DWnXYduY1RrBIDYxWUhV096Q5JzbybSC2gWKLooskgdx+nq86yvmdIJwMX7YH 8TTw== X-Gm-Message-State: ACrzQf2txQvUi4VamjchINTvmJlDPKVZliM5Yhm+7UygFYkQ+e10oJ4p kseibx1+T1VZWFkJAbsEVQSY66n3Oso= X-Google-Smtp-Source: AMsMyM5MLcbe2qIJ/4hGY1aOMxp5+lOq/2s/9/UjdYEUYadfoBLh7d2D/Dpg3L38SmjDviP9eENzBA== X-Received: by 2002:a05:651c:4cf:b0:26b:dc6f:26c6 with SMTP id e15-20020a05651c04cf00b0026bdc6f26c6mr5624925lji.41.1663602517195; Mon, 19 Sep 2022 08:48:37 -0700 (PDT) Received: from [192.168.0.101] (nat-0-0.nsk.sibset.net. [5.44.169.188]) by smtp.googlemail.com with ESMTPSA id b20-20020a2ebc14000000b0026c15d60ad1sm602159ljf.132.2022.09.19.08.48.35 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 19 Sep 2022 08:48:36 -0700 (PDT) Message-ID: <7b2b5134-46c4-2db2-1322-a2d1257cbf30@gmail.com> Date: Mon, 19 Sep 2022 22:48:34 +0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Subject: Re: [PATCH] Fixing refile cache use for org-goto in indirect buffers. Content-Language: en-US To: Yuchen Pei , emacs-orgmode mailing list References: <87zgevvs6e.fsf@ypei.org> From: Max Nikulin In-Reply-To: <87zgevvs6e.fsf@ypei.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2a00:1450:4864:20::232; envelope-from=manikulin@gmail.com; helo=mail-lj1-x232.google.com X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 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_FROM=0.001, NICE_REPLY_A=-0.952, 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.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=1663603634; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to: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=flWfrFJFCQTEgNgClfpIogjYV6PxeSSE7pF/tJoU8QI=; b=bC6GA9r/n++ndouKGj++4qGYhK//4lJ9QN04quGVy3Rac5Bp5CMftdR0BjPQpvTfhiH1s7 F3n7SN8tg8ligslmcesfFdaMQ48xaS6oV5iijfrW38JraI6UAAmMF17fIj8yK+APKozjlt WZJqgp0MvB3SEYO4rOWnNHj57wI/0PUpKHRsZzrD147DvR9JoqnOQ7vY0f33WzDaYw9p59 Rd/FGYZtewAdeDHBDtamPTQ8sW9mnCZ+4XoVYcwSERqMZ2tIeyDPqCqme+NfK20yz9tRCK zElih+Aih8MV5e++zCZc0Jyni9VZ20YYsWQeSDUYC1/aA0rRxDCnOEAOJ4rxfA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1663603634; a=rsa-sha256; cv=none; b=oeBDnHDYGFFo3CDNUm6KBMNLxUkmNtknGmRapUa+jIUHMqOEgsrHufiV5P1+7WipTxD66n uwY3Q2dhpLDdEs0mniCGNrgW3sYa/AwRXfWCKanzWBTa1Knfd4d02kVDLU5Tl3vUfusku9 vdiTXgZM2QBShdhmXjcAXauTxavg/WDa+9FiHoGf/9xY49thQG9eMxB1YRuAU+6+I7fKii offqZJe3TfnCgx+//rMrB8uIxsFmUoH2hSUy0YRNhfOKvrni+1jj4lvDDfqvV654swBX3S szStT3AjOYHgLZvvgyXCGnWrzxRZXWezWaoIxii3PbYIM/WCj6yBKejLvgi4ug== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b="j/oxTU7E"; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=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: 5.56 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b="j/oxTU7E"; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=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: DA1675918 X-Spam-Score: 5.56 X-Migadu-Scanner: scn0.migadu.com X-TUID: amoah5z2itD2 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? > - 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… [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@gmail.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. - 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. Please, send patches produced by "git format-patch" command.