sam-fans - fans of the sam editor
 help / color / mirror / Atom feed
From: "kim kubik" <chaotrope@jps.net>
To: <jim.robinson@stanford.edu>
Cc: "sam Fans" <sam-fans@hawkwind.utcs.toronto.edu>
Subject: Re: the obvious. =)
Date: Sun, 26 Mar 2000 15:54:17 -0500	[thread overview]
Message-ID: <01bf9765$97d9fd00$a4d2efd1@pkwksj.sjna.corp.dom> (raw)


-----Original Message-----
From: James A. Robinson <jim.robinson@stanford.edu>
To: kim kubik <chaotrope@jps.net>
Cc: sam Fans <sam-fans@hawkwind.utcs.toronto.edu>
Date: Saturday, March 25, 2000 5:54 PM
Subject: Re: the obvious. =)


>> >,x/^\/\*(.+\n)+ \*\/\n/ t /}\n/
>>
>> this just ran up against my (mis)understanding of
>> sam's regexp's. >
>
>Here's what I *think* is going on, but I'm no regex guru...  A
'(.*\n)+'
>would keep it going to the end of the file. With '(.+\n)+' I'm
specifying
>that there must be at least one character before the newline. So this
>match ends at the first blank line.  I think the engine then backtracks
>until it finds a match for ' \*\/'

Jim -

I tried a couple of different scenarios on before I posted
and *think* a blank line was one of the first I tried since
the . in (.+\n)+ obviously needs to match something "real".
Since I can't remember exactly, my best guess is that what I
tried must have been something like:

/**
 * stuff about foo
 *
 * and the above is a "blank" line
 * only if you're a total moron. . .
 */

which should put me in the forefront of those nominated for
the Homer Simpson Award, Year 2000 ("Doooh!").

Since you seem to like to pass around neat SREs, there are
times when it's necessary to convert a txt file to html and
using a sam "macro" file that I stick off to the side next
to the txt file (and using # faux-comments to remind me what
each does), there are things in txt2htm.sam like:

# Do these guys: &, <, > :
[,x/&|<|>/{
 g/&/c/&amp;/
 g/</c/&lt;/
 g/>/c/&gt;/
}]

where double clicking inside the last [bracket] backhilites this
section (but not the [ ] brackets), snarf it, click in the text
file, sam it, and send it. Bang, end of story.

And when casually perusing the text, if I note something worth
<b>embolding</b>, backhiliting the text of interest and snarfing
this from the "macro" file, sam-ing the text file and sending:

# BOLD FACE DOT:
[s/./<b>&/
 a/<\/b>/ ]

does just that.

And tho old habits are difficult to break, I've learned (but
still find myself forgetting) that one does not need the samX
cursor-arrow keys if you just STAY IN THE SAM COMMAND WINDOW
and move around using /re and -/re.  It is so much easier than
cursoring around, trying to remember which <ctrl>-Duh moves right
one word, whatever.  You're looking at 'miscake' and want it to be
'mistake' and almost as if sam can read one's mind, you just
dot-out and send the cursor there in one move, make the correction,
and get back where you were.

If you're at the EOF when you dot-out of text entry, it's easy to
get back; otherwise one can type e.g. zz, then dot out, make the
correction, and get right back to zz and continue on.

Maybe all this is obvious to everyone but me. . . most things are.

 - kim





             reply	other threads:[~2000-03-27  5:24 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <chaotrope@jps.net>
2000-03-26 20:54 ` kim kubik [this message]
2000-03-27  3:35   ` James A. Robinson
2000-03-27 14:37 rob pike
  -- strict thread matches above, loose matches on Subject: below --
2000-03-25 23:47 kim kubik
2000-03-26  1:51 ` James A. Robinson
2000-03-24 21:25 James A. Robinson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='01bf9765$97d9fd00$a4d2efd1@pkwksj.sjna.corp.dom' \
    --to=chaotrope@jps.net \
    --cc=jim.robinson@stanford.edu \
    --cc=sam-fans@hawkwind.utcs.toronto.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).