Re: A new macro for automatic eob

Arkadiusz Drabczyk <[email protected]> Wed, 12 Aug 2015 02:18:31 +0200
Newsgroups gmane.network.slrn.user
Message-ID <[email protected]>
On Mon, Aug 10, 2015 at 09:47:31PM -0400, John E. Davis wrote:
> 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";

It's much better now. Thank you.
-- 
Arkadiusz Drabczyk <[email protected]>

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