/usr/share/doc/slrn/examples/score.sl is in slrn 1.0.2-4build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 | % Mode for editing slrn score files
% To use this, add the following line to your .jedrc file:
% autoload ("score_mode", "score");
% Align the ':' characters in the same column
define score_indent_line ()
{
variable col, colon;
push_spot ();
bol_skip_white ();
EXIT_BLOCK {
pop_spot ();
if (bolp ()) skip_white ();
}
col = what_column ();
if (looking_at_char ('[') or looking_at_char ('%')) col = 1;
else if (eolp ())
{
push_spot ();
bskip_chars ("\n\t ");
bol_skip_white ();
col = what_column ();
pop_spot ();
}
else if (ffind_char (':'))
{
colon = what_column ();
if (blooking_at ("Score")) colon -= 10; else colon -= 18;
!if (colon) return;
col -= colon;
}
else
return;
if (what_column () != col)
{
bol ();
trim ();
col--;
whitespace (col);
}
}
$1 = "score";
create_syntax_table ($1);
set_syntax_flags ($1, 0x20);
define_syntax ("%", "", '%', $1);
define_syntax ("([{", ")]}", '(', $1);
define_syntax ('\\', '\\', $1);
define_syntax ("-a-zA-Z:", 'w', $1); % words
define_syntax ("-0-9", '0', $1); % Numbers
define_syntax ('[', '#', $1);
() = define_keywords ($1, "Age:", 4);
() = define_keywords ($1, "Date:From:Xref:", 5);
() = define_keywords ($1, "Lines:Score:", 6);
() = define_keywords ($1, "Score::", 7);
() = define_keywords ($1, "Expires:Subject:", 8);
() = define_keywords ($1, "Has-Body:", 9);
() = define_keywords ($1, "Newsgroup:", 10);
() = define_keywords ($1, "Message-Id:References:", 11);
define score_mode ()
{
variable score = "score";
set_mode (score, 0);
use_syntax_table (score);
set_buffer_hook ("indent_hook", "score_indent_line");
runhooks ("score_mode_hook");
% called after the hook to give a chance to load the abbrev table
if (abbrev_table_p (score)) use_abbrev_table (score);
}
% This function may be called by jed when starting newsreader
define score_arrange_score ()
{
% See if this is a score file
variable mode;
variable group;
variable score;
variable group_re = "^[ \t]*\\(\\[.*\\]\\)";
(mode, ) = what_mode ();
if (strcmp(mode, "score")) return;
push_spot ();
EXIT_BLOCK
{
pop_spot ();
}
% Find name of group for the score
!if (re_fsearch (group_re)) return;
group = regexp_nth_match (1);
% indent the region
push_spot ();
do
{
score_indent_line ();
eol ();
trim ();
}
while (down(1));
pop_spot ();
!if (bol_bsearch (group)) return;
push_mark ();
pop_spot ();
bol ();
push_mark ();
push_mark ();
eob ();
score = bufsubstr ();
del_region ();
pop_mark_1 ();
eol ();
!if (re_fsearch (group_re)) eob ();
insert (score);
if (re_bsearch (group_re)) delete_line ();
push_spot ();
return;
}
|