nmh-workers
[Top] [All Lists]

Re: [nmh-workers] Handling empty components

2019-03-22 04:48:51
Thanks guys for the quick reply and suggestions!

Ken:  yeah, I can see how messy that's going to be; alas that
%(trim) indeed doesn't return its result.  Although I'll probably
see this again, it'd be maybe 1x/year for the next couple years.
(And, who knows, maybe their IT department will fix it?  B-)  Not
worth complicating my replcomps; easier to just manually add the
"To:" field in vim.  B-)

Thanks!

                                Bob

On Thu, 21 Mar 2019 07:01:47 -0400 David Levine <levinedl@acm.org> sez:

Ralph wrote:

Hi Bob,

Is there a concise way to specify "if X is not present or is just
white space?" in one's replcomps?

I'd look into applying function `trim' first;  see mh-format(5).

If this command is of any use, I started to use it to explore that but
ran out of time:

  fmttest -format '%<{reply-to}%|%<{from}%>%>%(void(width))%(putaddr To: )\n'

A msg or -file switch can be added.

David

-- 
nmh-workers
https://lists.nongnu.org/mailman/listinfo/nmh-workers



On Fri, 22 Mar 2019 00:02:47 -0400 Ken Hornstein <kenh@pobox.com> sez:

Is there a concise way to specify "if X is not present or is just
white space?" in one's replcomps?

We covered this ground a few years ago, here:

  http://lists.nongnu.org/archive/html/nmh-workers/2015-02/msg00139.html

Priescently, I said back then:

Mind you, a header consisting of nothing but white space will be read
as "true" in the sense of mh-format(5) tests

And just to be sure:

% fmttest -raw -format '%<(nonnull{text})Non-null%|Null%>' ''
Null
% fmttest -raw -format '%<(nonnull{text})Non-null%|Null%>' ' '
Non-null

But I see:

% fmttest -raw -format '%(trim{text})%<(nonnull)Non-null%|Null%>' ' '
Null

So Ralph was right, %(trim) does what you want.  But ... %(trim) does
not have a return value (that was probably a mistake), so you cannot use
it directly as a condition for %<. You'll have to make sure your first
test is against the str register rather than Reply-To, and making it work
for all components is actually going to be a bit messy.

You know, since this the first one you've encountered in 30 years, maybe
it is better just to let it go?

--Ken

-- 
nmh-workers
https://lists.nongnu.org/mailman/listinfo/nmh-workers

<Prev in Thread] Current Thread [Next in Thread>