From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Is it valid to call isearch-filter-predicate outside isearch? Date: Wed, 31 May 2023 15:44:14 +0300 Message-ID: <83edmwfz6p.fsf@gnu.org> References: <875y8nks9t.fsf@localhost> <86pm6sb5g8.fsf@mail.linkov.net> <87ttvsn77s.fsf@localhost> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="580"; mail-complaints-to="usenet@ciao.gmane.io" Cc: juri@linkov.net, emacs-devel@gnu.org To: Ihor Radchenko Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed May 31 14:44:17 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 1q4LBY-000AWE-Hh for ged-emacs-devel@m.gmane-mx.org; Wed, 31 May 2023 14:44:16 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q4LAv-0001BI-6I; Wed, 31 May 2023 08:43:37 -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 1q4LAr-00016J-Nt for emacs-devel@gnu.org; Wed, 31 May 2023 08:43:35 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q4LAp-0004gw-4W; Wed, 31 May 2023 08:43:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=QMk0C68syDkF6360hSNVbWyMAv/AY9dImBwZ52V7YOs=; b=a23Hbji2i6GV qsa2cCtt3NizKDmjOzLnLbk/2D4NJ6U0j2ySiJLMCZRQWBSxbTPDEszXEKV7EV0h2QDpzTU/PmiHx WLYIXwCENerr2jKHEF6jyilaRkrl6TBOCsxoE6U1hzGXhuD8H8QETCuZQLAJQwLIgevgMfr4Z8+L6 y/DQc8dWRASlWU+A0Qo2jcYMw5LOfZcvu+ZCdKfHJ6OjYi6UDOn8Z7466azq+kPbyresfazR/Qtuo KGYqWZr3Wfx9ukAM635cQB4ZCYsAjcXm0EPZg+hPDSuyObzYeVjdwiHpAwYlt4ycz3afcOdnsjIND kpiqwliaBn2725gqW3qvKA==; Original-Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q4LAo-0008TX-Ga; Wed, 31 May 2023 08:43:30 -0400 In-Reply-To: <87ttvsn77s.fsf@localhost> (message from Ihor Radchenko on Wed, 31 May 2023 10:08:55 +0000) 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:306440 Archived-At: > From: Ihor Radchenko > Cc: emacs-devel@gnu.org > Date: Wed, 31 May 2023 10:08:55 +0000 > > Juri Linkov writes: > > > Emacs 29 introduced a new value 'can-be-opened' of the variable > > 'search-invisible' for side-effect-free uses. > > > > Probably you can bind it to this value in Org mode functions. > > Not really. Because Org produces its own side effects to make isearch > support revealing text hidden via text properties. > > I guess the answer to my question about `isearch-filter-predicate' is > yes - it may be called outside isearch and thus custom > `isearch-filter-predicate' must consider scenarios outside isearch. > > It would be nice if the docstring of `isearch-filter-predicate' > mentioned that it might be called outside isearch-mode. I don't really understand what you are asking here to document. From reading the discussion, it sounds like you set isearch-filter-predicate to a function that relies on some (unidentified) isearch hooks to undo its side effects? And you did that without studying all of the existing callers of isearch-filter-predicate? Not sure how documentation could have solved this for you. In general, a predicate is not expected to have side effects, it is expected to return a boolean value and leave everything else intact. (I also don't understand what does isearch-range-invisible have to do with this.)