In plan9port, this script will re-load any clean window that differs from
an existing file with the same name:

```
#!/usr/local/plan9/bin/rc

cleanIDs = `{9p read acme/index | awk '$4 == 0 && $5 == 0 { print $1 }'}
for (id in $cleanIDs) {
nm = `{9p read acme/$id/tag | sed 's/ .*//'}
if (test -f $nm && ! cmp -s $nm <{9p read acme/$id/body}) {
echo get | 9p write acme/$id/ctl
}
}
```

If you make it deal gracefully with acme not running, you could probably
have git call it automatically whenever you check out a different revision.
Caveats: this does nothing for directory windows, doesn't help with files
that exist in one branch and not another, won't touch a dirty window, and
has been tested very little.

By the way, Russ's Watch is here:
https://github.com/rsc/rsc/tree/master/cmd/Watch

Micah


On Wed, Feb 15, 2017 at 12:32 PM, Paul Lalonde <paul.a.lalo...@gmail.com>
wrote:

> Do you have a pointer to Russ's Watch?  I quick dig shows I have poor
> Google-fu.
> Paul
>
> On Wed, Feb 15, 2017 at 12:23 PM Bakul Shah <ba...@bitblocks.com> wrote:
>
>> May be use Russ'es Watch command?
>>
>> > On Feb 15, 2017, at 5:05 AM, Paul Lalonde <paul.a.lalo...@gmail.com>
>> wrote:
>> >
>> > I know I'm not the only acme user who uses Git extensively :-)
>> > Is there some way to tell if a file is changed on disk that is open in
>> an editor window?  I frequently change branches and I often find myself
>> editing stale versions.  I notice when comes time to Put, but that's a bit
>> late.
>> >
>> > Any tips to share?
>> >
>> > Paul
>>
>>
>>

Reply via email to