9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] find acme 'window' name from which program B2-ed?
@ 2005-10-11 20:12 Axel Belinfante
  2005-10-11 21:19 ` Russ Cox
  0 siblings, 1 reply; 6+ messages in thread
From: Axel Belinfante @ 2005-10-11 20:12 UTC (permalink / raw)
  To: 9fans

I'm trying (hoping) to use acme to give a presention,
have others done so? experiences worth sharing?

my plan: all 'slides' are just files in a single directory,
and where I could B2 on the word nextpage in each of them,
and nextpage would be a simple script that looks at
the name of the current file, from that decides which
is the next one, loads it in a new window, and simulates
B3 in the box to make it full-column.

can I get at the name of the file from/in which I B2 nextpage?
(otherwise I could just put a number next to it, and B2 'nextpage nr')

can I easily simulate B3 in box? (I can look this one up in the man)

Axel.


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

* Re: [9fans] find acme 'window' name from which program B2-ed?
  2005-10-11 20:12 [9fans] find acme 'window' name from which program B2-ed? Axel Belinfante
@ 2005-10-11 21:19 ` Russ Cox
  2005-10-12 22:48   ` Axel Belinfante
  0 siblings, 1 reply; 6+ messages in thread
From: Russ Cox @ 2005-10-11 21:19 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

> can I easily simulate B3 in box? (I can look this one up in the man)

Not without changing the source code.

One alternative is to make your "Next" program
replace the current window contents instead of
creating a new one.

Russ


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

* Re: [9fans] find acme 'window' name from which program B2-ed?
  2005-10-11 21:19 ` Russ Cox
@ 2005-10-12 22:48   ` Axel Belinfante
  2005-11-28 20:49     ` Russ Cox
  0 siblings, 1 reply; 6+ messages in thread
From: Axel Belinfante @ 2005-10-12 22:48 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

> > can I easily simulate B3 in box? (I can look this one up in the man)
> 
> Not without changing the source code.
> 
> One alternative is to make your "Next" program
> replace the current window contents instead of
> creating a new one.

This is what I realized (I think I posted a version of a script in a
followup posting. since then I learned and the script changed :-)

I have been wondering if it might be useful to have a 'clean'
version of a replacement script ('repl'?) in /acme/bin next
to 'new' -- if only as example for those looking for them --
my "Next" then only has to come up with the right
file name which it then passes to ``repl''.

Today I used it, and with lucidasans.13 it was pretty ok.
Only thing was that I mounted the text files via u9fs from
a sun that mounts via nfs from the central file server,
so updating the window was less quick that when all would
have been local.
I had intended to also embed commands to raise (vnc) windows
containing demo stuff but did not have time for that.

