 DEFAULT_VALUE = '''
-function addto(x)
-  -- Return a new function that adds x to the argument
-  return function(y)
-    --[[ When we refer to the variable x, which is outside of the current
-         scope and whose lifetime would be shorter than that of this anonymous
-         function, Lua creates a closure.]]
-    return x + y
-  end
-end
-fourplus = addto(4)
-print(fourplus(3))  -- Prints 7
- 
---This can also be achieved by calling the function in the following way:
-print(addto(4)(3))
---[[ This is because we are calling the returned function from `addto(4)' with the argument `3' directly.
-     This also helps to reduce data cost and up performance if being called iteratively.
-]]
+# what will you create?
 '''
 
-angular.module("edit", ["ui.ace"])
-.controller "EditCtrl", [
-  "$scope"
+angular.module('edit', ['ui.ace'])
+.controller 'EditCtrl', [
+  '$scope'
   ($scope) ->
 
     promised = {}

      else
        editor.setValue DEFAULT_VALUE
        editor.gotoLine 0, 0
      #value = localStorage.edit__autosave_value || DEFAULT_VALUE
      #line = localStorage.edit__autosave_line || 0
      #column = localStorage.edit__autosave_column || 0
      
    doLocalSave = ->
      storage = DataStore.create 'simple'
      editor = promised.editor

    AUTOSAVE_DELAY = 100
    aceChangedDebounced = _.debounce(aceChanged, AUTOSAVE_DELAY, false)

    setup = (editor) ->
      promised.editor = editor
      editor.setShowPrintMargin(false)
      loadLocalSave()
      editor.focus()

      editor.getSelection().on('changeCursor', aceChangedDebounced)

    # Quick fix to prevent setup from being fired twice in quick succession.
    # Eventually we should figure out what's causing it to be fired in quick
    # succession in the first place.
    setupDebounced = _.debounce(setup, 100, true)

    $scope.aceChanged = -> aceChangedDebounced()
    $scope.aceLoaded = (args...) -> setupDebounced(args...)
    $scope.sendEditorData = ->
      editor = promised.editor
      value = editor.getValue()
