Subject: Re: Byron's comments

From: [email-masked]
Date: Thu, 19 Nov 1992 10:31:40 -0500

Modifying sam to use, for example, ctags, might be more of a
    challenge.
Well, Samuel sounds real cool, but...

The following script has reasonable speed.  If it ends a tags file entry
it outputs the set of commands that would make sam open that file and
(more or less) move to the right place.  I say more or less because I
just turn Sam's re metachars into dots.

Here's how to use it.  In the command window type "!samtag Cmd", for
example.  Then select the two lines that it outputs:
	!samtag Cmd
	B ../sam/parse.h
	/^typedef struct Cmd Cmd;$/
then click "send" on the middle menu.

If you have xcb (get it get it get it) then you can jump from text, too.
Double-click on a function, then on the middle menu click "snarf" then "exch".
Then click to the ~~sam~~ window and type "!samtag" and use as before.

#! /bin/rc
##  Output a series of commands that will make same go to the tag named on
##  the command line.  If no argument, use the word in the current X
##  selection.  The best way to get the selection is to install xcb; available
##  as contrib/xcb-2.1.tar.Z on export.lcs.mit.edu.

##  Useful variables
~ $#tagspath 0 && tagspath = (. .. /usr/lib/tags)
nl = '
'
tab='	'

##  Get the current X selection.  I strongly recommend xcb;
if ( ~ $#* 0 ) {
    function = `{xcb -p 0}
} else {
    function = $1
}
function = $function ^ '	'

for (i in $tagspath)
    test -f $i ^ /tags && {
	line = `` ($nl) { look $function $i ^ /tags ; echo $status }
	~ $#line 2 && ~ $line(2) 0 && {
	    * = `` ($tab $nl) { echo $line(1) }
	    if ( ~ $i . || ~ $2 /* ) {
		dir = ''
	    } else {
		dir = $i ^ '/'
	    }
	    echo B $dir ^ $2
	    shift ; shift
	    # Gross hack...
	    echo $* | tr '()*' '...'
	    exit 0
	}
    }
exit 1

---

From: Scott Schwartz <[email-masked]>
Date: Thu, 19 Nov 1992 17:32:17 -0500

| Here's how to use it.  In the command window type "!samtag Cmd", for
| example.  Then select the two lines that it outputs:
| 	!samtag Cmd
| 	B ../sam/parse.h
| 	/^typedef struct Cmd Cmd;$/
| then click "send" on the middle menu.

Hrm.  I'd rather type something like ``@samtag Cmd'', and have sam
execute the output of Cmd.  Now that @ is no longer magical, it could
be used for that.