Re: A new macro for automatic eob

[email protected] (John E. Davis) Mon, 10 Aug 2015 21:47:31 -0400
Newsgroups gmane.network.slrn.user
Message-ID <[email protected]>
Arkadiusz Drabczyk <[email protected]> wrote:
> define go_bottom ()
>{
>    call ("header_eob");
>}
>
> variable current_sorting_method = get_variable_value ("sorting_method");
>
> if (current_sorting_method == 10 || current_sorting_method == 11) {
>    !if (1 == register_hook ("article_mode_startup_hook", &go_bottom))
>            error ("failed to register go_bottom() hook");
>}
>
> It's very simple but I think it may be useful for mutt users. It's my
> first ever macro written in S-Lang. I count on your opinion on this.

Since the sorting method could change during runtime, it might be a
good idea to add that bit of logic to the go_bottom function.  Also,
to avoid namespace pollution, you should make this a private function.
For example:

private define go_bottom ()
{
   variable sm = get_variable_value ("sorting_method");
   if ((sm == 10) || (sm == 11))
     call ("header_eob");
}

if (-1 == register_hook ("article_mode_startup_hook", &go_bottom))
  throw RunTimeError, "failed to register go_bottom() hook";

Good luck,
--John

------------------------------------------------------------------------------