       else
         basePath
 
+    originalPane = atom.workspace.getActivePane()
     @activateAdjacentPane(atom.config.get('transformer.split'))
     options = {searchAllPanes: true, activatePane: false}
     atom.workspace.open(filePath, options).then (editor) ->
       editor.setText('') # Clear existing text
       editor.isModified = -> false
+      originalPane.activate()
       editor # pass editor to next Promise::then
 
   runCommand: ({command, args, options, editor}) ->
-    stdout = stderr = (data) -> editor.insertText(data)
+    stdout = stderr = (data) -> editor?.insertText(data)
     exit = (code) -> temp.cleanupSync() if @tempFile
     # console.log [command, args]
     options = {command, args, options, stdout, stderr, exit}

    @args = ["--harmony", @sourcePath]

class Go extends Transformer
  initialize: ->
    @args = ['run', @sourcePath]

class Less extends Transformer
  needSave: false

  JavaScript
  Less
  Go
  OCaml
}
