From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Michael Heerdegen Newsgroups: gmane.emacs.devel Subject: Re: Is it valid to call isearch-filter-predicate outside isearch? Date: Thu, 01 Jun 2023 02:40:21 +0200 Message-ID: <87fs7c10cq.fsf@web.de> References: <875y8nks9t.fsf@localhost> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="14142"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: emacs-devel@gnu.org To: Ihor Radchenko Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Jun 01 02:41:46 2023 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1q4WNu-0003Wc-Gp for ged-emacs-devel@m.gmane-mx.org; Thu, 01 Jun 2023 02:41:46 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q4WMy-00078l-3F; Wed, 31 May 2023 20:40:48 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q4WMw-00078b-9l for emacs-devel@gnu.org; Wed, 31 May 2023 20:40:46 -0400 Original-Received: from mout.web.de ([212.227.15.14]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q4WMk-0006HI-3c for emacs-devel@gnu.org; Wed, 31 May 2023 20:40:46 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=s29768273; t=1685580022; i=michael_heerdegen@web.de; bh=Q6X71U9xixNX52O4rEhR64uzRoKd7RrOzdCQHUGECyg=; h=X-UI-Sender-Class:From:To:Cc:Subject:In-Reply-To:References:Date; b=A6ASGlcAIySdM0uR+YNtw39m1PkWOir0PhThX1xBlSI+HisE+GCIZ1RV9bNzVFwXC m62azzyNhUaWAIDCLh3XBWuiMA+iHb5yBcVCA8gaHPEWrD8c9Kpsp86Pcp6/akZ3aU rBsN4oNjpYnUlGmyicrmmpB/b/zYeFH/eZQF0tu0+iFjrs0JTGa9YDbonF7LydaizM zDVu/0v44zpDM+dqLGjYoj1BRm0Jzm30kdKZeyjmNGWB71sw+hvzS9ifMhm3FYLjYM DL1QfnW15lm4a+G5hXBYy9St0WmjDXbucxx7GjswVt9OcmJl7piFZ9L6HIIhDH2GkQ T8iQvkxSdhEfg== X-UI-Sender-Class: 814a7b36-bfc1-4dae-8640-3722d8ec6cd6 Original-Received: from drachen.dragon ([178.14.74.62]) by smtp.web.de (mrweb006 [213.165.67.108]) with ESMTPSA (Nemesis) id 1MRk4s-1pff922LwQ-00TAV9; Thu, 01 Jun 2023 02:40:22 +0200 In-Reply-To: <875y8nks9t.fsf@localhost> (Ihor Radchenko's message of "Sat, 20 May 2023 14:10:38 +0000") X-Provags-ID: V03:K1:aSZQARGs9J+/AUDZc1HaOG6b/LjN3GhMwnkZywtEIhB68/vsV+K NchgFd6C8GV3w6GIhsQ2UrkYyAbF+jmZXeLE/hh4TKgmbicjNqlVPfJcyPqwIGPKd+8Ar40 0yAvL1naD/SsLJFNN+b4hbcPkeIK+3xSmgl7s2bMVtFWqe4sWY1bt+F054HVYvJNP3RRx5H PJ6b5YoEXlqDWhUw37e3Q== UI-OutboundReport: notjunk:1;M01:P0:/pyOmtOoZmg=;nhbRUYJf7x/DVYpEU/uWnFNiGr6 m1DViRxmNy4kCvCbpY8Mg3bXrafubvbnJIuYeyPl3NrE8nCrsf30fYGMUDRqh+ClMemJKt0FH xzWFhte1PeIgFOkdyy3X/8spzl3dxtXPKN7Yibwfeue13eR8SZk8KG7WSdxGOHQXfb2NoK8kO 8sHGLBoet4/oTbif0PXOf8boH7lk8yx6PFDWqHZ0gAx4z1wpsxa5ADAtE8JeFZ7atATmxHful kuC+5hOHL7C5HBrGgHyIMlqMcgbFJme/hUL5h1oUKpUJc5mg0VXFAQnwrYj45ftuX28gCbONs CA8goAH7lhBVA/Gaeh5y4/ZnLUwUy2efZSDPgbwaegu+u57QARVhXskrcJSeoaYTnIJRJWp0l k5vD3KG65Xvvw42s29zhFGEPaa9FcagHoyX8wbUvrnQ62O7/gy5oLhWXO2FvKZ2rBibzfVLSg RfjO00+UxIWVXRmYs55Yd304MsX33fpeU5O4mg3eDZecu0bITdOlY0hQyq6TrajxFe+521KFV UjO3hstaqUP4qQkrF3lVZjBLnzGRxH5JCz86eL52/3WEU66onIPJ7OVx19RRtWUYzGYK6e7Vv 5dkyk8o1xKeEAWw/CylTfUHBRP7eVi+EvnAIz8v5D/vZdDBIVI48p6x4rNBliSwdfhCOXzGwC h334izWtshSpw6JP6/WkYoqig1ejw1Go8Epr8uH2HPpeCqf18MTGDpY1N+4AoPNS1l+V7dkcY 9TzL+D64gX4O9ohJxoJH2ByoRangeFaKJMf5oYg2jC7w7LMVr+HexwTtyEhR3M/OhByPPRMW Received-SPF: pass client-ip=212.227.15.14; envelope-from=michael_heerdegen@web.de; helo=mout.web.de 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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:306472 Archived-At: Ihor Radchenko writes: > Hi, > > I am now investigating an Org mode issue related to interaction between > Org mode folding and isearch. > https://list.orgmode.org/orgmode/CAP7OBx+L11ck3Ni6rv94HGU3otdj6C4rG-rMDzkwR1LTj=BWiw@mail.gmail.com/ The answer to the subject is probably: query-replace is also ok, else "no". > Org mode overrides the default value of isearch-filter-predicate with > > (defun org-fold-core--isearch-filter-predicate-overlays (beg end) > "Return non-nil if text between BEG and END is deemed visible by isearch. > This function is intended to be used as `isearch-filter-predicate'." > (org-fold-core--create-isearch-overlays beg end) ;; trick isearch by creating overlays in place of invisible text > (isearch-filter-visible beg end)) > > As you can see, Org produces side effects when the predicate is > called. (if (org-fold-core-get-folding-spec-property spec :isearch-open) (overlay-put o 'isearch-open-invisible #'delete-overlay) (overlay-put o 'isearch-open-invisible #'ignore) (overlay-put o 'isearch-open-invisible-temporary #'ignore)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Can't you bind this to a function that does what you want? AFAIU it is called with two arguments - the overlay itself and a bool saying "open" (nil) or "re-hide" (non-nil). That should allow to not rely on any hooks to remove your helper overlays. Unless, maybe, not all of them are opened. Can that happen? If it does, maybe using `post-command-hook' would be a better choice than `isearch-end-hook' (which is, obviously, not a good choice)? Michael.