'Set current filename and return the associated editor instance.'

def set_current_filename(self, filename, focus=True):

    index = self.has_filename(filename)
    if (index is not None):
        if focus:
            self.set_stack_index(index)
        editor = self.data[index].editor
        if focus:
            editor.setFocus()
        else:
            self.stack_history.remove_and_append(index)
        return editor
