unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: David Kastrup <dak@gnu.org>
Cc: Drew Adams <drew.adams@oracle.com>, Emacs-Devel <emacs-devel@gnu.org>
Subject: Re: how to control isearch for invisible text
Date: Sun, 13 Aug 2006 09:14:46 +0200	[thread overview]
Message-ID: <854pwh3y55.fsf@lola.goethe.zz> (raw)
In-Reply-To: <jwvk65dwr5g.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Sat, 12 Aug 2006 20:28:24 -0400")

Stefan Monnier <monnier@iro.umontreal.ca> 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

  reply	other threads:[~2006-08-13  7:14 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-12  8:30 how to control isearch for invisible text Drew Adams
2006-08-12  8:49 ` David Kastrup
2006-08-12 17:09   ` Drew Adams
2006-08-12 17:16     ` David Kastrup
2006-08-12 17:56       ` Drew Adams
2006-08-12 19:21         ` David Kastrup
2006-08-12 20:54           ` Drew Adams
2006-08-12 21:02             ` David Kastrup
2006-08-12 21:17               ` Drew Adams
2006-08-12 21:34                 ` David Kastrup
2006-08-12 22:07                   ` Drew Adams
2006-08-12 22:27                     ` David Kastrup
2006-08-12 23:02                       ` Drew Adams
2006-08-13  0:28     ` Stefan Monnier
2006-08-13  7:14       ` David Kastrup [this message]
2006-08-13 17:52         ` Richard Stallman
2006-08-13 18:00           ` David Kastrup
2006-08-14  0:36           ` Stefan Monnier
2006-08-14  7:12             ` David Kastrup
2006-08-14 12:14               ` Stefan Monnier
2006-08-14 12:24                 ` David Kastrup
2006-08-14 12:59                   ` Stefan Monnier
2006-08-14 13:48                     ` David Kastrup
2006-08-14 14:43                       ` Stefan Monnier
2006-08-14 15:05                         ` David Kastrup
2006-08-14 15:23                           ` Drew Adams
2006-08-14 15:32                             ` David Kastrup
2006-08-15 12:41                             ` Richard Stallman
2006-08-15 12:40             ` Richard Stallman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=854pwh3y55.fsf@lola.goethe.zz \
    --to=dak@gnu.org \
    --cc=drew.adams@oracle.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).