From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#64178: replace-regexp ignoring value of org-search-invisible Date: Thu, 22 Jun 2023 19:52:25 +0300 Organization: LINKOV.NET Message-ID: <86h6qzxx2e.fsf@mail.linkov.net> References: <87v8fiseja.fsf@localhost> <87mt0usaah.fsf@localhost> <875y7hhmoo.fsf@localhost> <87v8fhf747.fsf@localhost> <86ttv00z7c.fsf@mail.linkov.net> <87ttv0c4zx.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="15135"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu) Cc: bobf32@gmail.com, 64178@debbugs.gnu.org To: Ihor Radchenko Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Jun 22 18:55:13 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1qCNaT-0003ni-42 for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 22 Jun 2023 18:55:13 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qCNaK-0006T1-7q; Thu, 22 Jun 2023 12:55:04 -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 1qCNaI-0006Sk-Lx for bug-gnu-emacs@gnu.org; Thu, 22 Jun 2023 12:55:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qCNaI-0007v5-C9 for bug-gnu-emacs@gnu.org; Thu, 22 Jun 2023 12:55:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qCNaI-0005EF-7u for bug-gnu-emacs@gnu.org; Thu, 22 Jun 2023 12:55:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 22 Jun 2023 16:55:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 64178 X-GNU-PR-Package: emacs Original-Received: via spool by 64178-submit@debbugs.gnu.org id=B64178.168745284620017 (code B ref 64178); Thu, 22 Jun 2023 16:55:02 +0000 Original-Received: (at 64178) by debbugs.gnu.org; 22 Jun 2023 16:54:06 +0000 Original-Received: from localhost ([127.0.0.1]:36597 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qCNZN-0005Cm-Kk for submit@debbugs.gnu.org; Thu, 22 Jun 2023 12:54:05 -0400 Original-Received: from relay2-d.mail.gandi.net ([217.70.183.194]:56919) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qCNZK-0005CE-HV for 64178@debbugs.gnu.org; Thu, 22 Jun 2023 12:54:03 -0400 X-GND-Sasl: juri@linkov.net X-GND-Sasl: juri@linkov.net X-GND-Sasl: juri@linkov.net Original-Received: by mail.gandi.net (Postfix) with ESMTPSA id E1D9C4000C; Thu, 22 Jun 2023 16:53:54 +0000 (UTC) In-Reply-To: <87ttv0c4zx.fsf@localhost> (Ihor Radchenko's message of "Thu, 22 Jun 2023 07:48:02 +0000") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:263895 Archived-At: >>> Ok. Then, it is not an Org mode bug. >> >> Actually, Isearch never supported zero-length invisible matches. >> The following condition was in isearch.el since day 1: >> >> (defun isearch-range-invisible (beg end) >> "Return t if all the text from BEG to END is invisible." >> (when (/= beg end) >> >> So any zero-length match is deemed visible by Isearch. > > Which is unexpected. > It is natural to expect that zero-width matches are considered invisible > when the surrounding text is invisible. > > Also, is this documented anywhere? This corner case doesn't seem to be documented. Probably not for emacs-29, but something like this would require more testing: #+begin_src diff diff --git a/lisp/isearch.el b/lisp/isearch.el index 3d2bbda4975..162b99233d7 100644 --- a/lisp/isearch.el +++ b/lisp/isearch.el @@ -3798,7 +3798,7 @@ isearch-close-unnecessary-overlays (defun isearch-range-invisible (beg end) "Return t if all the text from BEG to END is invisible." - (when (/= beg end) + (when t ;; Check that invisibility runs up to END. (save-excursion (goto-char beg) @@ -3812,7 +3812,8 @@ isearch-range-invisible ;; If the following character is currently invisible, ;; skip all characters with that same `invisible' property value. ;; Do that over and over. - (while (and (< (point) end) (invisible-p (point))) + (while (and (or (= beg end (point)) (< (point) end)) + (invisible-p (point))) (if (invisible-p (get-text-property (point) 'invisible)) (progn (goto-char (next-single-property-change (point) 'invisible @@ -3843,7 +3844,7 @@ isearch-range-invisible (setq crt-overlays (append ov-list crt-overlays))))) (goto-char (next-overlay-change (point))))) ;; See if invisibility reaches up thru END. - (if (>= (point) end) + (if (and (not (= beg end (point))) (>= (point) end)) (if (and can-be-opened (consp crt-overlays)) (progn (unless (eq search-invisible 'can-be-opened) #+end_src