Article View: news.software.readers
Article #129560Re: [slrn] Selecting a followup
From: Thomas Schultz
Date: Sun, 27 Jul 2003 20:15
Date: Sun, 27 Jul 2003 20:15
123 lines
4378 bytes
4378 bytes
* SINNER [2003-07-08 13:09] :
> If the article is _not_ crossposted, is there anyway, macro or
> otherwise, to select a followup group without manually typing it in
> effecting a possible misspelling? [...]
A convenient way I could think of is a function in your editor that
allows tab completion of newsgroup names. I wrote a macro for the
editor jed that does just that (based on the newsgroups found in the
user's newsrc file).
Here's a first version of it; save it to group-complete.sl, load it in
your .jedrc file and bind complete_newsgroup to some key (e.g. M-TAB).
You can either cycle all groups in your newsrc file or type a part of
the newsgroup name before hitting that key (to limit the number of
possible completions).
If more people think this is useful, I'll play around with it some
more (an obvious enhancement would be a config option to tab-complete
subscribed groups only) and add it to the distribution.
<group-complete.sl>
% Complete newsgroup names based on the newsrc file
% Written by Thomas Schultz <tststs@gmx.de>
%
% This macro is based on tex_complete_symbol from latex.sl
% by Kevin Humphreys / John E. Davis
% If your newsrc file is not ~/.newsrc or ~/.jnewsrc, set it here
variable newsrcfile;
define complete_newsgroup ()
{
variable symbol, completion = "";
variable insertbuf = whatbuf(), searchbuf = "*group-comp*";
!if (bufferp(searchbuf))
{
sw2buf(searchbuf);
% Try to find the newsrc file
if (newsrcfile==NULL)
{
variable home = getenv ("HOME");
if (home == NULL)
error ("$HOME is undefined - could not find newsrc file");
newsrcfile = search_path_for_file (home,".jnewsrc");
if (newsrcfile == NULL)
newsrcfile = search_path_for_file (home,".newsrc");
if (newsrcfile == NULL)
error ("Could not find ~/.jnewsrc or ~/.newsrc");
}
% Insert it into the buffer and remove read article counts
insert_file(newsrcfile); bob();
do
{
bol ();
if (orelse {ffind_char (':')} {ffind_char ('!')})
{
push_mark (); eol ();
del_region();
}
}
while (down (1));
set_buffer_modified_flag(0);
sw2buf(insertbuf);
bury_buffer(searchbuf);
}
push_spot();
push_mark();
if (orelse {bfind_char(',')} {bfind_char(' ')})
() = right(1);
else
bol();
symbol = bufsubstr();
setbuf(searchbuf);
if (strlen(symbol)==0)
{
if (eobp()) bob(); % wrap to start
bol(); push_mark(); eol();
completion = bufsubstr();
() = down (1);
}
else
{
!if (bol_fsearch(symbol)) bob(); % wrap to start
if (bol_fsearch(symbol))
{
go_right(strlen(symbol));
push_mark_eol();
completion = bufsubstr();
}
}
if (strlen(completion)==0)
{
setbuf(insertbuf);
pop_mark_0 ();
pop_spot();
error("No completion found");
}
setbuf(insertbuf);
goto_spot ();
push_mark();
!if (orelse {ffind_char (',')} {ffind_char (' ')}) eol();
del_region();
insert(completion);
pop_spot();
}
<--->
--
Thomas Schultz <tststs@gmx.de> News on slrn: http://slrn.sf.net/news.html
.-----------------------------. [2002-03-13] slrn 0.9.7.4 is out
| Home of the slrn newsreader | [2002-02-03] Screenshot page online
| http://slrn.sourceforge.net | [2002-02-03] "Port" to Mac OS X
Technical Details
Message-ID:
<slrnbi8cnb.1q9.tststs@moonlight.tststs.ddns.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.mbox.zip!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!in.100proofnews.com!in.100proofnews.com!fu-berlin.de!uni-berlin.de!dialin-145-254-103-086.arcor-ip.NET!not-for-mailReferences:
<sbsqt-73s.ln1@news.gates_of_hell.INVALID>Show Full Headers
Complete Article Headers
Message-ID: <slrnbi8cnb.1q9.tststs@moonlight.tststs.ddns.org> Subject: Re: [slrn] Selecting a followup Date: Sun, 27 Jul 2003 20:15:39 +0000 From: Thomas Schultz <tststs@gmx.de> References: <sbsqt-73s.ln1@news.gates_of_hell.INVALID> Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.mbox.zip!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!in.100proofnews.com!in.100proofnews.com!fu-berlin.de!uni-berlin.de!dialin-145-254-103-086.arcor-ip.NET!not-for-mail Newsgroups: news.software.readers Organization: Pinguin online. Lines: 122 NNTP-Posting-Host: dialin-145-254-103-086.arcor-ip.net (145.254.103.86) X-Trace: news.uni-berlin.de 1059337022 20950346 145.254.103.86 (16 [152]) User-Agent: slrn/0.9.7.4pl2 (Linux)