all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / 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

* Re: Teach isearch to open invisible only if visible search failed?
  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
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 9+ messages in thread
From: Suvayu Ali @ 2010-12-05  6:52 UTC (permalink / raw)
  To: Leo; +Cc: help-gnu-emacs

On 05/12/10 07:41 AM, Leo wrote:
> 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.

I know this is not the answer you are looking for, but why don't you use
sparse trees (`C-c /') and then use the usual org-mode navigation
commands (the likes of `outline-previous-visible-heading' or
`outline-next-visible-heading') ?

-- 
Suvayu

Open source is the future. It sets us free.



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

* Re: Teach isearch to open invisible only if visible search failed?
  2010-12-05  6:52 ` Suvayu Ali
@ 2010-12-05  7:01   ` Leo
  0 siblings, 0 replies; 9+ messages in thread
From: Leo @ 2010-12-05  7:01 UTC (permalink / raw)
  To: Suvayu Ali; +Cc: help-gnu-emacs

On 2010-12-05 06:52 +0000, Suvayu Ali wrote:
> I know this is not the answer you are looking for, but why don't you use
> sparse trees (`C-c /') and then use the usual org-mode navigation
> commands (the likes of `outline-previous-visible-heading' or
> `outline-next-visible-heading') ?

That is org mode specific. I use org mode's fast command keys too but
C-s/C-r is almost what I use elsewhere.

Thanks for your reply.

Leo



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

* Re: Teach isearch to open invisible only if visible search failed?
  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:32 ` Thierry Volpiatto
  2010-12-05  7:43   ` Leo
  2010-12-05 11:52 ` Thien-Thi Nguyen
  2010-12-05 15:19 ` Drew Adams
  3 siblings, 1 reply; 9+ messages in thread
From: Thierry Volpiatto @ 2010-12-05  7:32 UTC (permalink / raw)
  To: help-gnu-emacs

Hi Leo,

Leo <sdl.web@gmail.com> writes:

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

I have no setting for isearch as i don't use it or really few (i use
only ioccur) but why not always opening all headers with `show-all' like
ioccur does?

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

-- 
A+ Thierry
Get my Gnupg key:
gpg --keyserver pgp.mit.edu --recv-keys 59F29997 




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

* Re: Teach isearch to open invisible only if visible search failed?
  2010-12-05  7:32 ` Thierry Volpiatto
@ 2010-12-05  7:43   ` Leo
  0 siblings, 0 replies; 9+ messages in thread
From: Leo @ 2010-12-05  7:43 UTC (permalink / raw)
  To: help-gnu-emacs

On 2010-12-05 07:32 +0000, Thierry Volpiatto wrote:
> I have no setting for isearch as i don't use it or really few (i use
> only ioccur) but why not always opening all headers with `show-all' like
> ioccur does?

I guess it is sort of a habit that varies from people to people. I
personally use isearch a lot though I love i/occur too.

Cheers.
Leo


-- 
Any Emacs contains an ad hoc, informally-specified, bug-ridden, slow
implementation of half of Common Lisp.




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

* Re: Teach isearch to open invisible only if visible search failed?
  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:32 ` Thierry Volpiatto
@ 2010-12-05 11:52 ` Thien-Thi Nguyen
  2010-12-05 12:45   ` Leo
  2010-12-05 15:19 ` Drew Adams
  3 siblings, 1 reply; 9+ messages in thread
From: Thien-Thi Nguyen @ 2010-12-05 11:52 UTC (permalink / raw)
  To: help-gnu-emacs

() Leo <sdl.web@gmail.com>
() Sun, 05 Dec 2010 06:41:40 +0000

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

What is the unsmoothness?



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

* Re: Teach isearch to open invisible only if visible search failed?
  2010-12-05 11:52 ` Thien-Thi Nguyen
@ 2010-12-05 12:45   ` Leo
  0 siblings, 0 replies; 9+ messages in thread
From: Leo @ 2010-12-05 12:45 UTC (permalink / raw)
  To: Thien-Thi Nguyen; +Cc: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 481 bytes --]

On 2010-12-05 11:52 +0000, Thien-Thi Nguyen wrote:
> () Leo <sdl.web@gmail.com>
> () Sun, 05 Dec 2010 06:41:40 +0000
>
>    My attempt is like this but it doesn't work as smoothly as I'd like.
>
> What is the unsmoothness?

I can get large traction of text highlighted as in this screenshot
http://imagebin.org/126334.

To reproduce this, with the setting posted previously, and isearch
"easy" from point-min in the file attached (make sure the body of
heading 'hide' is hidden).


[-- Attachment #2: test.org --]
[-- Type: text/plain, Size: 33 bytes --]

  feature


xyz


* hide
  least

[-- Attachment #3: Type: text/plain, Size: 59 bytes --]


Any idea how to improve the isearch setting?

Thanks.
Leo

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

* RE: Teach isearch to open invisible only if visible search failed?
  2010-12-05  6:41 Teach isearch to open invisible only if visible search failed? Leo
                   ` (2 preceding siblings ...)
  2010-12-05 11:52 ` Thien-Thi Nguyen
@ 2010-12-05 15:19 ` Drew Adams
  2010-12-05 17:29   ` Leo
  3 siblings, 1 reply; 9+ messages in thread
From: Drew Adams @ 2010-12-05 15:19 UTC (permalink / raw)
  To: 'Leo', help-gnu-emacs

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

FWIW, in Isearch+ I bind a key (`C-+') to toggle invisible-text sensitivity.
The standard user option `search-invisible' controls whether it invisible-text
searching on or off by default.

IOW, I treat this the same as case-sensitivity (or full-word search or regexp
search or...any other search choice).

Let the user control what to search while searching.  To me, this is better than
some DWIM that tries to second guess what I want.  Why would I (a) *always* and
(b) *only* want to search invisible text after searching visible text fails?

http://www.emacswiki.org/emacs/IsearchPlus




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

* Re: Teach isearch to open invisible only if visible search failed?
  2010-12-05 15:19 ` Drew Adams
@ 2010-12-05 17:29   ` Leo
  0 siblings, 0 replies; 9+ messages in thread
From: Leo @ 2010-12-05 17:29 UTC (permalink / raw)
  To: Drew Adams; +Cc: help-gnu-emacs

On 2010-12-05 15:19 +0000, Drew Adams wrote:
>> 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.
>
> FWIW, in Isearch+ I bind a key (`C-+') to toggle invisible-text sensitivity.
> The standard user option `search-invisible' controls whether it invisible-text
> searching on or off by default.
>
> IOW, I treat this the same as case-sensitivity (or full-word search or regexp
> search or...any other search choice).
>
> Let the user control what to search while searching.  To me, this is better than
> some DWIM that tries to second guess what I want.  Why would I (a) *always* and
> (b) *only* want to search invisible text after searching visible text fails?
>
> http://www.emacswiki.org/emacs/IsearchPlus

Thanks for that. But since this is for my personal use, DWIM works for
in this case.

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

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.