     @messages.clear()
     @messages.hide()
     @localChanges = false
-    if @isIdrisFile(editor.getURI())
-      @loadFile editor.getURI()
+    if @isIdrisFile editor.getURI()
+      @loadFile editor
 
   idrisFileChanged: (editor) ->
     @localChanges = editor.isModified()
     if @localChanges
       @statusbar.setStatus 'Idris: local modifications'
-    else if @isIdrisFile(editor.getURI())
-      @loadFile editor.getURI()
+    else if @isIdrisFile editor.getURI()
+      @loadFile editor
 
   idrisFileClosed: (editor) ->
     @idrisBuffers -= 1

    @messages.hide()
    editor = atom.workspace.getActiveTextEditor()
    if editor
      uri = editor.getPath()
      if @isIdrisFile(uri)
        @statusbar.show()
        @loadFile uri
      else
        @statusbar.hide()


    cursorPosition = editor.getLastCursor().getCurrentWordBufferRange()
    editor.getTextInBufferRange cursorPosition

  loadFile: (editor) ->
    uri = editor.getURI()
    console.log 'Loading ' + uri
    @messages.clear()
    @model.load uri, (err, message, progress) =>
