Thread View: news.software.readers
6 messages
6 total messages
Started by Chris Green
Wed, 05 Jan 2000 00:00
slrn 's' command, slight misfeature?
Author: Chris Green
Date: Wed, 05 Jan 2000 00:00
Date: Wed, 05 Jan 2000 00:00
16 lines
1292 bytes
1292 bytes
When using the 's' command in slrn to search article subjects it strikes me that once I've found a thread with the search string in the subject I don't want to find all the subsequent articles in the same thread when I hit 's' again. Is there any way of overcoming this or is the only way to explicitly move to the next thread before continuing the search? If the thread is uncollapsed it might make sense to search through the subjects of every article in the thread but when threads are collapsed it isn't what one expects. -- Chris Green (chris@x-1.net)
Re: slrn 's' command, slight misfeature?
Author: Dawn Owens-Nicholson
Date: Wed, 05 Jan 2000 00:00
Date: Wed, 05 Jan 2000 00:00
8 lines
930 bytes
930 bytes
Chris Green wrote: > Is there any way of overcoming this or is the only way to explicitly > move to the next thread before continuing the search? Yes, you could use a macro to make subject_search_forward (and subject_search_backward bound to "S" by default) behave as you wish.
Re: slrn 's' command, slight misfeature?
Author: Thomas Schultz
Date: Fri, 07 Jan 2000 00:00
Date: Fri, 07 Jan 2000 00:00
143 lines
5820 bytes
5820 bytes
On 05 January 2000 at 13:18 GMT, Chris Green <cgreen@shell.x-1.net> wrote:
> When using the 's' command in slrn to search article subjects it
> strikes me that once I've found a thread with the search string in
> the subject I don't want to find all the subsequent articles in the
> same thread when I hit 's' again.
Although this is not precisely what you are asking for, you might
consider using "temporary scoring" instead of searching. Some people
in de.comm.software.newsreader find it more convenient and if you
don't, the macro may be a starting point for your own.
You can "temporarily score" on author, subject and body of a message.
Each article that matches your search will receive a score you can
define by setting Temp_Score_Value (default is 1000); you can decide
if you want the "temporary scores" to override your usual scoring or
if you want them to be added to existing scores (this is the default,
set Temp_Score_Additive to 0 to change it).
The slang file below will automatically bind the macro to the key '�'
when interpreted by slrn. There is also additional functionality for
users of the NN emulation (the macro will notice when nn.sl is loaded
and automatically enable it) - matching articles will automatically be
'tagged' so you can navigate through them using the ']' and '[' keys.
Some former NN users told me they liked this macro better than the
original functionality of the NN newsreader.
To all slang experts: I would be happy to learn how this code could be
improved. In particular, I do not like the way the re-sorting of the
articles is done - finding out the sorting_method, ungetkey()ing it
and calling "toggle_sort" does work, but seems somewhat awkward.
Here we go...
% -*- slang -*-
% This macro allows one to "temporarily score" the current newsgroup based
% on subject, author or body. It binds the function 'temp_score_newsgroup'
% to the '%' key in article mode.
% The following variables can be used to influence the macro's behaviour:
% Temp_Score_Value - score that will be given to any article matching
% the search
% Temp_Score_Additive - if nonzero, the macro will add "score" to existing
% scores; if zero, it will simply overwrite them
variable Temp_Score_Value = 1000;
variable Temp_Score_Additive = 1;
% The macro is able to tag matching headers so you can select them using
% the functions defined in nn.sl. This is done only if you load nn.sl
% before this file.
variable Temp_Score_Nn_Tag_Header = is_defined("nn_tag_header");
variable Temp_Score_Last_Search_Str = "";
define temp_score_newsgroup ()
{
variable str;
variable deleted;
variable mode;
variable metamail; % Turn off use_metamail while searching
metamail = get_variable_value("use_metamail");
set_integer_variable("use_metamail",0);
mode = get_response ("aAbBsS", "Temporarily score based on "+
"\001Author, \001Body or \001Subject?");
str = read_mini ("Score on regexp", Search_Last_Art_Search_Str, "");
if (str == "")
return;
Search_Last_Art_Search_Str = str;
uncollapse_threads ();
while(header_up(1));
if ((mode == 'b') or (mode == 'B'))
{
do % cycle through all articles, scanning their bodies
{
deleted = (get_header_flags() & HEADER_READ);
if (re_search_article (str))
{
pop ();
if (Temp_Score_Additive)
set_header_score(get_header_score + Temp_Score_Value);
else set_header_score(Temp_Score_Value);
if (Temp_Score_Nn_Tag_Header)
eval("nn_tag_header ();");
}
else !if (Temp_Score_Additive) set_header_score(0);
!if (deleted)
set_header_flags (get_header_flags() & ~(HEADER_READ));
call ("hide_article");
} while (header_down(1));
}
else
{
!if (Temp_Score_Additive) % set all scores to 0 first
{
do set_header_score(0); while (header_down(1));
while (header_up(1));
}
switch(mode) % search for matching articles
{
case 'a' or case 'A' :
while (re_fsearch_author(str))
{
set_header_score(get_header_score + Temp_Score_Value);
if (Temp_Score_Nn_Tag_Header)
eval("nn_tag_header();");
!if (header_down(1)) break;
}
}
{
case 's' or case 'S' :
while (re_fsearch_subject(str))
{
set_header_score(get_header_score + Temp_Score_Value);
if (Temp_Score_Nn_Tag_Header)
eval("nn_tag_header();");
!if (header_down(1)) break;
}
}
}
collapse_threads();
ungetkey(typecast((string(get_variable_value("sorting_method"))),
Integer_Type));
call("toggle_sort");
while (header_up(1));
set_integer_variable("use_metamail", metamail); % restore metamail setting
}
definekey ("temp_score_newsgroup", "�", "article");
Re: slrn 's' command, slight misfeature?
Author: blue... Dawn Owens-Nicholson
Date: Sat, 08 Jan 2000 00:00
Date: Sat, 08 Jan 2000 00:00
32 lines
1786 bytes
1786 bytes
Thomas Schultz wrote:
> In particular, I do not like the way the re-sorting of the
> articles is done - finding out the sorting_method, ungetkey()ing it
> and calling "toggle_sort" does work, but seems somewhat awkward.
How about storing the sorting_method and resetting it with
set_integer_variable("sorting_method", ...)?
> while(header_up(1));
call("header_bob") will scale better on large groups (also virtual groups
might come which means still larger groups).
> if ((mode == 'b') or (mode == 'B'))
A few alternatives:
* orelse (which is slightly faster).
* covert mode to lower (or upper case) then do one compare against
that case.
* a little bit twiddling (if I remember my ASCII chart, I think lower
and upper character values differ by 32 (base 10)?).
> uncollapse_threads ();
> [...]
> collapse_threads();
I guess I should release a macro set to record and reset the collapse status
of the display. Call it a peeve, but I prefer macros that don't alter the
layout of the display unless they absolutely have to.
Re: slrn 's' command, slight misfeature?
Author: tst... Thomas Schultz
Date: Sat, 08 Jan 2000 00:00
Date: Sat, 08 Jan 2000 00:00
46 lines
2743 bytes
2743 bytes
On 08 January 2000, Dawn Owens-Nicholson <blue...@ux6.cso.uiuc.edu> wrote:
> Thomas Schultz wrote:
>> In particular, I do not like the way the re-sorting of the articles
>> is done - finding out the sorting_method, ungetkey()ing it and
>> calling "toggle_sort" does work, but seems somewhat awkward.
> How about storing the sorting_method and resetting it with
> set_integer_variable("sorting_method", ...)?
This does not cause slrn to re-sort the articles, which is the effect
I want to achieve.
>> while(header_up(1));
> call("header_bob") will scale better on large groups (also virtual
> groups might come which means still larger groups).
Okay, I changed this everywhere I used it. I guess loops without
"body" (correct term?) are bad style anyway...
>> if ((mode == 'b') or (mode == 'B'))
> A few alternatives:
> * orelse (which is slightly faster).
> * covert mode to lower (or upper case) then do one compare against
> that case.
> * a little bit twiddling (if I remember my ASCII chart, I think lower
> and upper character values differ by 32 (base 10)?).
I chose the second alternative. Would the third alternative really be
more than a less readable form of it?
>> uncollapse_threads ();
>> [...]
>> collapse_threads();
> I guess I should release a macro set to record and reset the collapse
> status of the display. Call it a peeve, but I prefer macros that
> don't alter the layout of the display unless they absolutely have to.
I agree and in other macros, I spend some effort to achieve this
myself. However in this case, preserving the collapse status of the
display would be useless since slrn collapses all threads anyway when
re-sorting the articles. Actually, you could delete the
"collapse_threads();" statement without changing the functionality of
the macro. I just did that.
--
Thomas Schultz <tst...@gmx.de>
Re: slrn 's' command, slight misfeature?
Author: blue... Dawn Owens-Nicholson
Date: Sun, 09 Jan 2000 00:00
Date: Sun, 09 Jan 2000 00:00
35 lines
2163 bytes
2163 bytes
Thomas Schultz wrote: > This does not cause slrn to re-sort the articles, which is the effect > I want to achieve. You're right and that's odd--I could have sworn it did in previous versions. > Okay, I changed this everywhere I used it. I guess loops without > "body" (correct term?) are bad style anyway... It depends--sometimes there's no other way to concisely do something than a loop with no body. This is kind of a contrived example, but using Group_Move->up() and Group_Move->down() (both of which I posted a while ago), there's no way to move a group to the top or bottom of the group list as concise as: while (Group_Move->up (1)); % top of list while (Group_Move->down (1)); % bottom of list It's slightly contrived because I could have changed how they work, but I thought it was best to mimic group_up_n()/group_down_n(). > I chose the second alternative. Would the third alternative really be > more than a less readable form of it? Sure, it's not uncommon in C circles to see it done that way. It's completely up to you. > I agree and in other macros, I spend some effort to achieve this > myself. However in this case, preserving the collapse status of the > display would be useless since slrn collapses all threads anyway when > re-sorting the articles. Ah, I should have thought of that.
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