/usr/share/jed/lib/occur.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 | %% occur function
%%
$1 = "Occur";
!if (keymap_p ($1))
{
make_keymap ($1);
}
definekey ("occur_goto_line", "g", $1);
variable Occur_Buffer = Null_String;
define occur_goto_line ()
{
variable line;
!if (bufferp (Occur_Buffer))
return;
bol ();
push_mark ();
!if (ffind (":"))
{
pop_mark_0 ();
return;
}
line = integer (bufsubstr ());
pop2buf (Occur_Buffer);
goto_line (line);
}
%!%+
%\function{occur}
%\synopsis{occur}
%\usage{Void occur ();}
%\description
% This function may be used to search for all occurances of a string in the
% current buffer. It creates a separate buffer called \var{*occur*} and
% associates a keymap called \var{Occur} with the new buffer. In this
% buffer, the \var{g} key may be used to go to the line described by the
% match.
%!%-
define occur()
{
variable str, tmp, n;
str = read_mini("Find All (Regexp):", LAST_SEARCH, Null_String);
!if (strlen (str))
return;
tmp = "*occur*";
Occur_Buffer = whatbuf();
pop2buf(tmp);
erase_buffer();
pop2buf(Occur_Buffer);
push_spot();
bob ();
while (re_fsearch(str))
{
line_as_string (); % stack-- at eol too
n = what_line ();
setbuf(tmp);
vinsert ("%4d:", n);
insert(());
newline();
setbuf(Occur_Buffer);
!if (down_1 ()) %% so we do not find another occurance on same line
break;
}
pop_spot();
setbuf(tmp);
bob(); set_buffer_modified_flag(0);
use_keymap ("Occur");
run_mode_hooks ("occur_mode_hook");
}
|