Mercurial > org-tools
comparison auto-weave.pl @ 9:d09937a6cb4b
trying to build something to automatically refresh the browser.
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Tue, 25 Oct 2011 05:33:36 -0700 |
parents | 73beed20f7de |
children | 24ff8a9c76c4 |
comparison
equal
deleted
inserted
replaced
8:73beed20f7de | 9:d09937a6cb4b |
---|---|
11 @org_files = glob("./org/*.org"); | 11 @org_files = glob("./org/*.org"); |
12 | 12 |
13 $" = "\n"; | 13 $" = "\n"; |
14 print "@org_files\n"; | 14 print "@org_files\n"; |
15 | 15 |
16 $ignore_next = 0; | |
17 | |
16 | 18 |
17 foreach(@org_files){ | 19 foreach(@org_files){ |
18 # add watchers | 20 # add watchers |
19 $inotify->watch ($_, IN_MODIFY, sub | 21 $inotify->watch ($_, IN_MODIFY, sub |
20 { | 22 { |
21 my $e = shift; | 23 print ("IGNORE : $ignore_next\n"); |
22 my $name = $e->fullname; | 24 # ok, for some reason this get's called exactly |
23 print "$name was modified\n" if $e->IN_MODIFY; | 25 # twice every time the file is saved from emacs. |
24 system ("weave $name"); | 26 # so ignore every other invocation. |
25 print ("$name\n"); | 27 if ($ignore_next) { |
26 $path = `readlink -f $name`; | 28 $ignore_next = 0; |
27 $path =~ s|/home/r/proj|http://aurellem.localhost|; | 29 return; |
28 print ("$path\n"); | 30 } |
29 $path =~ s|org|html|g; | 31 |
30 print ("$path\n"); | 32 my $e = shift; |
31 system ("firefox $path"); | 33 my $name = $e->fullname; |
34 print "$name was modified\n" if $e->IN_MODIFY; | |
35 $output = `weave $name`; | |
36 print ("$name\n"); | |
37 $path = `readlink -f $name`; | |
38 $path =~ s|/home/r/proj|http://aurellem.localhost|; | |
39 print ("$path\n"); | |
40 $path =~ s|org|html|g; | |
41 print ("$path\n"); | |
42 #system ("firefox $path"); | |
43 $ignore_next = 1; | |
32 | 44 |
33 }); | 45 }); |
34 } | 46 } |
35 | 47 |
36 | 48 |