From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: David Kastrup Newsgroups: gmane.emacs.devel Subject: Re: how to control isearch for invisible text Date: Sun, 13 Aug 2006 09:14:46 +0200 Message-ID: <854pwh3y55.fsf@lola.goethe.zz> References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1155453315 15836 80.91.229.2 (13 Aug 2006 07:15:15 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 13 Aug 2006 07:15:15 +0000 (UTC) Cc: Drew Adams , Emacs-Devel Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Aug 13 09:15:14 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1GCABl-0005Ka-9x for ged-emacs-devel@m.gmane.org; Sun, 13 Aug 2006 09:15:13 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GCABk-00051j-Gm for ged-emacs-devel@m.gmane.org; Sun, 13 Aug 2006 03:15:12 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1GCABX-0004zX-SN for emacs-devel@gnu.org; Sun, 13 Aug 2006 03:14:59 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1GCABX-0004zG-An for emacs-devel@gnu.org; Sun, 13 Aug 2006 03:14:59 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GCABX-0004zC-3l for emacs-devel@gnu.org; Sun, 13 Aug 2006 03:14:59 -0400 Original-Received: from [199.232.76.164] (helo=fencepost.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.52) id 1GCAH4-0006up-Bu for emacs-devel@gnu.org; Sun, 13 Aug 2006 03:20:42 -0400 Original-Received: from localhost ([127.0.0.1] helo=lola.goethe.zz) by fencepost.gnu.org with esmtp (Exim 4.34) id 1GCABW-00046l-CJ; Sun, 13 Aug 2006 03:14:58 -0400 Original-Received: by lola.goethe.zz (Postfix, from userid 1002) id 9B98F1C4D3AD; Sun, 13 Aug 2006 09:14:46 +0200 (CEST) Original-To: Stefan Monnier In-Reply-To: (Stefan Monnier's message of "Sat, 12 Aug 2006 20:28:24 -0400") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:58349 Archived-At: Stefan Monnier writes: >> - documenting `isearch-invisible' in the Emacs manual? >> - and the Elisp manual? >> - creating a toggle for it? >> - having `occur' and `query-replace' respect the option? > > I think `occur' always makes things visible because it copies text > and overlays are not copied along, so the invisibility gets lost. I > do think query-replace should be improved to open invisible text > just like isearch does. For what it's worth, preview-latex contains the following code: (defadvice replace-highlight (before preview) "Make `query-replace' open preview text about to be replaced." (preview-open-overlays (overlays-in (ad-get-arg 0) (ad-get-arg 1)))) (defcustom preview-query-replace-reveal t "*Make `query-replace' autoreveal previews." :group 'preview-appearance :type 'boolean :require 'preview :set (lambda (symbol value) (set-default symbol value) (if value (ad-enable-advice 'replace-highlight 'before 'preview) (ad-disable-advice 'replace-highlight 'before 'preview)) (ad-activate 'replace-highlight)) :initialize #'custom-initialize-reset) Text opened by preview-open-overlays gets closed again when post-command-hook finds it has left the region. It turns out that for XEmacs we do things differently for some reason: probably it does not have the invisible open properties. There we have (defun preview-open-overlay (ovr ignored) "Open the active preview OVR, IGNORED gets ignored. NIL is returned: this is for `map-extents'." (preview-toggle ovr) (push ovr preview-temporary-opened) nil) (defadvice isearch-highlight (before preview protect disable) "Make isearch open preview text that's a search hit. Also make `query-replace' open preview text about to be replaced." (map-extents #'preview-open-overlay nil (ad-get-arg 0) (ad-get-arg 1) nil nil 'preview-state 'active)) I remember it took quite a long time to find this least invasive place for the advice, so it is likely that the call places of replace-highlight might be the best location for implementing this functionality within Emacs. Bonus points if it does not clash with preview-latex's current implementation... -- David Kastrup, Kriemhildstr. 15, 44793 Bochum