/usr/share/jed/lib/ispell.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 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 | %%
%% Ispell interface
%%
%!%+
%\variable{Ispell_Program_Name}
%\synopsis{spell-check program name}
%\usage{variable Ispell_Program_Name = ""}
%\description
% The spell check command used by the \sfun{ispell} function. It must
% be ispell-compatible (one of "ispell", "aspell" or "hunspell"). If
% unset, the ispell program will be auto-detected by searching the
% path for one of the above programs.
%\seealso{ispell, search_path_for_file}
%!%-
custom_variable("Ispell_Program_Name", NULL);
% Search for candidates:
if ((Ispell_Program_Name == NULL) || (Ispell_Program_Name == ""))
{
Ispell_Program_Name = "ispell";
foreach $1 (["aspell", "hunspell", "ispell"])
{
if (NULL != search_path_for_file(getenv("PATH"), $1))
{
Ispell_Program_Name = $1;
break;
}
}
Ispell_Program_Name += " -a";
}
define ispell ()
{
variable ibuf, buf, file, letters, num_win, old_buf;
variable word, cmd, p, num, n, new_word;
#ifdef OS2
file = make_tmp_file("jedt");
#else
file = make_tmp_file("/tmp/jed_ispell");
#endif
letters = "\a"R;
ibuf = " *ispell*";
buf = whatbuf();
skip_chars(letters); bskip_chars(letters); push_mark(); % push_mark();
n = _get_point ();
skip_chars(letters);
if (_get_point () == n)
{
pop_mark_0 (); %pop_mark_0 ();
return;
}
%word = bufsubstr();
#ifdef MSDOS MSWINDOWS WIN32
() = system(sprintf("echo %s | %s > %s",
bufsubstr(), Ispell_Program_Name, file));
#else
if (pipe_region(sprintf ("%s > '%s'", Ispell_Program_Name, file)))
error ("ispell process returned a non-zero exit status.");
#endif
setbuf(ibuf); erase_buffer();
() = insert_file(file);
() = delete_file(file);
%%
%% parse output
%%
bob();
if (looking_at_char('@')) % ispell header
{
del_through_eol ();
}
if (looking_at_char('*') or looking_at_char('+'))
{
message ("Correct"); % '+' ==> is derived from
bury_buffer (ibuf);
return;
}
if (looking_at_char('#'))
{
bury_buffer (ibuf);
return (message("No clue."));
}
del(); trim(); eol_trim(); bol();
if (ffind_char (':'))
{
skip_chars(":\t ");
push_mark();
bol();
del_region();
}
insert ("(0) ");
n = 1;
while (ffind_char (','))
{
del ();
trim(); newline();
vinsert ("(%d) ", n);
++n;
}
bob();
num_win = nwindows();
pop2buf(buf);
old_buf = pop2buf_whatbuf(ibuf);
set_buffer_modified_flag(0);
variable ok = 0;
try
{
num = read_mini("Enter choice. (^G to abort)", "0", "");
if (0 == fsearch(sprintf ("(%s)", num)))
throw RunTimeError, "$num is an invalid choice"$;
() = ffind_char (' '); trim();
push_mark_eol(); trim(); new_word = bufsubstr();
set_buffer_modified_flag(0);
sw2buf(old_buf);
pop2buf(buf);
ok = 1;
bskip_chars(letters); push_mark();
skip_chars(letters); del_region();
insert(new_word);
}
finally
{
if (ok == 0)
{
sw2buf(old_buf);
pop2buf(buf);
}
if (num_win == 1) onewindow();
bury_buffer(ibuf);
}
}
|