[comp.editors] A question on .exrc while using vi

gpvos@cs.vu.nl (Gerben 'P' Vos) (12/12/90)

Several people wrote in follow-up to:
>:>> 	The goal:
>:>> 	All I am trying to do is replace the 'the's by 'an's.
>:>> 	That's all.

The answer was:
>    %s/\<the\>/an/g

Now, does anyone know what caused the core dump when the original poster put
something quite like this (only slightly incorrect) in his .exrc ?

-					Gerben.
--
--- Gerben Vos - Aconet: BIGBEN!Gerben Vos - Internet: gpvos@cs.vu.nl
"While you are here, your wives and girlfriends are dating handsome American
 movie and TV stars. Stars like Tom Selleck, Bruce Willis, and Bart Simpson."
                                -- Baghdad Betty

kirkenda@eecs.cs.pdx.edu (Steve Kirkendall) (12/14/90)

In article <8490@star.cs.vu.nl> gpvos@cs.vu.nl (Gerben 'P' Vos) writes:
>Several people wrote in follow-up to:
>>:>> 	The goal:
>>:>> 	All I am trying to do is replace the 'the's by 'an's.
>>:>> 	That's all.
>
>The answer was:
>>    %s/\<the\>/an/g
>
>Now, does anyone know what caused the core dump when the original poster put
>something quite like this (only slightly incorrect) in his .exrc ?

Hmmm... When I added the ":set directory=..." option to Elvis, I discovered
a potential problem:

 - The "directory" option says where the temp files should be stored;
   so it must be set before the first temp file is created.

 - It should be settable in a user's .exrc file;
   so the .exrc file must be run before the first temp file is created.

 - A temp file *must* be created when you start to edit a file.

 - Therefore, when .exrc is being run, Elvis can't be editing anything!

Currently, Elvis will issue an error message if your .exrc tries to use
any commands which act upon a text.  Only things like ":map" and ":set"
are allowed.  Eventually, I plan to modify Elvis so that it starts up
the first file when you give the first text-sensitive command, but I
haven't done that yet.

Perhaps there are versions of vi out there that don't handle this in a
safe way?  That neither give error messages, nor correctly start up the
first file?
-------------------------------------------------------------------------------
Steve Kirkendall     kirkenda@cs.pdx.edu      Grad student at Portland State U.

mercer@npdiss1.StPaul.NCR.COM (Dan Mercer) (12/14/90)

In article <110105@convex.convex.com> tchrist@convex.COM (Tom Christiansen) writes:
:In article <1990Dec9.033641.9731@csn.org> skwu@spot.Colorado.EDU (WU SHI-KUEI) writes:
::>> 	The goal:
::>> 	All I am trying to do is replace the 'the's by 'an's.
::>> 	That's all.
::Sonny boy, it ain't all that easy - your solution changes all instances of
::'theatre' to 'anatre', 'gather' to 'gaanr', etc., etc.  It takes three commands
::in 'ed' or 'sed' to accomplish the original task:
::
::	g/^the /s//an/g
::	g/ the /s//an/g
::	g/ the$/s//an/g
::
::If the 'the's may be preceded or followed by tabs as well as spaces, things
::may be even more complicated.
:
:*PLEASE* don't spread misinformation.  All it takes is a simple \<the\> in
:the expression to take care of those cases.
:
:    %s/\<the\>/an/g
:
:--tom
:--
:Tom Christiansen		tchrist@convex.com	convex!tchrist
:"With a kernel dive, all things are possible, but it sure makes it hard
: to look at yourself in the mirror the next morning."  -me
Not on my Tower 650 running SysV R3.2.  Ed responds with '?' to the
word regular expression.  Sed treats any expression '\char' as a
replacement for the regular slash.  Results were unpredictable.

So Wu Shi-Kuei is right by my book (of course,  someone should also
take into account constructs like 'the', "the", and of course,
capitals.

Compliance with regular expressions varies greatly ampngst the various
editors, awks, and expr's - not to mention lex and regex
implementations.  What is needed is an ANSI RE Spec.

-- 
Dan Mercer
NCR Network Products Division      -        Network Integration Services
Reply-To: mercer@npdiss1.StPaul.NCR.COM (Dan Mercer)
"MAN - the only one word oxymoron in the English Language"

djm@eng.umd.edu (David J. MacKenzie) (12/21/90)

In vi/ex, you can use %s/\<the\>/an/g; \< and \> are a vi/ex extension
to the ed/sed regex syntax, so if you're using ed or sed you can't use
them.  POSIX.2 (in balloting right now but probably has another draft
or two to go before it gets approved) specifies a regular expression
syntax standard, so eventually there should be regex uniformity among
POSIX-compliant Unix tools.  I think POSIX.2 specifies both a plain
and an extended syntax, but I don't have a copy of it here so I can't
double-check. 
--
David J. MacKenzie <djm@eng.umd.edu> <djm@ai.mit.edu>