 
 
     rerender_editor_from_queue = () ->
-        history = editor.doc.getHistory()
-    
-        gueue = queue.sort(sort_by_time)
-        console.log(queue)
-
-        scroll_position = editor.getScrollInfo()
-        cursor_position = editor.doc.getCursor()
-
-        editor2.doc.setValue(startcontent)
-        editor2.doc.replaceRange(
-            change.change.text, 
-            change.change.from, 
-            change.change.to, 
-            change.change.origin
-        ) for change in queue
-
-        editor.doc.setValue(editor2.getValue())
-        editor.doc.setHistory(history)
-        editor.doc.setCursor(cursor_position)
-        console.log(scroll_position)
-        editor.scrollTo(scroll_position.left, scroll_position.top)
+        if has_remote_edits
+            history = editor.doc.getHistory()
+        
+            gueue = queue.sort(sort_by_time)
+            console.log(queue)
+
+            scroll_position = editor.getScrollInfo()
+            cursor_position = editor.doc.getCursor()
+
+            editor2.doc.setValue(startcontent)
+            editor2.doc.replaceRange(
+                change.change.text, 
+                change.change.from, 
+                change.change.to, 
+                change.change.origin
+            ) for change in queue
+
+            editor.doc.setValue(editor2.getValue())
+            editor.doc.setHistory(history)
+            editor.doc.setCursor(cursor_position)
+            console.log(scroll_position)
+            editor.scrollTo(scroll_position.left, scroll_position.top)
 
 
     editor.doc.on 'change', (codemirror, changeObj) ->


    # Init values for changes

    startcontent = editor.doc.getValue()
    queue = []
    has_remote_edits = false
    sort_by_time = (a,b) ->
        if a.time < b.time

            })
            rerender_editor_from_queue()

            # logic to occaionally send all content to server
            # server will save on non-null value.

            socket.emit 'change',
                change: changeObj,
                all_content: editor.doc.getValue(),
