 
       # When we click this element,
       # we should switch to it in the palette.
-      clickHandler = =>
+      updatePalette = =>
         # Record that we are the selected group now
         @currentPaletteGroup = paletteGroup.name
         @currentPaletteBlocks = paletteGroupBlocks.map (x) -> x.block


      # If we are the first element, make us the selected palette group.
      if i is 0
        do clickHandler

  # The next thing we need to do with the palette
  # is let people pick things up from it.

        # Redraw the palette.
        @redrawPalette()

      clickHandler = =>
        do updatePalette
        for event in editorBindings.set_palette
          event.call this

