diff src/demo.sml @ 410:c5a3d223f157

Sql demo
author Adam Chlipala <adamc@hcoop.net>
date Tue, 21 Oct 2008 18:44:52 -0400
parents 1195f6e4d208
children 7ef4b2911b09
line wrap: on
line diff
--- a/src/demo.sml	Tue Oct 21 17:49:14 2008 -0400
+++ b/src/demo.sml	Tue Oct 21 18:44:52 2008 -0400
@@ -271,6 +271,15 @@
                             fun highlight () =
                                 doit (fn (src, html) =>
                                          let
+                                             val dirty =
+                                                 let
+                                                     val srcSt = Posix.FileSys.stat src
+                                                     val htmlSt = Posix.FileSys.stat html
+                                                 in
+                                                     Time.> (Posix.FileSys.ST.mtime srcSt,
+                                                             Posix.FileSys.ST.mtime htmlSt)
+                                                 end handle OS.SysErr _ => true
+
                                              val cmd = "emacs --eval \"(progn "
                                                        ^ "(global-font-lock-mode t) "
                                                        ^ "(add-to-list 'load-path \\\""
@@ -287,8 +296,11 @@
                                                        ^ "\\\") "
                                                        ^ "(kill-emacs))\""
                                          in
-                                             print (">>> " ^ cmd ^ "\n");
-                                             ignore (OS.Process.system cmd)
+                                             if dirty then
+                                                 (print (">>> " ^ cmd ^ "\n");
+                                                  ignore (OS.Process.system cmd))
+                                             else
+                                                 ()
                                          end)
                         in
                             if OS.Path.base file = "demo" then