From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Bastien Newsgroups: gmane.emacs.bugs Subject: bug#16493: 24.3.50; (setq search-invisible t) is useless, let's allow to turn visible-mode temporarily on Date: Sun, 29 Apr 2018 11:50:58 +0200 Message-ID: <87wowql4sd.fsf@bzg.fr> References: <878uucaun0.fsf@bzg.ath.cx> <871u01zs19.fsf@mail.jurta.org> <87r481fuvk.fsf@bzg.ath.cx> <87k3dtl8lp.fsf@bzg.ath.cx> <87ppcwxiv9.fsf@mail.jurta.org> <87h9xw7puw.fsf@bzg.ath.cx> <87bno3vae9.fsf@bzg.ath.cx> <87zi1nl812.fsf@bzg.fr> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: blaine.gmane.org 1524995407 1950 195.159.176.226 (29 Apr 2018 09:50:07 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 29 Apr 2018 09:50:07 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) Cc: 16493@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Apr 29 11:50:02 2018 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fCiy1-0000MB-0i for geb-bug-gnu-emacs@m.gmane.org; Sun, 29 Apr 2018 11:50:01 +0200 Original-Received: from localhost ([::1]:54954 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fCj07-00016R-NT for geb-bug-gnu-emacs@m.gmane.org; Sun, 29 Apr 2018 05:52:11 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:39117) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fCj01-00016H-L0 for bug-gnu-emacs@gnu.org; Sun, 29 Apr 2018 05:52:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fCizy-0005H9-Ib for bug-gnu-emacs@gnu.org; Sun, 29 Apr 2018 05:52:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:34599) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fCizy-0005Gd-Dz for bug-gnu-emacs@gnu.org; Sun, 29 Apr 2018 05:52:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1fCizy-0006R7-6i for bug-gnu-emacs@gnu.org; Sun, 29 Apr 2018 05:52:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Bastien Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 29 Apr 2018 09:52:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 16493 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 16493-submit@debbugs.gnu.org id=B16493.152499547124682 (code B ref 16493); Sun, 29 Apr 2018 09:52:02 +0000 Original-Received: (at 16493) by debbugs.gnu.org; 29 Apr 2018 09:51:11 +0000 Original-Received: from localhost ([127.0.0.1]:42496 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fCiz9-0006Q1-1t for submit@debbugs.gnu.org; Sun, 29 Apr 2018 05:51:11 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:48034) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fCiz6-0006Pp-VT for 16493@debbugs.gnu.org; Sun, 29 Apr 2018 05:51:09 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fCiyy-0004Vp-KC for 16493@debbugs.gnu.org; Sun, 29 Apr 2018 05:51:03 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:41713) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fCiyy-0004Vi-F0; Sun, 29 Apr 2018 05:51:00 -0400 Original-Received: from [78.192.157.63] (port=58196 helo=bzg.fr) by fencepost.gnu.org with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.82) (envelope-from ) id 1fCiyy-0004RE-37; Sun, 29 Apr 2018 05:51:00 -0400 Original-Received: by bzg.fr (Postfix, from userid 1000) id 139A138CEA8; Sun, 29 Apr 2018 11:50:58 +0200 (CEST) In-Reply-To: (Stefan Monnier's message of "Sat, 28 Apr 2018 14:11:37 -0400") X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 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.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:145819 Archived-At: --=-=-= Content-Type: text/plain Hi Stefan, Stefan Monnier writes: >>> Removing just the text property seems cleaner. >> I guess this solution, though nice, is tricky to implement. > > Why do you think so? I looked at the way isearch does the temporary opening of overlays, and it looks complex to add another mechanism to temporarily ignore the 'invisible text property. At least I don't know how to do this. Also, I tried a preliminary patches (attached) which I find quite convenient and seems to do what I expected first when setting (setq search-invisible t): turning on visible-mode. The patch is not fully tested and incomplete, as query-replace is not handled, but that's a start. Let me know what you think. Thanks, -- Bastien --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=isearch.el.patch diff --git a/lisp/isearch.el b/lisp/isearch.el index 3725779..53958cc 100644 --- a/lisp/isearch.el +++ b/lisp/isearch.el @@ -665,6 +665,8 @@ isearch-input-method-local-p (defvar isearch--saved-overriding-local-map nil) +(defvar isearch-initial-visibility-state nil) + ;; Minor-mode-alist changes - kind of redundant with the ;; echo area, but if isearching in multiple windows, it can be useful. @@ -936,6 +938,8 @@ isearch-mode (if minibuffer-auto-raise (raise-frame frame)))) + (setq isearch-initial-visibility-state (or visible-mode -1)) + (when (eq isearch-invisible t) (visible-mode 1)) (setq isearch-mode " Isearch") ;; forward? regexp? (force-mode-line-update) @@ -1054,6 +1058,7 @@ isearch-done (remove-hook 'post-command-hook 'isearch-post-command-hook) (remove-hook 'mouse-leave-buffer-hook 'isearch-done) (remove-hook 'kbd-macro-termination-hook 'isearch-done) + (visible-mode isearch-initial-visibility-state) (setq isearch-lazy-highlight-start nil) (when (buffer-live-p isearch--current-buffer) (with-current-buffer isearch--current-buffer @@ -1608,7 +1613,9 @@ isearch--momentary-message (isearch--momentary-message (if (setq isearch-invisible (if isearch-invisible - nil (or search-invisible 'open))) + (and (visible-mode -1) nil) + (visible-mode 1) + (or search-invisible 'open))) "match invisible text" "match visible text"))) --=-=-=--