Alain Bench | 1 Dec 2004 14:55

conditionaly visible header

Hi ALL,

    How could I display a given header in article pager when in weeded
mode, but only on a condition? Say the "Newsgroups:" line hidden when
equals the current group, displayed otherwise?

Bye!	Alain.
--

-- 
Give your computer's unused idle processor cycles to a scientific goal:
The Folding <at> home project at <URL:http://folding.stanford.edu/>.

-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. 
http://productguide.itmanagersjournal.com/

Alain Bench | 2 Dec 2004 19:50

various small glitches

Hello,

 -1) The doc slrnfuns.txt forget to say that post_file_hook takes a
parameter, and mixes examples with post_filter_hook.

 -2) Cancel function first prompts user for confirmation, then verifies
his rights to cancel. It may seem better to reverse order, so user is
not uselessely prompted.

 -3) Supersedes function first prompts user for confirmation, then
verifies his rights to supersede. It may seem better to reverse order,
so user is not uselessely prompted. Hum... But this would also put
supersede_hook *after* rights verification: Can this be unwanted?

 -4) Functions reply, forward, followup, and supersede all first prompt
confirmation, then trigger associated *_hook. But function "post" does
the contrary, which can lead to trigger post_hook even when user aborts
action.

    The proposed patch changes all this. Seems to me there is no
problem, but perhaps point 3.

Bye!	Alain.
--

-- 
When you want to reply to a mailing list, please avoid doing so with
Hotmail. This lacks necessary references and breaks threads.
Doc: Document post_file_hook takes a parameter, fix examples of
post_file_hook and post_filter_hook.
(Continue reading)

J.B. Nicholson-Owens | 3 Dec 2004 22:15

Re: conditionaly visible header

Alain Bench wrote:
 > How could I display a given header in article pager when in weeded
 > mode, but only on a condition? Say the "Newsgroups:" line hidden when
 > equals the current group, displayed otherwise?

Try the following:

% This next line runs once per slrn session.  It is a variable
% which holds the setting from one's slrn.rc.
variable previous_visible_headers = get_visible_headers ();

