[comp.unix.questions] Mail and vi

pkopp@potpourri.UUCP (Paul Kopp) (07/15/87)

main()
{
Here's a question about something that's been bothering me for quite a
while.

Is there a way (an option, a script, or whatever) to have "Mail" put
you directly into vi after specifying the subject???  I know about the
time.  Is there some way to have the ~v command execute automatically?

Any help will help (humm..did I say that?).


        Gould Inc., Computer Systems Division, in Sunny South Florida
              ** The opinions (if any) expressed are my own. **
       ...seismo!gould!pkopp  OR  ...akgua!ucf-cs!novavax!gould!pkopp
     If you mail me, ignore the header and use the addresses above only.
}

ken@rochester.arpa (Ken Yap) (07/16/87)

While on this topic, Mail on my system (4.3 BSD) doesn't use $PATH for
looking for vi, when ~v is used. Anybody else have the same problem?
It appears to have been fixed by SunOS 3.2.  Not that it matters much
to me, I mostly use MH.

	Ken

tad@pyr.gatech.EDU (Tad K. Mannes) (07/16/87)

In article <581@sol.ARPA> ken@rochester.UUCP (Ken Yap) writes:
>While on this topic, Mail on my system (4.3 BSD) doesn't use $PATH for
>looking for vi, when ~v is used. Anybody else have the same problem?
>It appears to have been fixed by SunOS 3.2.  Not that it matters much
>to me, I mostly use MH.
>
>	Ken

Getting mail to use vi when you type "~v":

	This really depends on the mail program you use, so you should look
	it up in the online manual.  More than likely though, you will need
	to set an environment variable (namely VISUAL) to the vi program
	including the path (e.g. VISUAL=/usr/ucb/vi ).  And be sure to
	export it (that depends on the shell you use).  Or you might try
	putting the "VISUAL=/usr/ucb/vi" in a file by the name of ".mailrc".
	and then you don't have to worry about having it exported from
	your shell, because the .mailrc file is automatically executed 
	when mail is started up (this too might depend on the mail program).


Getting mail to go directly into vi when sending a message:

	So far as I know there is no way to get mail to do that, however
	you can write an alias or function which will put you in "vi"
	and then pipe that file into the mail program.  You might try
	something like the following:
		alias sendmail "vi .letter; mail $* < .letter"
	This depends on the shell you use but I think this will work
	on the c shell (csh).  I can't remember is the "$*" is correct
	though, if it is'nt you might try "$@" instead.  And to use
	this new command you would do something like this:
		sendmail tad
	and then you would be put in vi to edit your letter.  Once you
	leave the editor the letter file would be piped into mail and
	sent to the user "tad" (thats me :-) 
	
-- 
	tad@pyr.gatech.edu	|	Tad K. Mannes
	CCOPRTM @ GITVM1	|	Office of Computing Services
				|	Georgia Institute of Technology

ken@rochester.arpa (Ken Yap) (07/22/87)

I know about setenv VISUAL /usr/ucb/vi. What I'm complaining about is
the lack of foresight in the Mail design in requiring an absolute path
and not using the search path. For instance I might want to temporarily
use my private copy of vi for everything.  For example, less uses
$VISUAL (or was it $EDITOR?) too. I don't want to have to edit lots of
config files. I just want to change it in .cshrc once.

	Ken

mazumdar@sunybcs.uucp (Jin Mazumdar) (07/23/87)

Doesn't mail use the editor specified in .mailrc?

todd@uhccux.UUCP (The Perplexed Wiz) (07/29/87)

In article <3816@pyr.gatech.EDU> tad@pyr.UUCP (Tad K. Mannes) writes:
>	something like the following:
>		alias sendmail "vi .letter; mail $* < .letter"
>	This depends on the shell you use but I think this will work
>	on the c shell (csh).  I can't remember is the "$*" is correct

Hmm...I think that instead of $* you should use \!*


..todd


-- 
Todd Ogasawara, U. of Hawaii Center for Teaching Excellence
UUCP:		{ihnp4,seismo,ucbvax,dcdwest}!sdcsvax!nosc!uhccux!todd
ARPA:		uhccux!todd@nosc.MIL
INTERNET:	todd@uhccux.UHCC.HAWAII.EDU