Little tweaks and documentation.
diff --git a/src/cmd/9term/9term.c b/src/cmd/9term/9term.c
index cfee001..41a0a2f 100644
--- a/src/cmd/9term/9term.c
+++ b/src/cmd/9term/9term.c
@@ -147,7 +147,7 @@
 	i = 0;
 	for(;;){
 		i = 1-i;	/* toggle */
-		n = read(rcfd[0], rcbuf[i].data, sizeof rcbuf[i].data);
+		n = threadread(rcfd[0], rcbuf[i].data, sizeof rcbuf[i].data);
 		if(n <= 0){
 			if(n < 0)
 				fprint(2, "9term: host read error: %r\n");
@@ -163,7 +163,7 @@
 hoststart(void)
 {
 	hostc = chancreate(sizeof(int), 0);
-	proccreate(hostproc, hostc, 32*1024);
+	threadcreate(hostproc, hostc, 32*1024);
 }
 
 void
diff --git a/src/cmd/acme/look.c b/src/cmd/acme/look.c
index ca7eba4..6b25928 100644
--- a/src/cmd/acme/look.c
+++ b/src/cmd/acme/look.c
@@ -196,6 +196,7 @@
 	openfile(nil, &e);
 	free(e.name);
 	free(e.u.at);
+	drawtopwindow();
 }
 
 void
@@ -234,6 +235,7 @@
 	winsettag(w);
 	textscrdraw(&w->body);
 	textsetselect(&w->tag, w->tag.file->b.nc, w->tag.file->b.nc);
+	drawtopwindow();
 }
 
 int
diff --git a/src/cmd/samterm/mesg.c b/src/cmd/samterm/mesg.c
index 0bffad3..2052843 100644
--- a/src/cmd/samterm/mesg.c
+++ b/src/cmd/samterm/mesg.c
@@ -25,7 +25,7 @@
 void	hsetdot(int, long, long);
 void	hmoveto(int, long);
 void	hsetsnarf(int);
-/* void	hplumb(int); */
+void	hplumb(int);
 void	clrlock(void);
 int	snarfswap(char*, int, char**);
 
@@ -296,11 +296,9 @@
 		threadexitsall(nil);
 		break;
 
-/*
 	case Hplumb:
 		hplumb(m);
 		break;
-*/
 	}
 }
 
@@ -668,7 +666,6 @@
 	setcursor(mousectl, cursor);
 }
 
-/*
 void
 hplumb(int nc)
 {
@@ -687,7 +684,6 @@
 	}
 	free(s);
 }
-*/
 
 void
 hgrow(int m, long a, long new, int req)
diff --git a/src/cmd/samterm/mkfile b/src/cmd/samterm/mkfile
index 67997f3..facc78d 100644
--- a/src/cmd/samterm/mkfile
+++ b/src/cmd/samterm/mkfile
@@ -23,6 +23,6 @@
 
 CFLAGS=$CFLAGS -I../sam
 LDFLAGS=$LDFLAGS -L$X11/lib -lX11 -lm
-SHORTLIB=frame draw thread regexp9 bio 9
+SHORTLIB=frame draw plumb fs mux thread regexp9 bio 9
 
 <$PLAN9/src/mkone
diff --git a/src/cmd/samterm/plan9.c b/src/cmd/samterm/plan9.c
index 60ef5c0..7c4ed39 100644
--- a/src/cmd/samterm/plan9.c
+++ b/src/cmd/samterm/plan9.c
@@ -10,6 +10,7 @@
 #include <cursor.h>
 #include <keyboard.h>
 #include <frame.h>
+#include <plumb.h>
 #include "flayer.h"
 #include "samterm.h"
 
@@ -170,20 +171,15 @@
 	atexit(removeextern);
 }
 
-#if 0
 int
-plumbformat(int i)
+plumbformat(Plumbmsg *m, int i)
 {
-	Plumbmsg *m;
 	char *addr, *data, *act;
 	int n;
 
 	data = (char*)plumbbuf[i].data;
-	m = plumbunpack(data, plumbbuf[i].n);
-	if(m == nil)
-		return 0;
 	n = m->ndata;
-	if(n == 0){
+	if(n == 0 || 2+n+2 >= READBUFSIZE){
 		plumbfree(m);
 		return 0;
 	}
@@ -219,8 +215,9 @@
 plumbproc(void *argv)
 {
 	Channel *c;
-	int i, n, which, *fdp;
+	int i, *fdp;
 	void **arg;
+	Plumbmsg *m;
 
 	arg = argv;
 	c = arg[0];
@@ -229,16 +226,14 @@
 	i = 0;
 	threadfdnoblock(*fdp);
 	for(;;){
-		i = 1-i;	/* toggle */
-		n = threadread(*fdp, plumbbuf[i].data, READBUFSIZE);
-		if(n <= 0){
+		m = threadplumbrecv(*fdp);
+		if(m == nil){
 			fprint(2, "samterm: plumb read error: %r\n");
 			threadexits("plumb");	/* not a fatal error */
 		}
-		plumbbuf[i].n = n;
-		if(plumbformat(i)){
-			which = i;
-			send(c, &which);
+		if(plumbformat(m, i)){
+			send(c, &i);
+			i = 1-i;	/* toggle */
 		}
 	}
 }
@@ -258,18 +253,11 @@
 		close(fd);
 		return -1;
 	}
-	arg[0] =plumbc;
+	arg[0] = plumbc;
 	arg[1] = &fd;
 	threadcreate(plumbproc, arg, STACK);
 	return 1;
 }
-#endif
-
-int
-plumbstart(void)
-{
-	return -1;
-}
 
 void
 hostproc(void *arg)
diff --git a/src/libdraw/x11-init.c b/src/libdraw/x11-init.c
index fb6a914..1283f43 100644
--- a/src/libdraw/x11-init.c
+++ b/src/libdraw/x11-init.c
@@ -124,6 +124,8 @@
 {
 	char buf[200];
 
+	if(e->request_code == 42) /* XSetInputFocus */
+		return 0;
 	print("X error: error_code=%d, request_code=%d, minor=%d disp=%p\n",
 		e->error_code, e->request_code, e->minor_code, d);
 	XGetErrorText(d, e->error_code, buf, sizeof buf);
diff --git a/src/libdraw/x11-wsys.c b/src/libdraw/x11-wsys.c
index ac4aa40..e27202f 100644
--- a/src/libdraw/x11-wsys.c
+++ b/src/libdraw/x11-wsys.c
@@ -8,7 +8,10 @@
 void
 drawtopwindow(void)
 {
-	XRaiseWindow(_x.display, _x.drawable);
+	XMapRaised(_x.display, _x.drawable);
+	XFlush(_x.display);
+	XSetInputFocus(_x.display, _x.drawable, RevertToPointerRoot,
+		CurrentTime);
 	XFlush(_x.display);
 }