sam-fans - fans of the sam editor
 help / color / mirror / Atom feed
* Re:  Byron's comments
@ 1992-11-19 15:31 rsalz
  1992-11-19 22:32 ` Scott Schwartz
  0 siblings, 1 reply; 2+ messages in thread
From: rsalz @ 1992-11-19 15:31 UTC (permalink / raw)
  To: john; +Cc: sam-fans

    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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Byron's comments
  1992-11-19 15:31 Byron's comments rsalz
@ 1992-11-19 22:32 ` Scott Schwartz
  0 siblings, 0 replies; 2+ messages in thread
From: Scott Schwartz @ 1992-11-19 22:32 UTC (permalink / raw)
  To: rsalz; +Cc: john, sam-fans


| 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.



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1992-11-19 22:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1992-11-19 15:31 Byron's comments rsalz
1992-11-19 22:32 ` Scott Schwartz

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).