From:	CRDGW2::CRDGW2::MRGATE::"SMTP::CRVAX.SRI.COM::RELAY-INFO-VAX"  1-NOV-1989 05:47
To:	MRGATE::"ARISIA::EVERHART"
Subj:	Customized Spell

Message-Id:  <8911011040.AA09709@crdgw1.ge.com>
Received: From VAX01.AMS.COM by CRVAX.SRI.COM with TCP; Wed,  1 NOV 89 02:23:26 PDT
Date: Sun 29 Oct 89 12:38:17-EDT
From: "Rich DeJordy, x295" <RAD@MATH.AMS.COM>
Subject: Customized Spell
To: info-vax@kl.sri.com
Cc: rad@MATH.AMS.COM

A while ago I sent out a message about customizing the SPELL command within EVE
and received several requests for the program.  I then went away and continued
to receive requests.  I am now sending the program accross the list because
I received over 20 requests.

This is standard text and the longest record (according to RMS) is 80 characters
so it should have no problems.

Richard DeJordy                  American Mathematical Society
Systems Programmer               P.O. Box 6248
                                 Providence, RI 02940
RAD@MATH.AMS.COM                 (401) 272-9500 x295

-------
NEWSPELL.TPU

(See comments for where to customize)
procedure eve$$spell (text_ptr)	   ! Actually invoke command SPELL
! Modified from EVE$$SPELL of TPU V2.0 by Tom Blythe and Rich DeJordy, AMS

local   local_text,
	start_mark,
	end_mark,
	the_file,
	the_position,
	is_offset;

on_error
    [TPU$_CONTROLC]:
	set (SCREEN_UPDATE, ON);
	eve$learn_abort;
	abort;
    [TPU$_CREATEFAIL]:
	eve$message (EVE$_CANTCREASPELL);
	eve$learn_abort;
	return (FALSE);
    [OTHERWISE]:
	set (SCREEN_UPDATE, ON);
endon_error;

local_text := text_ptr;

! first see if the file pointed to by AMS$SPELL (deflt SYS$SYSTEM:AMS$SPELL.EXE)
! exists.  If it does not, don't invoke the spell command.

eve$reset_file_search;		! Negate earlier file_search with same name.
if file_search ("AMS$SPELL", "SYS$SYSTEM:.EXE") = ""
then
    message("Sorry, no spell program has been specified.");
    eve$learn_abort;
    return (0);
endif;

if get_info (eve$$spell_buffer, "type") <> BUFFER
then
    eve$$spell_buffer := eve$init_buffer ("SPELL", "");
endif;

if (get_info (eve$$x_spell_process, "type") = UNSPECIFIED) or
    (eve$$x_spell_process = 0)
then
    eve$$x_spell_process := create_process (eve$$spell_buffer, "$ set noon");
    send ("$ delete:==delete", eve$$x_spell_process);	! disregard user symbols
endif;

! Make filename point to SYS$SCRATCH directory, with the integer pid number as
! the filename and the same extension.  If no extension is present, use .tmp

the_file := "sys$scratch:" +	
	str (get_info (eve$$x_spell_process, "pid")) +
	file_parse(get_info(current_buffer,"file_name"),"*.tmp","",type);

set (SCREEN_UPDATE, OFF);

! insure we do complete lines (otherwise single words selected in the middle of
! a line get read_file'd onto previous line, too nasty to prevent)

if eve$x_select_position <> 0
then
    start_mark := beginning_of (local_text);
    end_mark := end_of (local_text);
    if get_info (start_mark, "offset") > 0
    then
	position (start_mark);
	position (LINE_BEGIN);
	start_mark := mark (NONE);
    endif;
    if get_info (end_mark, "offset") > 0
    then
	position (end_mark);
	position (LINE_END);
	end_mark := mark (NONE);
    endif;
    local_text := create_range (start_mark, end_mark, NONE);
endif;

! write out temp file to be checked by spell progarm

write_file (local_text, the_file);	! should on_error return false?

spawn ("SPELL " + the_file );   	! *** COMMAND LINE ***

eve$x_select_position := 0;
the_position := beginning_of (local_text);
erase (local_text);
if (the_position <> beginning_of (current_buffer))
then
    move_horizontal (-1);
    the_position := mark (NONE);
    move_horizontal (1);
    is_offset := 1;
endif;

read_file (the_file);		! get corrected text
position (the_position);
if is_offset
then
    move_horizontal (1);
else
    position (beginning_of (current_buffer));
endif;
send ("$ delete " + the_file + ";*", eve$$x_spell_process);
set (SCREEN_UPDATE, ON);
refresh;
return (TRUE);

endprocedure
-------

