- Subject: Re: An isearch command that wraps?
- From: Lloyd Zusman <ljz@xxxxxxxxxx>
- Date: Sun, 14 Nov 2004 11:04:15 -0500
At Sun, 14 Nov 2004 10:09:14 -0500,
Lloyd Zusman wrote:
>
> At Sun, 14 Nov 2004 12:34:06 +0100,
> Paul Boekholt wrote:
> >
> > [ ... ]
>
> And don't just take my word for it; note this text from the Gnu Emacs
> "info" page on incremental searching:
>
> If a search is failing and you ask to repeat it by typing another
> `C-s', it starts again from the beginning of the buffer. Repeating a
> failing reverse search with `C-r' starts again from the end. This is
> called "wrapping around", and `Wrapped' appears in the search prompt
> once this has happened. If you keep on going past the original
> starting point of the search, it changes to `Overwrapped', which means
> that you are revisiting matches that you have already seen.
>
> In my original message, the outline I posted for what I'd like jed's
> isearch to do is exactly this.
I just hacked out this patch of isearch.sl (against the B0.99.17
version). It doesn't put the text "Wrapped" or "Overwrapped" into the
prompt, but I don't consider that to be an important feature. Other
than that, it works the same as Gnu Emacs' isearch with regard to
"wrapping around".
But like any software that is thown together in 20 minutes, it may very
well be lacking something important. Therefore, are any of you folks
willing to look it over, test it, etc., and let me know what else needs
to be done in order to make it more robust and correct?
Thanks.
*** isearch.sl.orig Sun Nov 14 10:32:29 2004
--- isearch.sl Sun Nov 14 10:52:55 2004
***************
*** 16,21 ****
--- 16,23 ----
variable Isearch_Forward_Char = 19; %^S
variable Isearch_Backward_Char = 18; %^R
+ static variable Isearch_Last_Search_Failed = 0;
+
static define get_bound_key (search_func, default)
{
variable n, key;
***************
*** 39,44 ****
--- 41,47 ----
#iffalse
variable fun, prompt;
+ Isearch_Last_Search_Failed = 0;
prompt = "Search:";
fun = &fsearch;
***************
*** 53,58 ****
--- 56,62 ----
!if (@fun (Isearch_Last_Search))
error ("Not Found.");
#else
+ Isearch_Last_Search_Failed = 0;
if (dir < 0)
search_backward ();
else
***************
*** 208,213 ****
--- 212,237 ----
if (c == Isearch_Forward_Char) go_left_1();
flush (str + " not found.");
beep ();
+ if (Isearch_Last_Search_Failed)
+ {
+ Isearch_Last_Search_Failed = 0;
+ loop (m) { pop (); pop_mark (0);}
+ m = 0;
+ if (dir > 0)
+ {
+ bob();
+ }
+ else
+ {
+ eob();
+ }
+ perform_search (str, dir);
+ continue;
+ }
+ else
+ {
+ Isearch_Last_Search_Failed = 1;
+ }
() = input_pending (10);
if (() == 1) str = isearch_del (str);
--m; pop_mark (0); % top of stack already popped in test
--
Lloyd Zusman
ljz@xxxxxxxxxx
God bless you.
--------------------------
To unsubscribe send email to <jed-users-request@xxxxxxxxxxx> with
the word "unsubscribe" in the message body.
Need help? Email <jed-users-owner@xxxxxxxxxxx>.
[2004 date index]
[2004 thread index]
[Thread Prev] [Thread Next]
[Date Prev] [Date Next]