<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,11 +1,11 @@
 require &quot;#{File.dirname(__FILE__)}/base.rb&quot;
 
-module Processing  
-  
-  # A sketch loader, observer, and reloader, to tighten 
+module Processing
+
+  # A sketch loader, observer, and reloader, to tighten
   # the feedback between code and effect.
   class Watcher
-    
+
     # Sic a new Processing::Watcher on the sketch
     def initialize
       @file = SKETCH_PATH
@@ -14,14 +14,12 @@ module Processing
       # record_state_of_ruby
       start_watching
     end
-    
-    
+
+
     # Kicks off a thread to watch the sketch, reloading Ruby-Processing
     # and restarting the sketch whenever it changes.
     def start_watching
-      @runner = Thread.start do 
-        report_errors { Processing.load_and_run_sketch }
-      end unless $app
+      @runner = Thread.start { report_errors { Processing.load_and_run_sketch } } unless $app
       thread = Thread.start do
         loop do
           file_mtime = File.stat(@file).mtime
@@ -31,31 +29,25 @@ module Processing
             # Taking it out the reset until it can be made to work more reliably
             # rewind_to_recorded_state
             GC.start
-            @runner = Thread.start do
-              report_errors { Processing.load_and_run_sketch } 
-            end
+            @runner = Thread.start { report_errors { Processing.load_and_run_sketch } }
           end
           sleep 0.33
         end
       end
       thread.join
     end
-    
-    # Convenience function to report errors when loading and running a sketch, 
-    # instead of having them eaten by the thread they are loaded in. 
-    # Also eliminates framework lines to make the trace smaller.
-    def report_errors(&amp;block)
-      begin
-        block.call
-      rescue Exception =&gt; e
-        trace = e.backtrace.delete_if {|b| b.match /.*ruby-processing.*/}
-        puts &quot;Exception occured while running sketch #{File.basename SKETCH_PATH}:&quot;
-        puts e.to_s
-        puts trace.join(&quot;\n&quot;)
-      end
+
+    # Convenience function to report errors when loading and running a sketch,
+    # instead of having them eaten by the thread they are loaded in.
+    def report_errors
+      yield
+    rescue Exception =&gt; e
+      puts &quot;Exception occured while running sketch #{File.basename SKETCH_PATH}:&quot;
+      puts e.to_s
+      puts e.backtrace.join(&quot;\n&quot;)
     end
-    
-    # Used to completely remove all traces of the current sketch, 
+
+    # Used to completely remove all traces of the current sketch,
     # so that it can be loaded afresh. Go down into modules to find it, even.
     def wipe_out_current_app!
       @runner.kill if @runner.alive?
@@ -68,15 +60,15 @@ module Processing
       constant_names = app.class.to_s.split(/::/)
       app_class_name = constant_names.pop
       obj = constant_names.inject(Object) {|o, name| o.send(:const_get, name) }
-      obj.send(:remove_const, app_class_name)    
+      obj.send(:remove_const, app_class_name)
     end
-    
+
     # The following methods were intended to make the watcher clean up all code
     # loaded in from the sketch, gems, etc, and have them be reloaded properly
     # when the sketch is.... but it seems that this is neither a very good idea
-    # or a very possible one. If you can make the scheme work, please do, 
+    # or a very possible one. If you can make the scheme work, please do,
     # otherwise the following methods will probably be removed soonish.
-    
+
     # Do the best we can to take a picture of the current Ruby interpreter.
     # For now, this means top-level constants and loaded .rb files.
     def record_state_of_ruby
@@ -85,19 +77,19 @@ module Processing
       @saved_features   = $LOADED_FEATURES.dup
       @saved_globals    = Kernel.global_variables.dup
     end
-    
-    
+
+
     # Try to go back to the recorded Ruby state.
     def rewind_to_recorded_state
       new_constants  = Object.send(:constants).reject {|c| @saved_constants.include?(c) }
       new_load_paths = $LOAD_PATH.reject {|p| @saved_load_paths.include?(p) }
       new_features   = $LOADED_FEATURES.reject {|f| @saved_features.include?(f) }
       new_globals    = Kernel.global_variables.reject {|g| @saved_globals.include?(g) }
-      
+
       Processing::App.recursively_remove_constants(Object, new_constants)
       new_load_paths.each {|p| $LOAD_PATH.delete(p) }
       new_features.each {|f| $LOADED_FEATURES.delete(f) }
-      new_globals.each do |g| 
+      new_globals.each do |g|
         begin
           eval(&quot;#{g} = nil&quot;) # There's no way to undef a global variable in Ruby
         rescue NameError =&gt; e
@@ -105,8 +97,8 @@ module Processing
         end
       end
     end
-    
-    
+
+
     # Used to clean up declared constants in code that needs to be reloaded.
     def recursively_remove_constants(base, constant_names)
       constants = constant_names.map {|name| base.const_get(name) }
@@ -118,7 +110,7 @@ module Processing
       constants.each {|c| recursively_remove_constants(c, c.constants) if c }
       constant_names.each {|name| base.send(:remove_const, name.to_sym) if name }
     end
-    
+
   end
 end
 </diff>
      <filename>lib/ruby-processing/runners/watch.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>d8e070050a05bba470beec6a30a703faa9172644</id>
    </parent>
  </parents>
  <author>
    <name>Jeremy Ashkenas</name>
    <email>jashkenas@gmail.com</email>
  </author>
  <url>http://github.com/jashkenas/ruby-processing/commit/be5025cc6d97806765c0be915187b195364d37a1</url>
  <id>be5025cc6d97806765c0be915187b195364d37a1</id>
  <committed-date>2009-11-08T12:32:38-08:00</committed-date>
  <authored-date>2009-11-08T12:32:38-08:00</authored-date>
  <message>merging in skade's patch to report errors while running in watch mode</message>
  <tree>b01192af324eb3941cc7ff75f6470e3a7598c37e</tree>
  <committer>
    <name>Jeremy Ashkenas</name>
    <email>jashkenas@gmail.com</email>
  </committer>
</commit>