define my_conditionally_visible_header ()
{
    % Hide the "Newsgroups:" line hidden when it equals the current group,
    % display the header line otherwise.

    if (extract_displayed_article_header ("Newsgroups") == current_newsgroup ())
      {
         % We're SEEING the Newsgroups: header when we SHOULD NOT be seeing
         % it, so we should HIDE the Newsgroups: header.

         set_visible_headers (previous_visible_headers + ",!Newsgroups:");
      }
    else
      {
         % We're NOT seeing the Newsgroups: header when we SHOULD be seeing
         % it, so we should REVEAL the Newsgroups: header.

         set_visible_headers (previous_visible_headers + ",Newsgroups:");
      }
(Continue reading)

J.B. Nicholson-Owens | 3 Dec 2004 22:47

Re: conditionaly visible header

I didn't mention it, but I'm leaving a couple important tasks as excercises for 
the reader:

  * when to call such a function
  * when to clear the effects of altering the visible_header list.

These aren't hard problems.

-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. 
http://productguide.itmanagersjournal.com/

Alain Bench | 4 Dec 2004 00:54

save or pipe is munged after replace_article()

Hello,

    Hitting 'o' to save an article to an mbox file saves a munged
version of the article, when an S-lang macro used the replace_article()
function. The same hitting '|' for pipe. How can I always have a
verbatim saved/piped article?

    Mutt has 2 functions: <save-message> and <decode-save>. And a
$pipe_decode option for <pipe-message> function. Thus you can always get
verbatim or munged versions at will.

    I need replace_article() and verbatim saves. Is it possible?

Bye!	Alain.
--

-- 
	I wonder what will be today's SF fine ad?

-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. 
http://productguide.itmanagersjournal.com/

J.B. Nicholson-Owens | 4 Dec 2004 05:44

Re: save or pipe is munged after replace_article()

Alain Bench wrote:
> How can I always have a verbatim saved/piped article?

You can fopen() a file, use article_as_string() to get the article, then write 
the article with fputs(), and then fclose() the file.  You can read the article 
later and replace_article() any time you like.

-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. 
http://productguide.itmanagersjournal.com/

Alain Bench | 4 Dec 2004 13:22

Re: save or pipe is munged after replace_article()

 On Friday, December 3, 2004 at 10:44:50 PM -0600, J.B. Nicholson-Owens wrote:

> Alain Bench wrote:
>> How can I always have a verbatim saved/piped article?
> You can fopen() a file, use article_as_string() to get the article,
> then write the article with fputs(), and then fclose() the file.

    Well no: article_as_string() *always* gives a munged article, even
without replace_article() first. MIME-decoded, de-UTF-8ed, charset
transcoded for display. Very handy in most cases, but harmfull here.

    There is the new raw_article_as_string() that sounds juicy, but
manual states:

| The raw article is no longer available after you called
| replace_article. In this case, the output is the same as the one of
| article_as_string.

> You can read the article later and replace_article() any time you
> like.

    Problem is that user can hit 'o' at any time, even while reading the
given article. When displayed, the article may already have been
replace_article()ed.

    BTW this munging may also adversely affect the attachment "decode"
function ':', depending on what's done by replace_article().

Bye!	Alain.
--

-- 
(Continue reading)

Alain Bench | 4 Dec 2004 23:29

Re: [PATCH] Latin-9 and CP-1252 euro charsets

Hello,

 On Wednesday, January 15, 2003 at 2:29:23 PM +0100, Alain Bench wrote:

> See first of thread for more explanations.

    Attached is an modified patch, optimized to work with DisplayConvert
macro. It also adds a third charset value "latin1" to be exploited by
next version of DisplayConvert on Latin-1 terminals. With both patch and
macro, transliterations will include € => EUR.

Bye!	Alain.
--

-- 
How to Report Bugs Effectively
<URL:http://www.chiark.greenend.org.uk/~sgtatham/bugs.html>
Alain Bench | 4 Dec 2004 22:59

Re: conditionaly visible header

 On Friday, December 3, 2004 at 3:15:18 PM -0600, J.B. Nicholson-Owens wrote:

> Alain Bench wrote:
>> in weeded mode [...] the "Newsgroups:" line hidden when equals the
>> current group, displayed otherwise?
> if (extract_displayed_article_header ("Newsgroups") == current_newsgroup ())
>   set_visible_headers (previous_visible_headers + ",!Newsgroups:");

    Wonderfull: It works nicely!

    And I haven't even thought to this approach before. Was searching in
heavy ways of replace_art() after detecting weed mode, with 30 rebound
keys and a dozen hooks. Just manipulating [gs]et_visible_headers() is so
more elegant... Thanks!

> Any time you want to rebuild or edit the visible_headers list by
> starting with what the user provided in their slrn.rc, you can build
> on previous_visible_headers.

    But this limits user's liberty to change visible_headers anytime on
article_mode_hook() group specific settings, by any other macro, or even
interactively. Enhancement may be to get the string each time and add or
remove our final negative pattern. Easy homework. :-)

 On Friday, December 3, 2004 at 3:47:11 PM -0600, J.B. Nicholson-Owens wrote:

> I'm leaving a couple important tasks as excercises for the reader

    I love your reflexion inducing replies. Much appreciated enrichment.

(Continue reading)

J.B. Nicholson-Owens | 5 Dec 2004 10:50

Re: save or pipe is munged after replace_article()

Alain Bench wrote:
> Well no: article_as_string() *always* gives a munged article, even without
> replace_article() first. MIME-decoded, de-UTF-8ed, charset transcoded for
> display. Very handy in most cases, but harmfull here.

Good point; then I'd say there is no way to do this and be sure that the
article you're saving is the raw article as sent to you by the news server (or
proxy).  Even if you try to save the returned string from
raw_article_as_string(), you can't be sure that your macro runs first (nor
would it help to tell the user to make sure of that because it's complicated
for novices to install and because there may be some other macro that wants the
same data and coordinating with your macro is tough to accomplish).

-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. 
http://productguide.itmanagersjournal.com/


Gmane