From: nin15b43@merrimack.edu
Newsgroups: comp.os.vms
Subject: Re: EMACS as default mail editor?
Date: 5 Nov 92 15:09:25 GMT
Organization: Merrimack College, No. Andover, MA, USA

In article <1992Nov4.162506.13620@synapse.bms.com>, kaz@bms.com writes:
> 
> Does anyone know if it's possile to specify EMACS as as the default
> editor in MAIL?
> 
> The documentation for SET EDITOR in MAIL says to specify any callable
> editor.  I don't beleive that EMACS is callable, but I'm not sure about
> that.
> 
> I'm running EMACS v18.58.1 on VMS 5.4-2.
> 
Well, I use MicroGNUEmacs as my MAIL editor, but before that I used
the full GNUEmacs.  No problems with either one.  The way I do it is
to create a .COM file to call your editor.  Below is a copy of the
.COM file I use, as well as the way to define the mail$edit system
logical.  I also have a command file to run EMACS as a kept editor;
it is also included below.

Extract the two .COM files separately, and put the definitions in
your LOGIN.COM.  Don't forget to change the editor names, etc, to
suit your system.

----- cut here for MAILEDIT.COM -----

$	Verify = 'F$Verify(0)
$ ! Command procedure to invoke MG from MAIL.
$ !	MG :== $dev:[dir]MG
$ !	DEFINE MAIL$EDIT dev:[dir]MGMAILEDIT.COM
$ ! Inputs:
$ !	P1 = Input file name.
$ !	P2 = Output file name.
$ ! Copy the input file to the output file, then invoke MG on it.
$ !
$ Set Noon
$ If P2 .Nes. "" .AND. P1 .Nes. "" Then Copy 'P1' 'P2'
$ Define/User Sys$Input Sys$Command
$ MG 'P2'
$ set term/appl
$ If Verify Then Set Verify
$ exit

----- cut here for mail$edit definition -----

$  define/job/nolog	mail$edit	disk:[dir]mailedit.com

----- cut here for KEPTEDITOR.COM -----

$!+
$!   GNU Emacs kepteditor.com
$!-
$!
$! Note:  the user can set the logical 'emacs_procname' from
$!        thier LOGIN.COM to be anything they desire.  If one
$!        is not set by the user, a default is used.
$
$ verify = f$verify (0)
$
$	name		= "''f$trnlnm("emacs_procnam")"
$
$	priv_list	= f$setprv ("noworld,nogroup")
$	pid 		= 0
$ 10$:
$ 	proc		= f$getjpi (f$pid(pid),"PRCNAM")
$ 	if proc .eqs. name then -
$		goto attach
$ 	if pid .ne. 0 then -
$		goto 10$
$
$ spawn:
$	args	= p1 + " " + p2 + " " + p3 + " " + p4 + " " + -
    		  p5 + " " + p6 + " " + p7 + " " + p8
$ 	priv_list	= f$setprv (priv_list)
$ 	write sys$error "Now starting ''name'..."
$
$	define/user	sys$input	sys$command
$	spawn	/process="''name'" -
		/nolog -
		runemacs 'args'
$	goto quit
$
$ attach:
$ 	write sys$error "Returning to ''name'..."
$ 	priv_list	= f$setprv (priv_list)
$	message_status = f$environment("message")
$	set noon
$	set message /nofacility/noidentification/noseverity/notext
$	deassign/job emacs_file_name
$	set on
$	set message 'message_status
$	if p1 .eqs. "" then goto no_logical
$	temp = f$trnlnm("SYS$DISK") + f$directory() + p1
$	temp = f$edit(temp,"lowercase")
$	define/nolog/job emacs_file_name "''temp'"
$ no_logical:
$ 	define/user	sys$input	sys$command
$ 	attach "''name'"
$
$ quit:
$	priv_list	= f$setprv ("noworld,nogroup")
$	pid 		= 0
$20$:
$ 	proc		= f$getjpi ( f$pid ( pid ), "PRCNAM")
$ 	if proc .eqs. name then -
$		goto attach_out
$ 	if pid .ne. 0 then -
$		goto 20$
$       write sys$error " "
$ 	write sys$error "Now quitting ''name'..."
$       write sys$error "''name' exited."
$       write sys$error " "
$
$attach_out:
$	write sys$error -
"Current directory: ''f$trnlnm("sys$disk")'''f$directory()'"
$ 	priv_list	= f$setprv (priv_list)
$	set term/appl
$ 	if verify then set verify
$	exit

----- cut here for definition of the kept editor -----

$ em*acs  :== @disk:[dir]kepteditor.com

----- cut here -----

> Thanks in advance...
> 
> -----------------
> Joe Kazimierczyk
> kaz@bms.com

You're welcome

Mark
-- 
- - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Mark Gelinas      | UUCP:    samsung!hubdub!NIN15B43
Merrimack College | or       NIN15B43@merrimack.edu