* context around incremental search
@ 2013-11-06 18:13 Josh Stratton
2013-11-06 18:21 ` Drew Adams
2013-11-06 19:08 ` Michael Heerdegen
0 siblings, 2 replies; 8+ messages in thread
From: Josh Stratton @ 2013-11-06 18:13 UTC (permalink / raw)
To: help-gnu-emacs
Is there a way to restrict the incremental search such that a selected item
is always centered? A lot of times I'm search for text and the item I jump
to is at the bottom of the window and I'd like to see stuff under it. This
seems to happen a lot depending on how code is laid out. For example, if
I'm looking at how a member variable is set in a big file of classes, the
search item is usually at the bottom of the screen and without leaving
incremental search, I can't tell what's below it (using arrow keys or
Ctrl-L to center the line).
^ permalink raw reply [flat|nested] 8+ messages in thread
* RE: context around incremental search
2013-11-06 18:13 context around incremental search Josh Stratton
@ 2013-11-06 18:21 ` Drew Adams
2013-11-06 19:23 ` Peter Dyballa
2013-11-06 19:08 ` Michael Heerdegen
1 sibling, 1 reply; 8+ messages in thread
From: Drew Adams @ 2013-11-06 18:21 UTC (permalink / raw)
To: Josh Stratton, help-gnu-emacs
> Is there a way to restrict the incremental search such that a
> selected item is always centered? A lot of times I'm search for
> text and the item I jump to is at the bottom of the window and
> I'd like to see stuff under it. This seems to happen a lot
> depending on how code is laid out. For example, if I'm looking
> at how a member variable is set in a big file of classes, the
> search item is usually at the bottom of the screen and without
> leaving incremental search, I can't tell what's below it (using
> arrow keys or Ctrl-L to center the line).
Yes, set option `isearch-allow-scroll' to non-nil.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: context around incremental search
2013-11-06 18:13 context around incremental search Josh Stratton
2013-11-06 18:21 ` Drew Adams
@ 2013-11-06 19:08 ` Michael Heerdegen
1 sibling, 0 replies; 8+ messages in thread
From: Michael Heerdegen @ 2013-11-06 19:08 UTC (permalink / raw)
To: help-gnu-emacs
Josh Stratton <strattonbrazil@gmail.com> writes:
> Is there a way to restrict the incremental search such that a selected item
> is always centered? A lot of times I'm search for text and the item I jump
> to is at the bottom of the window and I'd like to see stuff under it. This
> seems to happen a lot depending on how code is laid out.
As Drew said, setting `isearch-allow-scroll' non-nil will enable you to
scroll yourself without leaving isearch.
If you want automatic scrolling, consider binding `scroll-margin' to
something > 0.
Regards,
Michael.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: context around incremental search
2013-11-06 18:21 ` Drew Adams
@ 2013-11-06 19:23 ` Peter Dyballa
2013-11-06 19:44 ` Drew Adams
0 siblings, 1 reply; 8+ messages in thread
From: Peter Dyballa @ 2013-11-06 19:23 UTC (permalink / raw)
To: Drew Adams; +Cc: help-gnu-emacs, Josh Stratton
Am 06.11.2013 um 19:21 schrieb Drew Adams:
> Yes, set option `isearch-allow-scroll' to non-nil.
I don't think that's sufficient. I have this variable set to `t' and I saw found texts sticking to the bottom. Michael's hint needs to be follwed. Then there are few lines kept to the bottom.
--
Greetings
Pete
Without vi there is only GNU Emacs
^ permalink raw reply [flat|nested] 8+ messages in thread
* RE: context around incremental search
2013-11-06 19:23 ` Peter Dyballa
@ 2013-11-06 19:44 ` Drew Adams
2013-11-06 19:57 ` Peter Dyballa
0 siblings, 1 reply; 8+ messages in thread
From: Drew Adams @ 2013-11-06 19:44 UTC (permalink / raw)
To: Peter Dyballa; +Cc: help-gnu-emacs, Josh Stratton
> > Yes, set option `isearch-allow-scroll' to non-nil.
>
> I don't think that's sufficient. I have this variable set to `t' and
> I saw found texts sticking to the bottom. Michael's hint needs to be
> follwed. Then there are few lines kept to the bottom.
Sufficient for what? And what does your last sentence mean?
Please give a recipe or description, to explain what you mean.
The point of the option is to _allow_ scrolling commands/keys. It
should be sufficient to set the option to non-nil, in order to let
you use `C-l', `C-v', etc. without exiting Isearch. Is that not what
you see?
What Michael mentioned was something different, which has to do
with when the window is automatically recentered, based on how close
point is to the window top or bottom. He was right to mention it,
in addition to `isearch-allow-scroll'.
The OP was a bit ambiguous. Both things were hinted at:
* "I can't tell what's below it (using arrow keys or Ctrl-L to center
the line)." IOW, allow scrolling commands (i.e., on demand).
* "such that a selected item is always centered" IOW, presumably
_automatic_ scrolling to keep point in the center.
Two different behaviors. Depends what one wants.
- Drew, who toggles allowing scrolling on/off during Isearch, and
who sets `scroll-margin' to 0
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: context around incremental search
2013-11-06 19:44 ` Drew Adams
@ 2013-11-06 19:57 ` Peter Dyballa
2013-11-07 22:20 ` Josh Stratton
[not found] ` <mailman.5523.1383862856.10748.help-gnu-emacs@gnu.org>
0 siblings, 2 replies; 8+ messages in thread
From: Peter Dyballa @ 2013-11-06 19:57 UTC (permalink / raw)
To: Drew Adams; +Cc: help-gnu-emacs, Josh Stratton
Am 06.11.2013 um 20:44 schrieb Drew Adams:
> Sufficient for what?
Sufficient for keeping some lines distance to the bottom of the buffer, in order to display the environment around the found text.
> And what does your last sentence mean?
It means that setting `isearch-allow-scroll' to non-nil allows to use C-l while in isearch. Additionally setting `scroll-margin' to a value N greater than zero allows to keep those N lines distance to the bottom of the buffer. I think that's what Josh is wishing.
--
Greetings
Pete
"When you breath, you inspire. When you do not breath, you expire."
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: context around incremental search
2013-11-06 19:57 ` Peter Dyballa
@ 2013-11-07 22:20 ` Josh Stratton
[not found] ` <mailman.5523.1383862856.10748.help-gnu-emacs@gnu.org>
1 sibling, 0 replies; 8+ messages in thread
From: Josh Stratton @ 2013-11-07 22:20 UTC (permalink / raw)
To: Peter Dyballa; +Cc: help-gnu-emacs
Thanks everyone. Both those settings will be very helpful.
(setq isearch-allow-scroll 1)
(setq scroll-margin 2)
On Wed, Nov 6, 2013 at 11:57 AM, Peter Dyballa <Peter_Dyballa@web.de> wrote:
>
> Am 06.11.2013 um 20:44 schrieb Drew Adams:
>
> > Sufficient for what?
>
> Sufficient for keeping some lines distance to the bottom of the buffer, in
> order to display the environment around the found text.
>
> > And what does your last sentence mean?
>
> It means that setting `isearch-allow-scroll' to non-nil allows to use C-l
> while in isearch. Additionally setting `scroll-margin' to a value N greater
> than zero allows to keep those N lines distance to the bottom of the
> buffer. I think that's what Josh is wishing.
>
> --
> Greetings
>
> Pete
>
> "When you breath, you inspire. When you do not breath, you expire."
>
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: context around incremental search
[not found] ` <mailman.5523.1383862856.10748.help-gnu-emacs@gnu.org>
@ 2013-11-08 18:58 ` jpkotta
0 siblings, 0 replies; 8+ messages in thread
From: jpkotta @ 2013-11-08 18:58 UTC (permalink / raw)
To: help-gnu-emacs
Recenter after isearch finds a match:
(defun recenter-no-redraw (&optional arg)
(interactive "P")
(let ((recenter-redisplay nil))
(recenter arg)))
;; recenter the cursor after finding a match
(defadvice isearch-search (after isearch-recenter activate)
(when isearch-success
(recenter-no-redraw)))
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2013-11-08 18:58 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-06 18:13 context around incremental search Josh Stratton
2013-11-06 18:21 ` Drew Adams
2013-11-06 19:23 ` Peter Dyballa
2013-11-06 19:44 ` Drew Adams
2013-11-06 19:57 ` Peter Dyballa
2013-11-07 22:20 ` Josh Stratton
[not found] ` <mailman.5523.1383862856.10748.help-gnu-emacs@gnu.org>
2013-11-08 18:58 ` jpkotta
2013-11-06 19:08 ` Michael Heerdegen
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).