(actually, we were discussing tool integration, but the nice
 integration on the presentation system was likely missed by
 the audience... one of the more interesting parts of the
 discussion was on how to connect tools or tool components
 that have to interact with each other - typical case in our
 world would be a tool component capable of (on demand)
 unfolding (exploring) a state space, and a tool compoent
 actually traversing the state space - I would be tempted
 to make those into two separate programs and connect them
 on the shell level (which may be a bit too loosely
 coupled for the real world, think tools like spin?).
 other suggestions were to have some kind of common
 (library, oo?) infrastructure on which (in which)
 all is built - and thus have (possibility) of much tighter
 connection - nevertheless, the idea of being forced to
 use a particular library/language infrastructure does
 not sound too attractive,  and it will not work with
 external tools outside our control. oh well, we ran out
 of time before we ran out of discussion, we'll see...)

Axel.


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

* Re: [9fans] find acme 'window' name from which program B2-ed?
  2005-10-12 22:48   ` Axel Belinfante
@ 2005-11-28 20:49     ` Russ Cox
  0 siblings, 0 replies; 6+ messages in thread
From: Russ Cox @ 2005-11-28 20:49 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

I used this today for a talk about shell scripts and scripting
in general.  It provided a nice illustration midway through the
talk.  These are the final versions I used (on Unix).
Three scripts: Slide, Slide-, and Slide+.

lucidasans/unicode.13.font was good, though I might have
preferred something ever so slightly larger.

Thanks!
Russ

# To unbundle, run this file
echo Slide
sed 's/.//' >Slide <<'//GO.SYSIN DD Slide'
-#!/usr/local/plan9/bin/rc
-
-echo name `{pwd}^/$1 | 9p write acme/$winid/ctl
-echo clean | 9p write acme/$winid/ctl
-echo get | 9p write acme/$winid/ctl
-
//GO.SYSIN DD Slide
echo Slide+
sed 's/.//' >Slide+ <<'//GO.SYSIN DD Slide+'
-#!/usr/local/plan9/bin/rc
-
-name=$%
-current=`{basename $name}
-currentx=`{9 grep -n '^'$current'([ 	]|$)' index | sed 's/:.*//'}
-
-pagex=`{echo $currentx + 1 | hoc}
-page=`{sed -n $pagex^p index | awk '{print $1}'}
-if(~ $#page 0){
-	echo no such page
-	exit 0
-}
-
-Slide $page
//GO.SYSIN DD Slide+
echo Slide-
sed 's/.//' >Slide- <<'//GO.SYSIN DD Slide-'
-#!/usr/local/plan9/bin/rc
-
-name=$%
-current=`{basename $name}
-currentx=`{9 grep -n '^'$current'([ 	]|$)' index | sed 's/:.*//'}
-
-pagex=`{echo $currentx - 1 | hoc}
-if(~ $pagex 0){
-	echo no such page
-	exit 0
-}
-page=`{sed -n $pagex^p index | awk '{print $1}'}
-if(~ $#page 0){
-	echo no such page
-	exit 0
-}
-
-Slide $page
//GO.SYSIN DD Slide-


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

* Re: [9fans] find acme 'window' name from which program B2-ed?
  2005-10-11 20:47 Federico G. Benavento
@ 2005-10-11 22:12 ` Axel Belinfante
  0 siblings, 0 replies; 6+ messages in thread
From: Axel Belinfante @ 2005-10-11 22:12 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

I asked:

> >can I get at the name of the file from/in which I B2 nextpage?
> 
> cat /mnt/acme/$winid/tag| awk '{print $1}'

thanks for the quick reply!
found later in acme(1) that it is even easier: echo $%

> >can I easily simulate B3 in box? (I can look this one up in the man)

> this one I don't know

seems not.
it turned out to be easier (and just as good, so far)
to just load the new page in the current window
(i.e. replace name in tag, and replace data in body)

I append my current 'nextpage' (in case someone is interested);
'prevpage' is the same apart for a s/+ 1/- 1/.
they assume a file named menu that contains the page names
in 'show' order.

what's missing is a test that t > 0, to avoid trying sed 0p .

the -n seems necessary when writing to addr
(without, I get: echo: write error: bad address syntax)


Some years ago I tried something similar
(managing a coffee/beer list) and I recall
that then I had to keep a ctl file open to
make sure that my echo to addr wasn't forgotten
by the time I would write to data; this seems to
be easier now (unless I misremember and the 'problem'
was not in writing data but in reading from it).


Axel.


#!/bin/rc

m=menu

id=$winid
f=$%
b=`{basename $f}
i=`{grep  -n -h '^'^$b^'$' $m | sed 's/:.*//'}

t=`{echo $i + 1 | bc}
page=`{sed -n $t^p < $m}

if(~ $#page 0)
	echo no such page
if not {
	echo -n ',' > /mnt/acme/$id/addr
	echo 'dot=addr' > /mnt/acme/$id/ctl
	echo 'name '^`{pwd}^/^$page > /mnt/acme/$id/ctl
	cat $page > /mnt/acme/$id/data
	echo clean > /mnt/acme/$id/ctl
}

# that's all folks


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

* Re: [9fans] find acme 'window' name from which program B2-ed?
@ 2005-10-11 20:47 Federico G. Benavento
  2005-10-11 22:12 ` Axel Belinfante
  0 siblings, 1 reply; 6+ messages in thread
From: Federico G. Benavento @ 2005-10-11 20:47 UTC (permalink / raw)
  To: 9fans

>can I get at the name of the file from/in which I B2 nextpage?

cat /mnt/acme/$winid/tag| awk '{print $1}'

>can I easily simulate B3 in box? (I can look this one up in the man)

this one I don't know

---
Federico G. Benavento



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

end of thread, other threads:[~2005-11-28 20:49 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-10-11 20:12 [9fans] find acme 'window' name from which program B2-ed? Axel Belinfante
2005-10-11 21:19 ` Russ Cox
2005-10-12 22:48   ` Axel Belinfante
2005-11-28 20:49     ` Russ Cox
2005-10-11 20:47 Federico G. Benavento
2005-10-11 22:12 ` Axel Belinfante

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