* [9fans] winclear in p9p
@ 2006-10-31 17:22 Matthias Teege
2006-10-31 18:06 ` Paul Lalonde
2006-11-09 20:17 ` Russ Cox
0 siblings, 2 replies; 7+ messages in thread
From: Matthias Teege @ 2006-10-31 17:22 UTC (permalink / raw)
To: 9fans
Moin,
I've found
fn winclear {
echo -n Edit ,d > /dev/acme/body
echo -n /Edit ,d/ > /dev/acme/addr
echo -n 'dot=addr' > /dev/acme/ctl
cat /dev/acme/addr | awk '{printf("MX%s %s\n", $1, $2)}' > /dev/acme/event
}
in the wiki but how do I clear a win in Plan 9 ports? To be accurate I
need to replace some text in the middle of the body and it would be
nice, if I can avoid a tempfile.
Many thanks
Matthias
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [9fans] winclear in p9p
2006-10-31 17:22 [9fans] winclear in p9p Matthias Teege
@ 2006-10-31 18:06 ` Paul Lalonde
2006-10-31 18:56 ` Russ Cox
2006-11-09 20:17 ` Russ Cox
1 sibling, 1 reply; 7+ messages in thread
From: Paul Lalonde @ 2006-10-31 18:06 UTC (permalink / raw)
To: Fans of the OS Plan 9 from Bell Labs
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Looking at this briefly, I discovered that the p9p version of acme
doesn't make available body/addr/ctl/event of the current selected
window. So the straightforward "substitute 9p commands" fails.
What is the correct way for a script to discover the ID of the acme
window it was run from? I could trap the command in the plumber and
add the id as a parameter, but that's rather intrusive.
Paul
On 31-Oct-06, at 9:22 AM, Matthias Teege wrote:
> Moin,
>
> I've found
>
> fn winclear {
> echo -n Edit ,d > /dev/acme/body
> echo -n /Edit ,d/ > /dev/acme/addr
> echo -n 'dot=addr' > /dev/acme/ctl
> cat /dev/acme/addr | awk '{printf("MX%s %s\n", $1, $2)}' > /dev/
> acme/event
> }
>
> in the wiki but how do I clear a win in Plan 9 ports? To be accurate I
> need to replace some text in the middle of the body and it would be
> nice, if I can avoid a tempfile.
>
> Many thanks
> Matthias
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (Darwin)
iD8DBQFFR5CLpJeHo/Fbu1wRAqS+AKCvwJhWvDn5Z+Yenu8NHEqv1h0WNQCeOzyC
1nvalZ6Jy7nFD3jnzAsz/BY=
=w0ot
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [9fans] winclear in p9p
2006-10-31 18:06 ` Paul Lalonde
@ 2006-10-31 18:56 ` Russ Cox
0 siblings, 0 replies; 7+ messages in thread
From: Russ Cox @ 2006-10-31 18:56 UTC (permalink / raw)
To: Fans of the OS Plan 9 from Bell Labs
9p read acme/$winid/tag
(Same as cat /mnt/acme/$winid/tag in Plan 9.)
Russ
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [9fans] winclear in p9p
2006-10-31 17:22 [9fans] winclear in p9p Matthias Teege
2006-10-31 18:06 ` Paul Lalonde
@ 2006-11-09 20:17 ` Russ Cox
2006-11-10 13:54 ` David Leimbach
2006-11-10 14:17 ` David Leimbach
1 sibling, 2 replies; 7+ messages in thread
From: Russ Cox @ 2006-11-09 20:17 UTC (permalink / raw)
To: Fans of the OS Plan 9 from Bell Labs
> fn winclear {
> echo -n Edit ,d > /dev/acme/body
> echo -n /Edit ,d/ > /dev/acme/addr
> echo -n 'dot=addr' > /dev/acme/ctl
> cat /dev/acme/addr | awk '{printf("MX%s %s\n", $1, $2)}' > /dev/acme/event
> }
I finally read this part of the message.
This is a remarkably complicated way to go about deleting the window text!
Here is a simpler one:
echo -n , >/mnt/acme/$winid/addr
echo -n >/mnt/acme/$winid/data
(Or on Unix:
echo -n , | 9p write acme/$winid/addr
9p write acme/$winid/data </dev/null
)
Russ
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Re: [9fans] winclear in p9p
2006-11-09 20:17 ` Russ Cox
@ 2006-11-10 13:54 ` David Leimbach
2006-11-10 14:17 ` David Leimbach
1 sibling, 0 replies; 7+ messages in thread
From: David Leimbach @ 2006-11-10 13:54 UTC (permalink / raw)
To: Fans of the OS Plan 9 from Bell Labs
On 11/9/06, Russ Cox <rsc@swtch.com> wrote:
> > fn winclear {
> > echo -n Edit ,d > /dev/acme/body
> > echo -n /Edit ,d/ > /dev/acme/addr
> > echo -n 'dot=addr' > /dev/acme/ctl
> > cat /dev/acme/addr | awk '{printf("MX%s %s\n", $1, $2)}' > /dev/acme/event
> > }
>
> I finally read this part of the message.
> This is a remarkably complicated way to go about deleting the window text!
Yep and I posted it literally months ago as I was just exploring the
Acme filesystem.
>
> Here is a simpler one:
>
> echo -n , >/mnt/acme/$winid/addr
> echo -n >/mnt/acme/$winid/data
>
> (Or on Unix:
> echo -n , | 9p write acme/$winid/addr
> 9p write acme/$winid/data </dev/null
> )
>
> Russ
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Re: [9fans] winclear in p9p
2006-11-09 20:17 ` Russ Cox
2006-11-10 13:54 ` David Leimbach
@ 2006-11-10 14:17 ` David Leimbach
2006-11-11 0:35 ` Arvindh Rajesh Tamilmani
1 sibling, 1 reply; 7+ messages in thread
From: David Leimbach @ 2006-11-10 14:17 UTC (permalink / raw)
To: Fans of the OS Plan 9 from Bell Labs
On 11/9/06, Russ Cox <rsc@swtch.com> wrote:
> > fn winclear {
> > echo -n Edit ,d > /dev/acme/body
> > echo -n /Edit ,d/ > /dev/acme/addr
> > echo -n 'dot=addr' > /dev/acme/ctl
> > cat /dev/acme/addr | awk '{printf("MX%s %s\n", $1, $2)}' > /dev/acme/event
> > }
>
> I finally read this part of the message.
> This is a remarkably complicated way to go about deleting the window text!
>
> Here is a simpler one:
>
> echo -n , >/mnt/acme/$winid/addr
> echo -n >/mnt/acme/$winid/data
>
Maybe it's how I keyed it in, or that I've got the worst cold I've had
in about 6 or 7 years, but I'm getting invalid address with this
version. It looks cleaner but for some reason it's just not liking
me.
> (Or on Unix:
> echo -n , | 9p write acme/$winid/addr
> 9p write acme/$winid/data </dev/null
> )
>
> Russ
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Re: [9fans] winclear in p9p
2006-11-10 14:17 ` David Leimbach
@ 2006-11-11 0:35 ` Arvindh Rajesh Tamilmani
0 siblings, 0 replies; 7+ messages in thread
From: Arvindh Rajesh Tamilmani @ 2006-11-11 0:35 UTC (permalink / raw)
To: Fans of the OS Plan 9 from Bell Labs
> > Here is a simpler one:
> >
> > echo -n , >/mnt/acme/$winid/addr
> > echo -n >/mnt/acme/$winid/data
> >
>
> Maybe it's how I keyed it in, or that I've got the worst cold I've had
> in about 6 or 7 years, but I'm getting invalid address with this
> version. It looks cleaner but for some reason it's just not liking
> me.
Were you trying it on win(1)?
I think the original winclear was built for that.
The two-liner clears win, but then win stops responding to commands.
The following patch to win/main.c seems to make the two-liner work.
Arvindh
/acme/bin/source/win/main.c:237,243 - main.c:237,242
sprint(buf, "#%lud,#%lud", q0, q0+n);
winsetaddr(w, buf, 0);
write(w->data, buf, 0);
- *q1 -= n;
return 0;
}
/acme/bin/source/win/main.c:457,463 - main.c:456,466
case 'F': /* generated by our actions (specifically case 'S' above) */
delta = e->q1-e->q0;
if(e->c2=='D'){
- /* we know about the delete by _sendinput */
+ endpt -= delta;
+ if(e->q1 < hostpt)
+ hostpt -= delta;
+ else if(e->q0 < hostpt)
+ hostpt = e->q0;
break;
}
if(e->c2=='I'){
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2006-11-11 0:35 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-10-31 17:22 [9fans] winclear in p9p Matthias Teege
2006-10-31 18:06 ` Paul Lalonde
2006-10-31 18:56 ` Russ Cox
2006-11-09 20:17 ` Russ Cox
2006-11-10 13:54 ` David Leimbach
2006-11-10 14:17 ` David Leimbach
2006-11-11 0:35 ` Arvindh Rajesh Tamilmani
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).