% -*- mode: slang; mode: fold -*- % threads.sl - a collection of macros that operates on threads. % Copyright (C) 2002 Emmanuele Bassi % set_preference() mechanism borrowed from J.B. Nicholson-Owens % % This file may be redistributed and / or modified under the terms of the % GNU General Public License, version 2, as published by the Free Software % Foundation. % Version 1.0 - Wed, 10 Jul 2002 23:18:47 +0200 implements ("thread"); static define expand_above_score () %{{{ { variable low_watermark = 1000; variable high_watermark = 9999; % set to zero if you don't want to expand the entire thread variable expand_everything = 1; variable score = get_header_score (); % sanity check if (high_watermark < low_watermark) high_watermark = low_watermark + 1; % score check. if ((score < low_watermark) or (score > high_watermark)) return; % thread parent. if (NULL == extract_article_header ("References")) return; % mark the current article, so we can return to it % as soon as the thread has been reconstructed. call ("mark_spot"); forever { ERROR_BLOCK { _clear_error (); call ("exchange_mark"); return (); } if (expand_everything) set_prefix_argument (1); call ("get_parent_header"); } call ("exchange_mark"); } %}}} % Register hooks {{{ !if (1 == register_hook ("read_article_hook", "thread->expand_above_score")) error ("register_hook: read_article_hook, expand_above_score"); %}}}