/usr/share/jed/lib/xformreg.sl is in jed-common 1:0.99.19-4.
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 | private define skip_chars_to_mark (chars, mark)
{
skip_chars (chars);
if (create_user_mark () > mark)
goto_user_mark (mark);
}
private define skip_word_chars_to_mark (mark)
{
skip_word_chars ();
if (create_user_mark () > mark)
goto_user_mark (mark);
}
private define chgcase_reg ()
{
check_region (0);
variable end = create_user_mark ();
pop_mark_1 ();
while (create_user_mark () < end)
{
push_mark ();
skip_chars_to_mark ("^\\u", end);
insert (strup (bufsubstr_delete ()));
push_mark ();
skip_chars_to_mark ("^\\l", end);
insert (strlow (bufsubstr_delete ()));
}
}
private define cap_region ()
{
check_region (0);
variable end = create_user_mark ();
pop_mark_1 ();
while (create_user_mark () < end)
{
skip_non_word_chars ();
if (create_user_mark () >= end)
break;
variable wch = what_char ();
% The insertion must be done before the deletion to handle a single
% character word. This is because the "end" mark follows the character
% and if the deletion took place first, the insertion would happen
% AFTER the mark, which is not what is wanted.
insert (strup (char (wch)));
del ();
push_mark ();
skip_word_chars_to_mark (end);
insert (strlow (bufsubstr_delete ()));
}
}
public define xform_region (how)
{
check_region (0);
variable f;
switch (how)
{
case 'u':
f = &strup;
}
{
case 'd':
f = &strlow;
}
{
case 'c':
return cap_region ();
}
{
% default
return chgcase_reg ();
}
dupmark ();
variable reg = (@f)(bufsubstr ());
del_region ();
insert (reg);
}
|