From:	CRDGW2::CRDGW2::MRGATE::"SMTP::CRVAX.SRI.COM::RELAY-INFO-VAX" 28-JUN-1990 00:25:19.80
To:	MRGATE::"ARISIA::EVERHART"
CC:	
Subj:	Quoting Mail in TPU...

Received:  by crdgw1.ge.com (5.57/GE 1.70)
	 id AA26405; Thu, 28 Jun 90 00:17:24 EDT
Received: From UCBVAX.BERKELEY.EDU by CRVAX.SRI.COM with TCP; Wed, 27 JUN 90 19:03:33 PDT
Received: by ucbvax.Berkeley.EDU (5.63/1.41)
	id AA20495; Wed, 27 Jun 90 18:50:31 -0700
Received: from USENET by ucbvax.Berkeley.EDU with netnews
	for info-vax@kl.sri.com (info-vax@kl.sri.com)
	(contact usenet@ucbvax.Berkeley.EDU if you have questions)
Date: 28 Jun 90 01:48:33 GMT
From: bronze.ucs.indiana.edu!mdchaney@iuvax.cs.indiana.edu  (M Darrin Chaney)
Organization: Indiana University, Bloomington
Subject: Quoting Mail in TPU...
Message-Id: <49050@iuvax.cs.indiana.edu>
Sender: info-vax-request@kl.sri.com
To: info-vax@kl.sri.com

A week or two ago I submitted a file which would allow you to automatically
quote mail in TPU.  For an unknown reason, two assumptions were made.  They
were:

	1. You would never just 'send' to someone, always reply
	2. You know how to just add stuff to your editor

I corrected both of these mistakes after a couple of questions through mail.
Now if I may explain what exactly these do.

The first procedure is called MailQuote (mdc$mailquote).  It will quote a
message (with >'s).  If there is nothing in the file, it won't bother.  It's
easy to change the character, and i'll leave that as an exercise to the reader.

The second procedure will add the file 'Sys$Login:.Signature;' to the bottom
of the message and call EVE's exit procedure.

Both of these are dependent upon a third procedure, which initializes the
package.  Note that you must hit Ctrl-Z to get the signature appended.  Also,
any file that you edit of the name 'mail_*_edit.tmp;' will be quoted, so
beware.

Unlike some other procedures, you needn't make a fancy .com file or any of
that.  Simply use the "Set Editor" command in Mail and make your editor TPU.
These TPU procedures will do everything for you, and much quicker.

I commented everything, but it may not be clear.  If not, don't be afraid to
drop me some mail asking about it.

Now for a question.  Has anyone found any documentation on the TPU macros
%if, %else, %endif.  They are used in EVE, but I've never found any 
documentation.  Have I just overlooked something?

	Darrin

mdchaney@iubacs
mdchaney@bronze.ucs.indiana.edu
mdchaney@rose.ucs.indiana.edu

---------Cut here------I ain't joking--------Cut here---------seriously-----

!Note: Sorry, these only work with VMS5.*.  They simply will not work with
!any earlier versions of TPU.

!Contained here are two procedures that allow people to have mail messages
!automagically quoted when they are being replied to (Reply/Extract).  The
!second procedure will automatically add a '.signature' file to your message.
!You don't need to create a special '.com' file to call the editor.
!Instead, all that need be done is set the editor to TPU.  Note that this will
!not work for VAX Notes.

!If you have an existing '.tpu' file that you use with the editor (defined as
!TPU$COMMAND or edit/tpu/com=xxx.tpu) then add the procedures into the file,
!and put the extra commands at the bottom of this file at the bottom of
!your existing file.

!If you have a section file, do this:
!First, take all extra statements at the bottom of the file, and wrap them
!in a procedure called 'TPU$local_init'.  You can do this by simply taking
!away the exclamation marks on the 'Procedure tpu$local_init' line and also
!the 'EndProcedure;' line at the bottom.
!Now, do edit/tpu/com=thisfile.tpu.  Upon entering the editor, hit the 'Do'
!key and type 'Save Extended TPU', giving it the file name of your section
!file.
!With that done, this should work when you start up the editor from now on.

!This will allow me to quote people in mail.

Procedure mdc$MailQuote

Local Here;

   On_Error
      Position(Here);
      Delete(Here);
      Return
   EndOn_Error;

   Here:=Mark(None);

   If (Here=End_Of(current_buffer)) Then
        Return
   EndIf;
 
   Message('Quoting included message text...');

   Position(Beginning_Of(current_buffer));

   Loop

      Copy_Text('>');
      Position(Line_Begin);
      Move_Vertical(1);
      ExitIf (Mark(None)=End_Of(current_buffer));

   EndLoop;

   Split_Line;
   Split_Line;
   Move_Vertical(-1);
!Here, you have a choice.  If you want to be placed at the top of the message
!upon entry, uncomment the next statement.  If left commented, you will be
!placed in at the point where you can begin typing.
!   Position(Here);
   Delete(Here);

EndProcedure;

!This will be used if the .sig file needs to be appended to the message upon
!exit.  This is for use with Mail messages.
Procedure mdc$exit

!Go to the bottom of the buffer, the correct buffer
   Position(End_Of(EVE$X_Source_For_Default_Buffer));

!Tell them about it, then read the signature file in
   Message("Appending .signature file to message...");
   Read_File("Sys$Login:.Signature.");

!Update the display so they can see the .signature file in there...
   Update(current_window);

!Lastly, call EVE's exit procedure
   eve_exit;

EndProcedure;

!Now, for the initialization procedure

!Uncomment the next line if you want to use a section file
!Procedure TPU$Local_Init

!First, get the name and extension...
if (File_Parse(get_info(Command_Line,"Output_File"),'','',Name)<>'') Then
   file_name:=File_Parse(get_info(Command_Line,"Output_File"),"","",Name);
   file_ext:=File_Parse(get_info(Command_Line,"Output_File"),"","",Type);
Else
   file_name:=File_Parse(get_info(Command_Line,"File_Name"),"","",Name);
   file_ext:=File_Parse(get_info(Command_Line,"File_Name"),"","",Type);
EndIf;

!Now, find out if this is actually a mail message...

!See if it is "Mail_*_Edit.Txt"
If ((index(file_name,"MAIL_")<>0) and (index(file_name,"_EDIT")<>0) and
    (file_ext=".TMP")) then
  IsItMail:=1;
  MDC$MailQuote;
  Define_Key("mdc$exit",ctrl_z_key,"Exit");
Else
  IsItMail:=0;
EndIf;

!Uncomment the next line if you want to use a section file
!EndProcedure;

--------This is the end-------cut again----------------------------------------

	M Darrin Chaney

mdchaney@iubacs
mdchaney@bronze.ucs.indiana.edu
mdchaney@rose.ucs.indiana.edu

