From mboxrd@z Thu Jan 1 00:00:00 1970 MIME-Version: 1.0 In-Reply-To: References: From: Micah Stetson Date: Wed, 15 Feb 2017 14:29:05 -0700 Message-ID: To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Content-Type: multipart/alternative; boundary=001a1146f9b0d0443d0548985e4e Subject: Re: [9fans] Acme and Git Topicbox-Message-UUID: b3fb5ef6-ead9-11e9-9d60-3106f5b1d025 --001a1146f9b0d0443d0548985e4e Content-Type: text/plain; charset=UTF-8 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 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 wrote: > >> May be use Russ'es Watch command? >> >> > On Feb 15, 2017, at 5:05 AM, Paul Lalonde >> 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 >> >> >> --001a1146f9b0d0443d0548985e4e Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
In plan9port, this script will re-load any clean wind= ow that differs from an existing file with the same name:

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

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

=
If you make it deal gracefully with acme not running, you could probab= ly have git call it automatically whenever you check out a different revisi= on. 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 wi= ndow, and has been tested very little.

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

Micah


On Wed, Feb 15, 2017 at 12:32 PM, Paul = Lalonde <paul.a.lalonde@gmail.com> wrote:
Do you have a pointer to Russ's= Watch?=C2=A0 I quick dig shows I have poor Google-fu.
Paul

O= n Wed, Feb 15, 2017 at 12:23 PM Bakul Shah <bakul@bitblocks.com> wrote:
May be use Russ'es Watch command?

> On Feb 15, 2017, at 5:05 AM, Paul Lalonde <paul.a.lalonde@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?=C2=A0 I frequently change branches and I often find myse= lf editing stale versions.=C2=A0 I notice when comes time to Put, but that&= #39;s a bit late.
>
> Any tips to share?
>
> Paul



--001a1146f9b0d0443d0548985e4e--