Post by Rob PikeNothing. That's exactly what ^ and $ do.
OK. How does one match the start/end of dot in a g// or v// regexp?
Wait, Rob Pike? That "Rob Pike?" As in the guy who wrote the program?
How fortuitous. :)
I read your paper on sam, as well as the tutorial, and I understand the
examples, but I'm having trouble figuring out how to use sam for Real
Work(TM). Every time I try to, I get unexpected results: either an
error message, or something I didn't expect. One thing that I'm having
trouble with is figuring out how to SHRINK dot. Expanding dot (by
regexp search) is easy:
,c/this is a line of letters/
,x/l..e/p
line
,x/(a|the) l..e [a-zA-Z]+/p
a line of
But if I want to shrink dot, say to just those two (..) characters, how
can I do it? I could y/l/, but I'd need a way to detect on which "l"
dot is being split. To wit, there is also an "l" matched by [a-zA-Z].
One of the things I had difficulty figuring out was how dot behaves
between subcommands in a compound command:
,c
this is some text for sam
to edit using commands in
a command block, to see
whether or not dot is passed
from command to subsequent command
within the block
.
,x/(.+\n)+/ y/command/ {
/[ \n][a-zA-Z]+/-/[ \n][a-zA-Z]+/-/[ \n][a-zA-Z]+/-/[ \n][a-zA-Z]+/d
a/X/
}
The docs don't state explicitly how dot changes (or doesn't change)
between subcommands. The tutorial says that "{" sets dot for each
subcommand, but doesn't reveal that "{" resests dot *to the same thing*
for each subcommand. As this example shows, a d// followed by an a// is
not the same as a c//, because dot is reset between subcommands.
A number of sources on the Interweb state that you use sam as your
preferred editor. Maybe that's easier if happen to be the person who
wrote the program. :) I though that, perhaps, acme might be more
usable, but the acme docs state that it implements the same command set
as sam (with the exception of the k, n, q, !, and = commands). Do you
still use sam as your day-to-day editor? Or have you switched to
ema^H^H^Hacme?
Another feature (limitation?) of sam is that changes made by subcommands
must be in left-to-right order. IIRC, the acme docs mentioned something
about sorting changes to the file in order to implement its Undo and
Redo functions. Does the sam-like editing in acme have the same
left-to-right limitation? I figure, if anyone would know, it would be
the person who wrote acme, too. :)
The use of structural regular expressions looks like it could be very
expressive and, ultimately, very useful. It would be great if I could
figure out how to use sam (or acme, if it's any better) for real life
work.
Thanks! (...for you help ...and for writing this infernal program in
the first place ;) )
--
+---------------------------------------------------------------+
|Smiley <***@icebubble.org> PGP key ID: BC549F8B |
|Fingerprint: 9329 DB4A 30F5 6EDA D2BA 3489 DAB7 555A BC54 9F8B|
+---------------------------------------------------------------+