     false
 
   set_mark: ->
-    editor = atom.workspace.getActiveTextEditor()
+    editor = @getEditor()
+    return unless editor
     editorView = atom.views.getView editor
     $(editorView).toggleClass "transient-marked"
     cursor.clearSelection() for cursor in editor.getCursors()
 
   kill_region_or_backward_word: ->
-    editor = atom.workspace.getActiveTextEditor()
+    editor = @getEditor()
+    return unless editor
     if editor.getLastSelection().isEmpty()
       @kill_backward_word()
     else

    @is_user_command = true

  kill: ->
    @is_user_command = false
    editor = atom.workspace.getActiveTextEditor()
    editor.transact =>
      editor.selectToEndOfLine()
      texts = (s.getText() or '\n' for s in editor.getSelections())

    @is_user_command = true

  yank: ->
    editor = @getEditor()
    return unless editor
    editor.transact =>
      cursors = editor.getCursors()
      top = @killring.top()
