jed-users mailing list

[2005 Date Index] [2005 Thread Index] [Other years]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]

Re: no key for search again


This is a reply to a message of a week ago. I tried to send it several times but it never came through. Let's try that again...

Holger Lillqvist wrote:


Just hit <enter>. After the first search there is a message: "Press
RET to search again".


Yes, but if you type anything else (for example to scroll the window or
modify the text) it exits from the search and you have to start it all
over again.

It's something that's been annoying me too, but not enough to do
anything about it (like implement the neccessary function).

I was about to post this, but thought "hey, *now* is the time to do it".

So here it is. Put this in your .jedrc

========== CUT HERE =========
require ("search");

static define setup_case_search (pat)
{
   variable cs = CASE_SEARCH;
   if (strlow (pat) != pat)
     {
        CASE_SEARCH = 1;
     }

   return cs;
}

define search_generic_noprompt (dir, line_ok_fun)
{
   variable str, not_found = 1;

   str = LAST_SEARCH;
   !if (strlen(str)) return;

   push_mark ();

   variable cs = setup_case_search (str);
   ERROR_BLOCK
     {
        pop_mark (not_found);
        CASE_SEARCH = cs;
     }

   if ((dir > 0) and looking_at(str)) go_right_1 ();

   save_search_string (str);

   not_found = not (search_maybe_again (&search_across_lines, str, dir,
                                        line_ok_fun));
   if (not_found) verror ("%s: not found.", str);

   EXECUTE_ERROR_BLOCK;
}

define search_next ()
{
   search_generic_noprompt (1, &_function_return_1);
}
======== CUT HERE ====================

And bind search_next to any the key you want to use (I have no idea on
how to put in the menu as I don't use it).

Note: the functon setup_case_search() is copied straight from search.sl
as it's static and can't be used.
search_generic_noprompt() is a slightly modified version of
search_generic_search().

All this could be done more elegantly bu modifying search.sl.

P.S. Just a suggestion for the list maintainer: put
jed-users@xxxxxxxxxxx in the Reply-To: header, so that a simple reply
will go to the list by default. I sent this mail just to Holger by mistake.

--
Vladan Bato
vbato@xxxxxxxx



--------------------------
To unsubscribe send email to <jed-users-request@xxxxxxxxxxx> with
the word "unsubscribe" in the message body.
Need help? Email <jed-users-owner@xxxxxxxxxxx>.


[2005 date index] [2005 thread index]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]