* [9fans] Acme and Git @ 2017-02-15 13:05 Paul Lalonde 2017-02-15 14:34 ` Steve Simon ` (2 more replies) 0 siblings, 3 replies; 10+ messages in thread From: Paul Lalonde @ 2017-02-15 13:05 UTC (permalink / raw) To: Fans of the OS Plan 9 from Bell Labs [-- Attachment #1: Type: text/plain, Size: 322 bytes --] 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 [-- Attachment #2: Type: text/html, Size: 405 bytes --] ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [9fans] Acme and Git 2017-02-15 13:05 [9fans] Acme and Git Paul Lalonde @ 2017-02-15 14:34 ` Steve Simon 2017-02-15 14:41 ` Sigrid Haflinadóttir 2017-02-15 17:21 ` Bakul Shah 2017-02-16 2:01 ` Erik Quanstrom 2 siblings, 1 reply; 10+ messages in thread From: Steve Simon @ 2017-02-15 14:34 UTC (permalink / raw) To: 9fans Hi, I am a sam user who uses subversion (via a substandard OS). when I do an update I always do 'X/./e' to re-read all files - bit of a sledgehammer but at least it stops me getting quite so angry at svn. -Steve ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [9fans] Acme and Git 2017-02-15 14:34 ` Steve Simon @ 2017-02-15 14:41 ` Sigrid Haflinadóttir 0 siblings, 0 replies; 10+ messages in thread From: Sigrid Haflinadóttir @ 2017-02-15 14:41 UTC (permalink / raw) To: Fans of the OS Plan 9 from Bell Labs [-- Attachment #1: Type: text/plain, Size: 357 bytes --] "X e" works just as well for me. On Wed, Feb 15, 2017 at 3:34 PM, Steve Simon <steve@quintile.net> wrote: > Hi, > > I am a sam user who uses subversion (via a substandard OS). > > when I do an update I always do 'X/./e' to re-read all files - bit of a > sledgehammer > but at least it stops me getting quite so angry at svn. > > -Steve > > [-- Attachment #2: Type: text/html, Size: 737 bytes --] ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [9fans] Acme and Git 2017-02-15 13:05 [9fans] Acme and Git Paul Lalonde 2017-02-15 14:34 ` Steve Simon @ 2017-02-15 17:21 ` Bakul Shah 2017-02-15 19:32 ` Paul Lalonde 2017-02-16 2:01 ` Erik Quanstrom 2 siblings, 1 reply; 10+ messages in thread From: Bakul Shah @ 2017-02-15 17:21 UTC (permalink / raw) To: Fans of the OS Plan 9 from Bell Labs 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? 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 ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [9fans] Acme and Git 2017-02-15 17:21 ` Bakul Shah @ 2017-02-15 19:32 ` Paul Lalonde 2017-02-15 21:29 ` Micah Stetson 2017-02-15 22:09 ` Bakul Shah 0 siblings, 2 replies; 10+ messages in thread From: Paul Lalonde @ 2017-02-15 19:32 UTC (permalink / raw) To: Fans of the OS Plan 9 from Bell Labs [-- Attachment #1: Type: text/plain, Size: 655 bytes --] 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 <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? 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 > > > [-- Attachment #2: Type: text/html, Size: 1257 bytes --] ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [9fans] Acme and Git 2017-02-15 19:32 ` Paul Lalonde @ 2017-02-15 21:29 ` Micah Stetson 2017-02-15 22:09 ` Bakul Shah 1 sibling, 0 replies; 10+ messages in thread From: Micah Stetson @ 2017-02-15 21:29 UTC (permalink / raw) To: Fans of the OS Plan 9 from Bell Labs [-- Attachment #1: Type: text/plain, Size: 1600 bytes --] 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.lalonde@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 <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? 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 >> >> >> [-- Attachment #2: Type: text/html, Size: 3467 bytes --] ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [9fans] Acme and Git 2017-02-15 19:32 ` Paul Lalonde 2017-02-15 21:29 ` Micah Stetson @ 2017-02-15 22:09 ` Bakul Shah 1 sibling, 0 replies; 10+ messages in thread From: Bakul Shah @ 2017-02-15 22:09 UTC (permalink / raw) To: Fans of the OS Plan 9 from Bell Labs [-- Attachment #1: Type: text/plain, Size: 1656 bytes --] go get 9fans.net/go/acme/Watch <http://9fans.net/go/acme/Watch> It watches the current dir and runs a given command if any file in this dir changes. Actually think of Watch more as inspiration! You may be better off relying on git — watch .git/HEAD (changes when you switch branches) and watch what it is pointing to (changes when there is a commit or pull etc.), figure out what changed, which acme windows are relevant and update their body. There is still the issue of what to do if a file that changed has been edited. Or the file has been deleted or renamed. And there is a potential race — you may be editing a window when window body gets switched underneath! It may be better to print commands to do all this and leave it upto the user. May be add a reload command that reads a window's tag and reload its body from the opened file. > On Feb 15, 2017, at 11:32 AM, Paul Lalonde <paul.a.lalonde@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 <bakul@bitblocks.com <mailto: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 <mailto: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? 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 > > [-- Attachment #2: Type: text/html, Size: 2958 bytes --] ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [9fans] Acme and Git 2017-02-15 13:05 [9fans] Acme and Git Paul Lalonde 2017-02-15 14:34 ` Steve Simon 2017-02-15 17:21 ` Bakul Shah @ 2017-02-16 2:01 ` Erik Quanstrom 2017-02-16 13:05 ` Paul Lalonde 2 siblings, 1 reply; 10+ messages in thread From: Erik Quanstrom @ 2017-02-16 2:01 UTC (permalink / raw) To: Fans of the OS Plan 9 from Bell Labs [-- Attachment #1: Type: text/html, Size: 744 bytes --] ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [9fans] Acme and Git 2017-02-16 2:01 ` Erik Quanstrom @ 2017-02-16 13:05 ` Paul Lalonde 2017-02-16 15:33 ` Bakul Shah 0 siblings, 1 reply; 10+ messages in thread From: Paul Lalonde @ 2017-02-16 13:05 UTC (permalink / raw) To: Fans of the OS Plan 9 from Bell Labs [-- Attachment #1: Type: text/plain, Size: 698 bytes --] I'll give Watch and a bit of scripting a shot. I couldn't find a git "HEAD changed" hook to tie to, so Watch is pretty much the right thing. Thanks! On Wed, Feb 15, 2017 at 9:04 PM Erik Quanstrom <quanstro@quanstro.net> wrote: > try writing the file? 😀 > > On Feb 15, 2017 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? 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 > > > [-- Attachment #2: Type: text/html, Size: 1590 bytes --] ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [9fans] Acme and Git 2017-02-16 13:05 ` Paul Lalonde @ 2017-02-16 15:33 ` Bakul Shah 0 siblings, 0 replies; 10+ messages in thread From: Bakul Shah @ 2017-02-16 15:33 UTC (permalink / raw) To: Fans of the OS Plan 9 from Bell Labs [-- Attachment #1: Type: text/plain, Size: 1098 bytes --] You can use a cross platform file system event notification package like fsnotify/fsnotify or rjeczalik/notify, both on github. Instead of HEAD, may be just watch .git/index and when it changes, do git ls-files and see what changed. This will also catch local git add etc. though this probably doesn't matter. > On Feb 16, 2017, at 5:05 AM, Paul Lalonde <paul.a.lalonde@gmail.com> wrote: > > I'll give Watch and a bit of scripting a shot. I couldn't find a git "HEAD changed" hook to tie to, so Watch is pretty much the right thing. > > Thanks! > >> On Wed, Feb 15, 2017 at 9:04 PM Erik Quanstrom <quanstro@quanstro.net> wrote: >> try writing the file? 😀 >> >> On Feb 15, 2017 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? 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 >> [-- Attachment #2: Type: text/html, Size: 2298 bytes --] ^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2017-02-16 15:33 UTC | newest] Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2017-02-15 13:05 [9fans] Acme and Git Paul Lalonde 2017-02-15 14:34 ` Steve Simon 2017-02-15 14:41 ` Sigrid Haflinadóttir 2017-02-15 17:21 ` Bakul Shah 2017-02-15 19:32 ` Paul Lalonde 2017-02-15 21:29 ` Micah Stetson 2017-02-15 22:09 ` Bakul Shah 2017-02-16 2:01 ` Erik Quanstrom 2017-02-16 13:05 ` Paul Lalonde 2017-02-16 15:33 ` Bakul Shah
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).