9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] acme tags for shell scripts
@ 2004-10-14 13:28 Gorka Guardiola
  2004-10-14 14:39 ` Russ Cox
  0 siblings, 1 reply; 5+ messages in thread
From: Gorka Guardiola @ 2004-10-14 13:28 UTC (permalink / raw)
  To: 9fans

I was trying to access the tag of the current window on acme from a
shell script and found it impossible.  The problem is that there is no
way to get back the id of the current window (the one the script is
run on) in the shell script in order to access to /dev/wsys/%d.  I have
looked the way win does it (binding the current window on /dev/wsys/id
and done it for every script run in acme).  It is a little change,
which makes ID obsolete (it can be a shell script now), and makes
scripts on acme more powerful.  It doesn't seem to break anything.
What do you think about it?.  Does it break anything, is it
necessary?.  Is there anything I haven't seen?.



I will create a patch tonight as I don't have time now, but the
diff is very simple... (I haven't taken ID out yet, that will take
some more work as I am not that familiar with acme).

term% yesterday -D /sys/src/cmd/acme
post...
diff -n /n/dump/2004/1014/sys/src/cmd/acme /sys/src/cmd/acme
diff -n /n/dump/2004/1014/sys/src/cmd/acme/exec.c /sys/src/cmd/acme/exec.c
/n/dump/2004/1014/sys/src/cmd/acme/exec.c:1206 c /sys/src/cmd/acme/exec.c:1206
< 		c->md = fsysmount(rdir, ndir, incl, nincl);
---
> 		c->md = fsysmount(rdir, ndir, incl, nincl, win->id);
diff -n /n/dump/2004/1014/sys/src/cmd/acme/fns.h /sys/src/cmd/acme/fns.h
/n/dump/2004/1014/sys/src/cmd/acme/fns.h:66 c /sys/src/cmd/acme/fns.h:66
< Mntdir*	fsysmount(Rune*, int, Rune**, int);
---
> Mntdir*	fsysmount(Rune*, int, Rune**, int, int);
diff -n /n/dump/2004/1014/sys/src/cmd/acme/fsys.c /sys/src/cmd/acme/fsys.c
/n/dump/2004/1014/sys/src/cmd/acme/fsys.c:246 c /sys/src/cmd/acme/fsys.c:246
< fsysmount(Rune *dir, int ndir, Rune **incl, int nincl)
---
> fsysmount(Rune *dir, int ndir, Rune **incl, int nincl, int winid)
/n/dump/2004/1014/sys/src/cmd/acme/fsys.c:248 c /sys/src/cmd/acme/fsys.c:248
< 	char buf[256];
---
> 	char buf[256], *wpath;
/n/dump/2004/1014/sys/src/cmd/acme/fsys.c:264 a /sys/src/cmd/acme/fsys.c:265,270
> 	wpath=smprint("/mnt/acme/%d", winid);
> 	if(bind(wpath, "/dev/acme", MBEFORE) < 0){
> 		fsysdelid(m);
> 		return nil;
> 	}
> 	free(wpath);


An example of use of this (for the tags program by nemo) is using T tag to mark
the current file:

#!/bin/rc

acmepath=`{cat /dev/acme/tag|awk '{print $1}'}
if(~ $#* 0){	
	grep -n $acmepath $home/lib/*.tags
}
if not{
	tag/Tag $acmepath $*
}


ID as a shell script:

#!/bin/rc

cat /dev/acme/ctl|awk '{print $1}'



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

end of thread, other threads:[~2004-10-15 13:54 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-10-14 13:28 [9fans] acme tags for shell scripts Gorka Guardiola
2004-10-14 14:39 ` Russ Cox
2004-10-14 14:47   ` Gorka Guardiola
2004-10-15 13:27     ` Russ Cox
2004-10-15 13:54       ` Gorka Guardiola

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