This file is indexed.

/usr/share/jed/lib/isearch.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
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
% Here is a new version of isearch.sl reworked by John Burnell <johnb@whio.grace.cri.nz>.
% This one is said to be more emacs-like.
%
% %% with modifications and comments by Guenter Milde (G.Milde web.de)
%
%% Further modifications by Lloyd Zusman <ljz@asfast.com>
%% as well as JED to get rid of marks which were riding on the stack.

%% isearch.sl
%% Routines here perform incremental forward/backward searches
%%
%% Default bindings:
%%
%% ESCAPE    quits the search
%% ^G        aborts the search (returns to starting point)
%% ESCAPE or ENTER as first char: switch to non incremental search
%%           with the last isearch match as default
%% BACKSPACE deletes last character entered and returns to previous point
%% ^S        finds next match (and switches to forward search)
%% ^R        finds previous match (and switches to backward search)
%%
%% You may use the following variables to change this behaviour,
%%  either here or (better!) in your keybinding defining file (e.g. ".jedrc")
%%
%% This code fragment checks to see what the isearch keys are bound to

require ("srchmisc");
custom_variable ("Isearch_Highlight", 1);
private define get_bound_key (search_func, default)
{
   foreach (["", which_key (search_func), pop()])
     {
	variable key = ();
	if (strlen (key) == 2)
	  {
	     if (key [0] == '^')
	       return (key [1] - '@');
	  }
     }
   return default;
}

custom_variable ("Isearch_Forward_Char", 
		 get_bound_key ("isearch_forward", 19));
custom_variable ("Isearch_Backward_Char", 
		 get_bound_key ("isearch_backward", 18));
custom_variable ("Isearch_Quit_Char",    '\e' );
custom_variable ("Isearch_Abort_Char",     7  ); % ^G

%% Cause isearch_{forward,backward} to behave in the traditional
%% manner by default.  Otherwise, wrap around to the start/end
%% of the buffer and keep going after a forward/reverse search
%% fails.
custom_variable("SEARCH_WRAP", 0);

variable Isearch_Last_Search = "";

private variable Last_Search_Failed = 0;

private define isearch_simple_search (dir)
{
   Last_Search_Failed = 0;

   if (dir < 0)
     search_backward ();
   else
     search_forward ();
   Isearch_Last_Search = LAST_SEARCH;
}

private define perform_search (str, dir)
{
   variable cs = CASE_SEARCH;
   if (strlow (str) != str)
     CASE_SEARCH = 1;

   if (dir > 0)
     dir = fsearch (str);
   else
     dir = bsearch (str);

   CASE_SEARCH = cs;
   return dir;
}

private variable Position_Stack;
private define push_position (attached_to_char)
{
   variable s = struct
     {
	mark, attached_to_char, next
     };
   s.mark = create_user_mark ();
   s.attached_to_char = attached_to_char;
   s.next = Position_Stack;
   Position_Stack = s;
}

private define delete_position_stack ()
{
   Position_Stack = NULL;
}

private define isearch_del (str)
{
   variable attached_to_char = 1;

   if (Position_Stack != NULL)
     {
	variable s = Position_Stack;
	Position_Stack = s.next;
	attached_to_char = s.attached_to_char;
	goto_user_mark (s.mark);
     }

   if (attached_to_char)
     {
	variable n = strlen (str);
	if (n)
	  str = substr (str, 1, n-1);
     }
   
   return str;
}


