unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Teach isearch to open invisible only if visible search failed?
@ 2010-12-05  6:41 Leo
  2010-12-05  6:52 ` Suvayu Ali
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Leo @ 2010-12-05  6:41 UTC (permalink / raw)
  To: help-gnu-emacs

Hello all Emacsen,

I use C-s/r for navigating around text a lot and I have found it slows
me down in large text shown in outline structure in outline or org mode
etc. So I wonder how to set up isearch so that it only opens invisible
text when search in the visible fails.

My attempt is like this but it doesn't work as smoothly as I'd like.

(setq search-invisible nil)
(add-hook 'isearch-update-post-hook
          (lambda () (when (and (or (not isearch-success)
                                    isearch-error)
                                ;; prevent infinite loop
                                (not (eq search-invisible 'open)))
                       (setq search-invisible 'open)
                       (isearch-search)
                       (isearch-update))))
(add-hook 'isearch-mode-end-hook
          (lambda () (setq search-invisible nil)))

I wonder if someone familiar with isearch can propose a better setup.
Thanks in advance.

Leo




^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2010-12-05 17:29 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-05  6:41 Teach isearch to open invisible only if visible search failed? Leo
2010-12-05  6:52 ` Suvayu Ali
2010-12-05  7:01   ` Leo
2010-12-05  7:32 ` Thierry Volpiatto
2010-12-05  7:43   ` Leo
2010-12-05 11:52 ` Thien-Thi Nguyen
2010-12-05 12:45   ` Leo
2010-12-05 15:19 ` Drew Adams
2010-12-05 17:29   ` Leo

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).