🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: news.software.readers
5 messages
5 total messages Started by Renaud Colinet Tue, 22 Feb 2000 00:00
Re: slrn: How difficult to implement RE for Subject search?
#58332
Author: Renaud Colinet
Date: Tue, 22 Feb 2000 00:00
98 lines
3572 bytes
On Mon, Feb 21 2000 17:32:09 GMT, Open Mike wrote:
>I realize that "waddaya want fah nuthin, rrruuubbbbahhh biskitt?"
>but how difficult would it be to add the capability of regular
>expressions on the "Subject" search? Many newsgroups I look through
>have pages and pages of the same subject and I'd like to be able
>to skip past by searching for not the first few characters of
>the subject.
>
Regexp search functions are already implemented in slrn. All you have to
do is use them in a macro.
For instance, copy the following code in a file called "re_search.sl"
(your home directory should be a fine place for it):

#v+
% This macro allows one to search for a subject regexp through the articles in
% the current newsgroup.  It binds the function 're_subject_search_newsgroup'
% to the '$' key in article mode.

variable Search_Last_Re_Subj_Search_Str = "";
define re_subject_search_newsgroup ()
{
   variable str;
   
   str = read_mini ("Search for subject regexp",\
	Search_Last_Re_Subj_Search_Str, "");
   if (str == "")
     return;

   Search_Last_Re_Subj_Search_Str = str;
	if (re_fsearch_subject(str))
	     return;
   error ("Not found.");
}
definekey ("re_subject_search_newsgroup", "$", "article");
#v-

and add the following line in your .slrnrc:
interpret "re_search.sl"

Then pressing the '$' will prompt you for a regexp to be searched.
Note : it does a forward search. Programming a backward search is left
as an exercize to the reader :-)

>On that same subject, would it be possible, maybe with a macro,
>to implement arg count on the "previous" and "next" article
>commands? In other words, ESC 20 CTRL-N would skip 20 articles
>forward.
>
AFAIK, having a prefix argument can't be done without hacking the
source. You can change the header_down function in art.c to:
#v+

static void header_down (void) /*{{{*/
{
   int prefix;
   
   if (Slrn_Prefix_Arg_Ptr != NULL)
     {
	prefix = *Slrn_Prefix_Arg_Ptr;
	Slrn_Prefix_Arg_Ptr = NULL;
     }
   else prefix = 1;
   
   slrn_header_down_n (prefix, 1);
}
#v-

and recompile slrn. (It works, but it hasn't been checked for unwanted
side effects)

Another method is to write a macro that prompts you for the number of
headers you want to go down by:

#v+
variable Header_Down_Last_Number = "";
define header_down_n ()
{
  variable str;
  variable n;

  str = read_mini("How many headers down", Header_Down_Last_Number,"");
  if (str == "")
    return;

  Header_Down_Last_Number = str;
  n = integer(str);
  header_down (n);
}
definekey ("header_down_n" ,"D","article");
#v-

HTH
-- 
Renaud
The From: address is valid but filtered. Please use the Reply-To: address
for direct replies.

Re: slrn: How difficult to implement RE for Subject search?
#58333
Author: John E. Davis
Date: Tue, 22 Feb 2000 00:00
21 lines
1340 bytes
On 22 Feb 2000 22:02:02 GMT, Renaud Colinet <colinet@pervenche10.ensta.fr>
wrote:
>Another method is to write a macro that prompts you for the number of
>headers you want to go down by:

You can also write a macro that simply gets the prefix argument and then
moves down that many lines.  This would do exactly what the original
poster wanted, e.g., something (untested) like:
#v+
   define header_down_n ()
   {
      variable n = get_prefix_arg ();
      if (n == -1) n = 1;
      () = header_down (n);
   }
   definekey ("header_down_n" ,"D","article");
#v-

--John

Re: slrn: How difficult to implement RE for Subject search?
#58361
Author: Renaud Colinet
Date: Wed, 23 Feb 2000 00:00
14 lines
1311 bytes
On Feb 22 2000 23:24:14 GMT, John E. Davis wrote:
>
>You can also write a macro that simply gets the prefix argument and then
>moves down that many lines.  This would do exactly what the original
>poster wanted, e.g., something (untested) like:

I didn't know of this. Thanks for pointing it.

-- 
Renaud
The From: address is valid but filtered. Please use the Reply-To: address
for direct replies.

Re: slrn: How difficult to implement RE for Subject search?
#58369
Author: Open Mike
Date: Wed, 23 Feb 2000 00:00
27 lines
1720 bytes
On 22 Feb 2000 23:24:14 GMT, John E. Davis <davis@space.mit.edu> wrote:
>On 22 Feb 2000 22:02:02 GMT, Renaud Colinet <colinet@pervenche10.ensta.fr>
>wrote:
>>Another method is to write a macro that prompts you for the number of
>>headers you want to go down by:
>
>You can also write a macro that simply gets the prefix argument and then
>moves down that many lines.  This would do exactly what the original
>poster wanted, e.g., something (untested) like:
>#v+
>   define header_down_n ()
>   {
>      variable n = get_prefix_arg ();
>      if (n == -1) n = 1;
>      () = header_down (n);
>   }
>   definekey ("header_down_n" ,"D","article");
>#v-
>
>--John

Thanks folks, I'll try these tricks and see how well they work.

Mikey


Re: slrn: How difficult to implement RE for Subject search?
#58433
Author: those who know me have no need o...
Date: Thu, 24 Feb 2000 00:00
10 lines
1097 bytes
colinet@saumon4.ensta.fr (Renaud Colinet) wrote:
>Regexp search functions are already implemented in slrn. All you have to
>do is use them in a macro.

bah.  that's the answer to everything these days.

-- 
okay, have a sig then

Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads