Article View: news.software.readers
Article #9655Re: Problems with trn macros (used to be 6 questions)
From: Wayne Davison
Date: Wed, 22 Jun 1994 20:01
Date: Wed, 22 Jun 1994 20:01
94 lines
4859 bytes
4859 bytes
According to Maxim Spivak <maxims@peru.lbl.gov>:
> 1. I've been using the ^A^A macro. When I call it, it seems to kill the
> unselected articles and display the selected ones. However, when I
> reenter the group several days later, the replies to the
> previously-killed articles are back!
It is quite possible that you are using trn 3.4.1, overview files, and
not specifying the -a option -- in this case trn had a bug that would
not properly kill all associated threads. To fix this, grab trn 3.5
from uunet (ftp.uu.net:networking/news/readers/trn/trn-3.5.tar.gz).
> However, after reading the kill-file FAQ, I got the impression that each
> thread should end with `Tj', not 'TJ'. Is this the problem?
No, the kill file is fine.
As for the macro, I know of no macro documents. However, it is not too
hard to get a handle on the basics. Here's the ^A^A macro:
^A^A %(%m=t?%(%Z=^0?::M^J)/\^/\:Tj^J%(%Z%M=^00?q:Y\^):)
%( ? : ) is the if-then-else-endif operator. Knowing this, it is possible
to break it up into indented code:
%( %m=t ? if mode contains 't' then
%( %Z=^0 ? if selected-count starts with 0 then
<NULL-STRING> do nothing
: else
:M^J run 'M' on all selected articles
) endif
/\^/\:Tj^J select all articles and thread-kill them
%( %Z%M=^00 ? if selected-count+returning-count == 00 then
q quit group
: else
Y\^ yank back the articles and go to top
) endif
: else
<NULL-STRING> do nothing
) endif
Notes:
The mode (%m) is a one-character long variable that equals 't' if
you're in the selector.
The '=' operator does a regex match of a variable, so if you're matching
a multi-character variable you might need to anchor your regex (like using
"^0" to match a zero only at the start of the string).
The 'M' command marks articles as read-but-returning. When used with the
':' command it marks all selected articles, and requires you to press
return -- ^J is two characters that get turned into an ASCII newline.
The command /^/:Tj thread kills all articles (all articles have a beginning
of the subject line, so the /^/ search matches them all). The '^' and the
':' need to be escaped with backslashes since the former might get mistaken
for a Ctrl-character modifier and the latter would get mistaken for the else
portion of the %(?:) sequence since we're not yet in the else portion.
The two variables %Z%M can only equal "^00" if they are both zero. Having
them next to each other like they are simply concatenates them into the
one test instead of having to check them separately.
The 'Y' command in the selector yanks back all articles marked with 'M'.
The '^' command in the selector goes to the first page of the selector.
It must be escaped with a '\' to avoid having it modify the ')'.
NOTE that when you type Ctrl-A, Ctrl-A that the WHOLE string gets
interpreted and pushed into the keyboard buffer. That's why the %Z%M bit
is required above -- we want it to yank back any articles that we pushed
via ":M" (%Z) or any that were already pushed (%M). In other words, the
various tests in the string don't occur at the time they are popped
from the buffer via read statements, but at the time they are pushed
via macro substitution, so make all your tests reflect the conditions
that were present before the macro started twiddling things.
Finally, it is possible to use "^(STRING^)" to input STRINGs that get
macro expanded as they are input (normally macro-expanded strings are
involatile). Thus the macros:
q %(%m=t?+:q)
doesn't loop re-expanding the 'q', but:
q %(%m=t?+:^(q^))
would overflow the input buffer and generate an error.
It would probably be a good idea to turn info such as this into a
macro FAQ -- any takers?
--
Wayne Davison
davison@borland.com
Technical Details
Message-ID:
<CrtEAv.HK3@borland.com>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!archive!mbox2nntp-news.software.readers.mbox.zip!bga.com!news.sprintlink.net!hookup!swrinde!ihnp4.ucsd.edu!ames!elroy.jpl.nasa.gov!decwrl!borland.com!davisonReferences:
<2u55gs$ii2@overload.lbl.gov>Show Full Headers
Complete Article Headers
Message-ID: <CrtEAv.HK3@borland.com> Subject: Re: Problems with trn macros (used to be 6 questions) Date: Wed, 22 Jun 1994 20:01:42 GMT From: davison@borland.com (Wayne Davison) References: <2u55gs$ii2@overload.lbl.gov> Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!archive!mbox2nntp-news.software.readers.mbox.zip!bga.com!news.sprintlink.net!hookup!swrinde!ihnp4.ucsd.edu!ames!elroy.jpl.nasa.gov!decwrl!borland.com!davison Newsgroups: news.software.readers Organization: Borland International Lines: 94