[Date Prev] [Date Next] [Thread Prev] [Thread Next] Date Index Thread Index Search archive:
Date:Mon Mar 15 22:34:27 1995 
Subject:Re: ved search and replace in poplog v14.5 (PS) 
From:Jon Meyer 
Volume-ID:950325.01 

On Aarons comments on the new search/replace mechanism in Ved 14.5:

I decided when I implemented the regular expression based
search/replace mechanism to make / and \ symmetrical. I think 
it is very confusing if a forward search finds A then B, but 
a subsequent backwards search then fails to finds A --
especially to the uninitiated.

In the new mechanism, wrapping is of course optional. If you don't 
like it, you can use:
   
     <ENTER> /abc/ -wrap
or
     <ENTER> \abc\ -wrap

to search without wrapping. I had thought of making '-wrap' be
the default, but I use wrapping a lot so I made +wrap the default.

One other point: all search/substitute commands are in fact
implemented as a closure on ved_search_or_substitute. So you could
add:

define global vars ved_backsearch =
        ved_search_or_substitute(%'+back -wrap', false%)
enddefine;

to your vedinit.p. Then your backward searches won't wrap. 

> I wonder whether the change was based on some sort of consultation, or
> whether it was put in by accident, or whether it was done deliberately
> but without consultation.
> 

I designed and implemented the regexp search/substitute mechanism 
initially for my own private satisfaction and use. I tried to keep 
with the spirit of the original mechanism, but remove inconsistencies
and extend functionality. Wrapping was one such inconsistency.

Since the mechanism turned out to be very handy, I made the code 
freely available as a poplocal library on the PLUG archive. I
received a number of comments and bugreports, and made several
changes to the system as a result of this process.

Later, by popular demand, I was asked to replace the old, inconsistent 
mechanism with the new, differing one. At the time I voiced 
concerns and outlined the problems, but the general feeling was 
that the benefits merited the change. I tend to agree - I'm sorry 
if you feel otherwise.

Jon.

PS. One feature that I added to my mechanism was the '@:' 
substitute option. This allows you to use a Pop-11 expression
to formulate the subsitution string. For example:

gsr/@a/@:(vedline >< ':') 

inserts the line number at the start of each line in a marked range,
and:

gs/;;; @.@*/@:(uppertolower(vvedfoundstring))

changes everything after a ';;;' to lower case.

I don't know if this option was installed in the masters. If it
was, perhaps this sweetens the change?