Small tweaks
Lots of new code imported.
diff --git a/src/cmd/acme/acme.c b/src/cmd/acme/acme.c
index fbfb9f1..d4b4cad 100644
--- a/src/cmd/acme/acme.c
+++ b/src/cmd/acme/acme.c
@@ -27,8 +27,6 @@
 Reffont	*reffonts[2];
 int		snarffd = -1;
 int		mainpid;
-int		plumbsendfd;
-int		plumbeditfd;
 
 enum{
 	NSnarf = 1000	/* less than 1024, I/O buffer size */
@@ -180,6 +178,8 @@
 		exits("keyboard");
 	}
 	mainpid = getpid();
+	startplumbing();
+/*
 	plumbeditfd = plumbopen("edit", OREAD|OCEXEC);
 	if(plumbeditfd < 0)
 		fprint(2, "acme: can't initialize plumber: %r\n");
@@ -188,6 +188,7 @@
 		threadcreate(plumbproc, nil, STACK);
 	}
 	plumbsendfd = plumbopen("send", OWRITE|OCEXEC);
+*/
 
 	fsysinit();
 
@@ -355,6 +356,7 @@
 	threadcreate(acmeerrorproc, nil, STACK);
 }
 
+/*
 void
 plumbproc(void *v)
 {
@@ -369,6 +371,7 @@
 		sendp(cplumb, m);
 	}
 }
+*/
 
 void
 keyboardthread(void *v)
@@ -674,7 +677,7 @@
 					textsetselect(t, 0, 0);
 				}
 				if(w->msg[0])
-					warning(c->md, "%s: %s\n", c->name, w->msg);
+					warning(c->md, "%S: %s\n", c->name, w->msg);
 				flushimage(display, 1);
 			}
 			qunlock(&row.lk);
diff --git a/src/cmd/acme/dat.h b/src/cmd/acme/dat.h
index 9101ca3..94cfa38 100644
--- a/src/cmd/acme/dat.h
+++ b/src/cmd/acme/dat.h
@@ -524,8 +524,6 @@
 char			*fontnames[2];
 Image		*tagcols[NCOL];
 Image		*textcols[NCOL];
-int			plumbsendfd;
-int			plumbeditfd;
 extern char		wdir[]; /* must use extern because no dimension given */
 int			editing;
 int			erroutfd;
diff --git a/src/cmd/acme/elog.c b/src/cmd/acme/elog.c
index e86af6e..d7c9a9b 100644
--- a/src/cmd/acme/elog.c
+++ b/src/cmd/acme/elog.c
@@ -170,7 +170,7 @@
 		elogflush(f);
 	}
 	/* try to merge with previous */
-	if(f->elog.type==Insert && q0==f->elog.q0 && (q0+nr)-f->elog.q0<Maxstring){
+	if(f->elog.type==Insert && q0==f->elog.q0 && f->elog.nr+nr<Maxstring){
 		runemove(f->elog.r+f->elog.nr, r, nr);
 		f->elog.nr += nr;
 		return;
diff --git a/src/cmd/acme/exec.c b/src/cmd/acme/exec.c
index d81153e..74f9f47 100644
--- a/src/cmd/acme/exec.c
+++ b/src/cmd/acme/exec.c
@@ -1472,6 +1472,7 @@
 		}
 	}
 	threadexecl(cpid, sfd, "rc", "rc", "-c", t, nil);
+	warning(nil, "exec rc: %r\n");
 
    Fail:
 	/* threadexec hasn't happened, so send a zero */
diff --git a/src/cmd/acme/fns.h b/src/cmd/acme/fns.h
index a73a7ec..9fba7d7 100644
--- a/src/cmd/acme/fns.h
+++ b/src/cmd/acme/fns.h
@@ -87,6 +87,7 @@
 Rune*	findbl(Rune*, int, int*);
 char*	edittext(Window*, int, Rune*, int);
 void		flushwarnings(int);
+void		startplumbing(void);
 
 #define	runemalloc(a)		(Rune*)emalloc((a)*sizeof(Rune))
 #define	runerealloc(a, b)	(Rune*)erealloc((a), (b)*sizeof(Rune))
diff --git a/src/cmd/acme/look.c b/src/cmd/acme/look.c
index 6b25928..f6c4d4e 100644
--- a/src/cmd/acme/look.c
+++ b/src/cmd/acme/look.c
@@ -8,15 +8,50 @@
 #include <frame.h>
 #include <fcall.h>
 #include <regexp.h>
+#define Fid FsFid
+#include <fs.h>
 #include <plumb.h>
+#undef Fid
 #include "dat.h"
 #include "fns.h"
 
+FsFid *plumbsendfid;
+FsFid *plumbeditfid;
+
 Window*	openfile(Text*, Expand*);
 
 int	nuntitled;
 
 void
+plumbproc(void *v)
+{
+	Plumbmsg *m;
+
+	USED(v);
+	threadsetname("plumbproc");
+	for(;;){
+		m = plumbrecvfid(plumbeditfid);
+		if(m == nil)
+			threadexits(nil);
+		sendp(cplumb, m);
+	}
+}
+
+void
+startplumbing(void)
+{
+	plumbeditfid = plumbopenfid("edit", OREAD|OCEXEC);
+	if(plumbeditfid == nil)
+		fprint(2, "acme: can't initialize plumber: %r\n");
+	else{
+		cplumb = chancreate(sizeof(Plumbmsg*), 0);
+		threadcreate(plumbproc, nil, STACK);
+	}
+	plumbsendfid = plumbopenfid("send", OWRITE|OCEXEC);
+}
+
+
+void
 look3(Text *t, uint q0, uint q1, int external)
 {
 	int n, c, f, expanded;
@@ -79,7 +114,7 @@
 		free(r);
 		goto Return;
 	}
-	if(plumbsendfd >= 0){
+	if(plumbsendfid != nil){
 		/* send whitespace-delimited word to plumber */
 		m = emalloc(sizeof(Plumbmsg));
 		m->src = estrdup("acme");
@@ -121,7 +156,7 @@
 		m->data = runetobyte(r, q1-q0);
 		m->ndata = strlen(m->data);
 		free(r);
-		if(m->ndata<messagesize-1024 && plumbsend(plumbsendfd, m) >= 0){
+		if(m->ndata<messagesize-1024 && plumbsendtofid(plumbsendfid, m) >= 0){
 			plumbfree(m);
 			goto Return;
 		}