🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.readers
Article #257402

Re: Refreshing SLRN heders while viewing newsgroup?

#257402
From: J.B. Nicholson-Owens
Date: Thu, 24 Apr 2014 22:27
83 lines
4733 bytes
Ivan The Not-So-Bad <1suf41n@yahoo.com> wrote:
> So let's say I'm in SLRN and reading through news.software.readers. I'm 5
> threads in to a lengthy discussion. It's been a while since I've updated the
> group so there are probably new responses in the thread. I don't want to lose
> my place, but would like to see new articles that have come in since I entered
> the newsgroup. 

You could simulate doing this with a macro. Save the following (in
between the #v+ and #v- lines) to a file, load it from slrn, and press
"G" to run the macro.

#v+
define refresh_reenter_group () 
{
   if (is_group_mode ())
     error (_function_name () + " only works in article mode!");

   % Note the article we started on and the collapse status
   % of the current thread so we can restore the cursor position
   % and thread display later.
   variable
     prefix_arg = get_prefix_arg(),
     starting_article = extract_article_header ("Message-ID"),
     thread_was_collapsed = is_thread_collapsed (),
     starting_newsgroup = current_newsgroup ();

   % We don't want any prefix arguments to interfere with any call()s
   % we make. So we recorded the prefix argument, reset the prefix
   % argument below, and restore the prefix argument at the end (in
   % the EXIT_BLOCK).
   reset_prefix_arg();

   EXIT_BLOCK
     {
	% Put the cursor where it was and restore the thread display.
	() = locate_header_by_msgid (starting_article, 1);
	ifnot (thread_was_collapsed) uncollapse_thread ();
	
	% Restore the prefix argument.
	if (prefix_arg != -1) set_prefix_argument (prefix_arg);
     }

   % Quit to group mode, refresh the newsgroup list, and re-enter the
   % newsgroup we were in.
   call ("quit");
   call ("refresh_groups");
   set_input_string (starting_newsgroup);
   call ("add_group");
   call ("select_group");

   if (is_group_mode ())
     error ("Something went horribly wrong and we could not re-enter " + starting_newsgroup);
}
definekey ("Global->refresh_reenter_group", "G", "article");
#v-

There are some tradeoffs with this approach you will want to consider:

- refreshing all of the groups ends up downloading data for groups
  you're not immediately interested in. I don't know how to get slrn
  to only refresh group data for the group you're in. If there is a
  way to do that, I believe this macro is clear enough that you can
  improve it.

- Any error raised on group reentry will stop this macro prematurely
  and not put the cursor back to where it should be and not restore
  the thread display for the current display thread. It's not clear
  what /should/ be done here -- show the user the error, put the
  cursor back where it should go, or something else? It's not clear
  that dropping in an attempt to catch and ignore errors is wise.

- You may be prompted on group reentry about how many articles to read
  when entering the group. It wasn't clear what /should/ be done to
  better handle this situation.

- With the exception of the article you were on when you pressed "G",
  read articles will seem to disappear from the article list when the
  macro is finished. Relatedly, no attempt is made to preserve the
  thread display for read, starred, or numerically tagged articles.
  Other uncollapsed threads in the display may be recollapsed when you
  reenter the group. Fixing all of this is possible (I wrote a macro
  to do this with starred articles) but fixing any this will take more
  time to store and restore the data. 
Technical Details
Message-ID: <slrnllj3ul.a2b.jbn@forestfield.org>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.20140922.mbox.gz!border2.nntp.dca.giganews.com!nntp.giganews.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!news.albasani.net!.POSTED!not-for-mail
References: <53590b16$0$9244$c3e8da3$9f400e27@news.astraweb.com>

Show Full Headers
Complete Article Headers
Message-ID: <slrnllj3ul.a2b.jbn@forestfield.org>
Subject: Re: Refreshing SLRN heders while viewing newsgroup?
Date: Thu, 24 Apr 2014 22:27:33 +0000
From: "J.B. Nicholson-Owens" <jbn@forestfield.org>
References: <53590b16$0$9244$c3e8da3$9f400e27@news.astraweb.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.20140922.mbox.gz!border2.nntp.dca.giganews.com!nntp.giganews.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!news.albasani.net!.POSTED!not-for-mail
Newsgroups: news.software.readers
Organization: albasani.net
Lines: 83
X-Trace: news.albasani.net
 2B0IgxcnlYyy7IPldH6BanoKMm1nrZ3WF/M41e/ZEK8seuMd3FlPecwHUpXqug9+2i5uw5w8ZZRoWCr/o/hMTA==
NNTP-Posting-Date: Thu, 24 Apr 2014 22:27:33 +0000 (UTC)
Injection-Info: news.albasani.net;
 logging-data="9bSS3SxuJoD/ZEAZsspsPFVW13nkKtz5PvzWmCFhF4b9/vgs3Z0Dr2pSLdkTDvrk11fbhMcgf37K8NC924My3D5oZF/Z1oxlQwrIpmGhq9fOLcPZyV55YiKyZ2eM9fbE";
 mail-complaints-to="abuse@albasani.net"
User-Agent: slrn/1.0.1 (Linux)
Cancel-Lock: sha1:noLUNG5cAjz4DF+haH4UHGOxpsY=