/usr/share/jed/lib/macro.sl is in jed-common 1:0.99.19-7.
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 | define macro_save_macro ()
{
variable str = get_last_macro ();
variable file;
variable macro_name;
file = read_file_from_mini ("Macro filename:");
!if (strlen (file)) return;
macro_name = read_mini ("Name of macro:", Null_String, Null_String);
!if (strlen (macro_name)) return;
str = sprintf ("%%%%%%MACRO NAME: %s\n@%s\n\n", macro_name, str);
if (-1 == append_string_to_file (str, file))
{
error ("Error appending macro to file");
}
}
define macro_to_function ()
{
variable macro = get_last_macro ();
variable i, imax, ch, num;
variable last_was_insert = 0, f, ftype;
pop2buf ("*macro*");
eob ();
newline ();
insert ("\ndefine macro_");
push_spot ();
insert ("EDITME ()\n{\n");
imax = strlen (macro);
num = 0;
i = 0;
% Push macro characters on stack
while (i < imax)
{
ch = macro[i];
if (ch == '\\')
{
i++;
ch = macro[i];
}
else if (ch == '^')
{
i++;
ch = macro[i];
ch -= '@';
}
ch; % push it on stack
num++;
i++;
}
while (num)
{
num--;
ungetkey (());
}
while (input_pending (0))
{
(ftype, f) = get_key_binding ();
if (typeof (f) == Ref_Type)
{
vinsert ("(@%S)(); %%<--- Ref may be to a private function\n", f);
last_was_insert = 0;
continue;
}
if (f == "self_insert_cmd")
{
!if (last_was_insert)
{
insert (" insert (\"\"); % insert text here\n");
last_was_insert = 1;
}
continue;
}
if (ftype)
{
insert (sprintf (" call (\"%s\");\n", f));
}
else insert (sprintf (" %s ();\n", f));
last_was_insert = 0;
}
insert ("}\n");
pop_spot ();
}
define macro_assign_macro_to_key ()
{
variable key = Null_String;
variable ch = 0;
flush ("Press key to assign macro to:");
do
{
ch = getkey ();
if (ch == 0) ch = "^@"; else ch = char (ch);
key = strcat (key, ch);
}
while (input_pending (5));
local_setkey (strcat ("@", get_last_macro ()), key);
message (strcat ("Macro set to ", expand_keystring (key)));
}
|