/usr/share/jed/lib/tmmode.sl is in jed-common 1:0.99.19-2.1.
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 | % This is a text-macro mode designed to edit text using user defined macros.
% Create a syntax table. Basically \ is a quote and {} are matching delimiters.
$1 = "tm";
create_syntax_table ($1);
define_syntax ("#%+", "#%-", '%', $1); % Comment Syntax
define_syntax ("#%", "", '%', $1); % Comment Syntax
define_syntax ('\\', '\\', $1); % Quote character
define_syntax ("{", "}", '(', $1); % nothing else matches
define_syntax ("-+a-zA-Z_0-9#", 'w', $1);
%define_syntax ('#', '#', $1);
set_syntax_flags ($1, 8);
() = define_keywords_n ($1, "#d#i#p#v", 2, 1);
() = define_keywords_n ($1, "#p+#p-#s+#s-#v+#v-", 3, 1);
define textmac_paragraph_separator ()
{
bol ();
if (looking_at ("#") or looking_at ("\\"))
return 1;
skip_white ();
eolp ();
}
define textmac_wrap_hook ()
{
push_spot ();
EXIT_BLOCK
{
pop_spot ();
}
go_up_1 (); % at eol
trim ();
bol ();
if (looking_at ("#% "))
{
go_down_1 ();
insert ("#% ");
return;
}
if (looking_at_char ('#'))
{
eol ();
!if (blooking_at ("\\"))
{
insert_single_space ();
insert_char ('\\');
}
}
go_down_1 ();
indent_line ();
}
private define in_verbatim ()
{
variable m = create_user_mark ();
EXIT_BLOCK
{
goto_user_mark (m);
}
!if (bol_bsearch ("#v+"))
return 0;
!if (bol_fsearch ("#v-"))
return 1;
return (create_user_mark () >= m);
}
define tm_insert_quote ()
{
if (in_verbatim ())
{
insert ("\"");
return;
}
call ("text_smart_quote");
}
$1 = "tm";
!if (keymap_p ($1)) make_keymap ($1);
definekey ("tm_insert_quote", "\"", $1);
define tm_mode ()
{
no_mode (); % reset
variable mode = "tm";
use_keymap (mode);
set_mode (mode, 0x1 | 0x20);
set_buffer_hook ("par_sep", "textmac_paragraph_separator");
set_buffer_hook ("wrap_hook", "textmac_wrap_hook");
use_syntax_table (mode);
mode_set_mode_info (mode, "fold_info", "#%{{{\r#%}}}\r\r");
TAB = 0;
run_mode_hooks ("tm_mode_hook");
}
|