acme: add log file in acme root directory

Reading /mnt/acme/log reports a log of window create,
put, and delete events, as they happen. It blocks until the
next event is available.

Example log output:

8 new /Users/rsc/foo.go
8 put /Users/rsc/foo.go
8 del /Users/rsc/foo.go

This lets acme-aware programs react to file writes, for example
compiling code, running a test, or updating an import block.

TBR=r
R=r
https://codereview.appspot.com/89560044
This commit is contained in:
Russ Cox 2014-04-30 12:14:29 -04:00
parent 833216fef8
commit 4a3fb87264
12 changed files with 262 additions and 8 deletions

View file

@ -298,6 +298,7 @@ plumbshow(Plumbmsg *m)
winsettag(w);
textscrdraw(&w->body);
textsetselect(&w->tag, w->tag.file->b.nc, w->tag.file->b.nc);
xfidlog(w, "new");
}
int
@ -770,6 +771,7 @@ openfile(Text *t, Expand *e)
w->autoindent = ow->autoindent;
}else
w->autoindent = globalautoindent;
xfidlog(w, "new");
}
if(e->a1 == e->a0)
eval = FALSE;
@ -803,6 +805,7 @@ new(Text *et, Text *t, Text *argt, int flag1, int flag2, Rune *arg, int narg)
int na, nf;
Expand e;
Runestr rs;
Window *w;
getarg(argt, FALSE, TRUE, &a, &na);
if(a){
@ -814,8 +817,11 @@ new(Text *et, Text *t, Text *argt, int flag1, int flag2, Rune *arg, int narg)
for(ndone=0; ; ndone++){
a = findbl(arg, narg, &na);
if(a == arg){
if(ndone==0 && et->col!=nil)
winsettag(coladd(et->col, nil, nil, -1));
if(ndone==0 && et->col!=nil) {
w = coladd(et->col, nil, nil, -1);
winsettag(w);
xfidlog(w, "new");
}
break;
}
nf = narg-na;