/usr/share/jed/lib/replace.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 | %
% This function executes a query-replace across all buffers attached to
% a file.
%
require ("search");
define replace_across_buffer_files ()
{
variable cbuf = whatbuf ();
variable n = buffer_list ();
variable buf, file, flags;
variable pat, rep;
pat = read_mini ("Replace:", Null_String, Null_String);
!if (strlen (pat)) return;
rep = read_mini ("Replace with:", Null_String, Null_String);
push_spot (); % save our location
REPLACE_PRESERVE_CASE_INTERNAL = REPLACE_PRESERVE_CASE;
if ((strlen (rep) == strlen(pat)) and not (strcmp(strlow(rep), strlow(pat))))
REPLACE_PRESERVE_CASE_INTERNAL = 0;
if (-1 != prefix_argument (-1))
REPLACE_PRESERVE_CASE_INTERNAL = not (REPLACE_PRESERVE_CASE_INTERNAL);
try while (n)
{
buf = (); n--;
% skip special buffers
if ((buf[0] == '*') or (buf[0] == ' ')) continue;
sw2buf (buf);
(file,,,flags) = getbuf_info ();
% skip if no file associated with buffer, or is read only
!if (strlen (file) or (flags & 8)) continue;
% ok, this buffer is what we want.
push_spot_bob ();
ERROR_BLOCK
{
pop_spot ();
}
replace_with_query (&search_search_function, pat, rep, 1,
&replace_do_replace);
pop_spot ();
}
finally
{
sw2buf (cbuf);
pop_spot ();
_pop_n (n); % remove buffers from stack
REPLACE_PRESERVE_CASE_INTERNAL = 0;
}
EXECUTE_ERROR_BLOCK;
message ("Done.");
}
|