/usr/share/jed/lib/register.sl is in jed-common 1:0.99.19-3.
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 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 | % Register facility.
%
% CHANGELOG
% =========
%
% v2.0 2002/09/04
% o Re-implemented to use an associative array so that registers can
% be given meaningful names. Added reg_get/set_registers functions
% for use by Francesc's register load/save functions.
%
% v1.0 2000/12/29
%
% o Added register management from the menu bar.
%
% o 'register' evolved from no-mode to 'quasimode'. That is,
% it behaves like 'minued' but without edition/update capabilities.
% (Francesc Rocher <f.rocher@computer.org>)
%
private variable Register_Buffer_Arrays = Assoc_Type[String_Type,""];
public define reg_get_registers ()
{
return Register_Buffer_Arrays;
}
public define reg_set_registers (reg)
{
Register_Buffer_Arrays = reg;
}
private define get_register_name ()
{
variable keys = assoc_get_keys (Register_Buffer_Arrays);
keys = strjoin (keys, ",");
variable name = read_with_completion (keys, "Register Name:", "", "", 's');
name = strtrim (name);
if (name == "") name = NULL;
return name;
}
public define reg_copy_to_register ()
{
!if (markp ())
error ("No region defined.");
variable name = get_register_name ();
if (name != NULL)
{
Register_Buffer_Arrays [name] = bufsubstr ();
}
}
public define reg_insert_register ()
{
variable name = get_register_name ();
if (name == NULL)
return;
!if (assoc_key_exists (Register_Buffer_Arrays, name))
{
vmessage ("Register '%s' does not exist", name);
return;
}
insert (Register_Buffer_Arrays[name]);
vmessage ("Register '%s' inserted.", name);
}
private variable Reg_Mark;
private variable Reg_Cline = color_number ("menu_selection");
private variable Reg_Line = 1;
private variable Reg_Nwindows;
private variable Reg_Cbuf;
private define reg_prev ()
{
return re_bsearch ("^[^ \t]");
}
private define reg_next ()
{
return re_fsearch ("^[^ \t]");
}
private define reg_update_hook ()
{
bol ();
if (looking_at (" "))
{
if (what_line () > Reg_Line)
{
!if (reg_next ())
() = reg_prev ();
}
else
{
!if (reg_prev ())
() = reg_next ();
}
}
bol ();
Reg_Line = what_line ();
Reg_Mark = create_line_mark (Reg_Cline);
}
public define reg_quit ()
{
setbuf ("*registers*");
set_buffer_modified_flag (0);
sw2buf (Reg_Cbuf);
delbuf ("*registers*");
%menu_set_object_available ("Global.&Edit.Re&gisters.&Insert", 0);
%menu_set_object_available ("Global.&Edit.Re&gisters.Ca&ncel", 0);
if (Reg_Nwindows == 1)
onewindow ();
else
otherwindow ();
}
public define reg_insert ()
{
push_mark ();
eol ();
bskip_white ();
variable name = bufsubstr ();
reg_quit ();
insert (Register_Buffer_Arrays [name]);
recenter (0);
}
public define reg_help ()
{
message ("?: this help, q: quit mode, RET: insert register");
}
$1 = "register";
!if (keymap_p ($1))
{
make_keymap ($1);
definekey ("reg_help", "?", $1);
definekey ("reg_quit", "q", $1);
definekey ("reg_insert", "\r", $1);
}
public define register_mode ()
{
variable mode = "register";
if (0 == length (Register_Buffer_Arrays))
error ("There are no registers defined.");
Reg_Nwindows = nwindows ();
Reg_Cbuf = pop2buf_whatbuf ("*registers*");
pop2buf ("*registers*");
set_readonly (0);
erase_buffer ();
foreach (Register_Buffer_Arrays) using ("keys", "values")
{
variable key, value;
(key, value) = ();
variable l = what_line ();
l++;
insert (key);
newline ();
insert (value);
newline ();
while (what_line () > l)
{
go_up_1 ();
bol ();
whitespace (3);
}
eob ();
}
call ("backward_delete_char_untabify");
bob ();
set_buffer_modified_flag (0);
set_buffer_hook ("update_hook", ®_update_hook);
%set_column_colors (Colorin_Left, 1, 3);
toggle_readonly ();
%menu_set_object_available ("Global.&Edit.Re&gisters.&Insert", 1);
%menu_set_object_available ("Global.&Edit.Re&gisters.Ca&ncel", 1);
use_keymap (mode);
set_mode (mode, 0);
run_mode_hooks ("register_mode_hook");
reg_help ();
}
|