define isearch_dir (dir)
{
   variable prompt, str = "";
   variable c, first = 1;
   variable len = 0;

   delete_position_stack ();
   variable start_mark = create_user_mark ();

   EXIT_BLOCK
     {
	delete_position_stack ();
        Last_Search_Failed = 0;
     }
   ERROR_BLOCK
     {
	delete_position_stack ();
        Last_Search_Failed = 0;
     }

   forever
     {
	variable prompt_prefix;
	variable prompt_suffix;
	variable h = is_line_hidden ();
	set_line_hidden (0);

	if (Last_Search_Failed)
	  {
	     prompt_prefix = "Failed: i";
	     if (strlen(str) > 0)
	       prompt_suffix = ": ";
	     else
	       prompt_suffix = "";
	  }
	else
	  {
	     prompt_prefix = "I";
	     prompt_suffix = ": ";
	  }
	if (dir > 0)
	  prompt = prompt_prefix + "search forward" + prompt_suffix;
	else
	  prompt = prompt_prefix + "search backward" + prompt_suffix;

	message (prompt + str);

	push_spot ();

	IGNORE_USER_ABORT++;
	if (Isearch_Highlight)
	  {
	     if (looking_at (str) and (Last_Search_Failed == 0))
	       mark_next_nchars (strlen(str), dir);
	  }
	else
	  {
	     if ((dir > 0) and looking_at (str))
	       go_right (strlen (str));
	  }
	update_sans_update_hook (0);
	pop_spot ();

#ifexists AnyError
	try
	  {
#endif
	     c = getkey();
#ifexists AnyError
	  }
	finally
#endif
	IGNORE_USER_ABORT--;

	set_line_hidden (h);
	switch (c)
	  { case Isearch_Quit_Char and first :
	     isearch_simple_search (dir); break;
	  }
	  { case Isearch_Forward_Char :       % ^S
	     push_position (0);
	     if (dir < 0)
	       {
		  % Clear 'failed' indicator if we've changed direction.
		  Last_Search_Failed = 0;
		  dir = 1;
	       }
	     else
	       {
		  go_right_1 ();
		  !if (strlen (str))
		    {
		       str = Isearch_Last_Search;
		       len = strlen (str);
		    }
	       }
	  }
	  { case Isearch_Backward_Char :  %^R
	     push_position (0);
	     if (dir > 0)
	       {
		  % Clear 'failed' indicator if we've changed direction.
		  Last_Search_Failed = 0;
		  dir = -1;
		  c = ' ';                      % use this to fool test (*) below
	       }
	     else
	       {
		  !if (strlen (str)) str = Isearch_Last_Search;
	       }
	  }
	  { case 127 :
	     % Clear 'failed' indicator.
	     Last_Search_Failed = 0;
	     str = isearch_del (str);
	     continue;
	  }
	  { case Isearch_Abort_Char : % ^G go back to start
	     goto_user_mark (start_mark);
	     beep ();
	     return;
	  }
	  {
	   case '\r' and first:
	     if (dir > 0) return search_forward ();
	     else return search_backward ();
	  }
	  {
	   case '\e':
	     if (input_pending (3))
	       ungetkey (c);
	     break;
	  }
#ifdef IBMPC_SYSTEM
	  {
	   case 0xE0:
	     ungetkey (c);
	     break;
	  }
#endif
	  { c < 32 :
	     if (c != '\r') ungetkey (c);
	     break; 	       % terminate search
	  }

	  { str += char (c);             % any other char
	     push_position (1);
	     % Clear 'failed' indicator.
	     Last_Search_Failed = 0;
	  }

	first = 0;

	if (Last_Search_Failed and (SEARCH_WRAP > 0))
	  {
	     % The _next_ C-s or C-r after a previous C-s or C-r that failed
	     % will now redo the search from either the beginning or end of
	     % the buffer, depending on whether we've been going forwards or
	     % backwards.
	     Last_Search_Failed = 0;
	     push_mark ();
	     if (dir > 0)
	       bob();
	     else
	       eob();
	     pop_mark (not (perform_search (str, dir)));
	     continue;
	  }

	% test (*), see ^R switch above
	% NOTE: This test used to include a check to make sure that the 
	%       position stack was not empty.  Does it matter?  --JED
	if ((dir < 0) and looking_at (str) and (c >= ' '))
	  continue;

	if (perform_search (str, dir))
	  len = strlen (str);
	else
	  {
	     variable msg;
	     if (c == Isearch_Forward_Char) go_left_1();
	     if (strlen(str) > 0)
	       msg = strcat (str, " not found.");
	     else
	       msg = "No search string.";
	     flush (msg);
	     % Only beep if we're not wrapping.
	     if (SEARCH_WRAP < 1)
	       beep ();
	     () = input_pending (10);
	     % str = isearch_del (str);
	     if (EXECUTING_MACRO)
	       error ("Not found.");
	     % This piece of state information needs to be set as late
	     % as possible after a failed search attempt.
	     Last_Search_Failed = 1;
	  }
     }

   EXECUTE_ERROR_BLOCK;
   if (strlen (str))
     Isearch_Last_Search = str;
   if (dir > 0)
     go_right (strlen (str) - len);
   message ("Done.");
}

define isearch_forward()
{
   %variable save_abort = IGNORE_USER_ABORT;
   %IGNORE_USER_ABORT = 1;
   isearch_dir (1);
   %IGNORE_USER_ABORT = save_abort;
}

define isearch_backward()
{
   %variable save_abort = IGNORE_USER_ABORT;
   %IGNORE_USER_ABORT = 1;
   isearch_dir (-1);
   %IGNORE_USER_ABORT = save_abort;
}