Ejemplo n.º 1
0
def discover(directory):
    directory = os.path.expanduser(
        directory)  # The tilde does not work with os.chdir
    os.chdir(directory)

    # Discovering tests using unittest framework
    loader = TestLoader()
    tests = loader.discover(directory, top_level_dir=directory)
    result = EmacsTestResult()

    # Create a buffer (if it not exists) and put the formatted results
    # inside it
    let = Let()
    lisp.get_buffer_create("unittest")
    let.push_excursion()
    lisp.set_buffer("unittest")
    lisp.erase_buffer()
    tests.run(result)
    lisp.insert("\n")
    lisp.insert("Errors:\n")
    for test, traceback in result.errors:
        lisp.insert(str(test))
        lisp.insert(traceback)
    let.pop_excursion()

    lisp.pop_to_buffer("unittest")
    lisp.compilation_mode()
    lisp.beginning_of_buffer()
Ejemplo n.º 2
0
def discover(directory):
    directory = os.path.expanduser(directory) # The tilde does not work with os.chdir
    os.chdir(directory)
    
    # Discovering tests using unittest framework
    loader = TestLoader()
    tests = loader.discover(directory, top_level_dir=directory)
    result = EmacsTestResult()
    
    # Create a buffer (if it not exists) and put the formatted results
    # inside it
    let = Let()
    lisp.get_buffer_create("unittest")
    let.push_excursion()
    lisp.set_buffer("unittest")
    lisp.erase_buffer()
    tests.run(result)
    lisp.insert("\n")
    lisp.insert("Errors:\n")
    for test, traceback in result.errors:
        lisp.insert(str(test))
        lisp.insert(traceback)
    let.pop_excursion()
    
    lisp.pop_to_buffer("unittest")
    lisp.compilation_mode()
    lisp.beginning_of_buffer()
Ejemplo n.º 3
0
def insert_in_other_buffer(bufname, text):
    """Creates/erases a buffer with the given name, opens it in a
     separate visible  pane, and pastes the given text into it."""

    lisp.get_buffer_create(bufname)
    lisp.display_buffer(bufname, 1)
    old_buf = lisp.current_buffer()
    lisp.set_buffer(bufname)
    lisp.erase_buffer()
    lisp.insert(text)
    lisp.set_buffer(old_buf)
Ejemplo n.º 4
0
def insert_in_other_buffer(bufname, text):
     """Creates/erases a buffer with the given name, opens it in a
     separate visible  pane, and pastes the given text into it."""
     
     lisp.get_buffer_create(bufname)
     lisp.display_buffer(bufname, 1)
     old_buf = lisp.current_buffer()
     lisp.set_buffer(bufname)
     lisp.erase_buffer()
     lisp.insert(text)
     lisp.set_buffer(old_buf)
Ejemplo n.º 5
0
    def _make_buffer(self, name, contents, empty_goto=True, switch=False,
                     window='other', modes=[], fit_lines=None):
        """Make an emacs buffer

        `window` can be one of `None`, 'current' or 'other'.
        """
        new_buffer = lisp.get_buffer_create(name)
        lisp.set_buffer(new_buffer)
        lisp.toggle_read_only(-1)
        lisp.erase_buffer()
        if contents or empty_goto:
            lisp.insert(contents)
            for mode in modes:
                lisp[mode + '-mode']()
            lisp.buffer_disable_undo(new_buffer)
            lisp.toggle_read_only(1)
            if switch:
                if window == 'current':
                    lisp.switch_to_buffer(new_buffer)
                else:
                    lisp.switch_to_buffer_other_window(new_buffer)
                lisp.goto_char(lisp.point_min())
            elif window == 'other':
                new_window = lisp.display_buffer(new_buffer)
                lisp.set_window_point(new_window, lisp.point_min())
                if fit_lines and lisp.fboundp(lisp['fit-window-to-buffer']):
                    lisp.fit_window_to_buffer(new_window, fit_lines)
                    lisp.bury_buffer(new_buffer)
        return new_buffer
Ejemplo n.º 6
0
    def _make_buffer(self,
                     name,
                     contents,
                     empty_goto=True,
                     switch=False,
                     window='other',
                     modes=[],
                     fit_lines=None):
        """Make an emacs buffer

        `window` can be one of `None`, 'current' or 'other'.
        """
        new_buffer = lisp.get_buffer_create(name)
        lisp.set_buffer(new_buffer)
        lisp.toggle_read_only(-1)
        lisp.erase_buffer()
        if contents or empty_goto:
            lisp.insert(contents)
            for mode in modes:
                lisp[mode + '-mode']()
            lisp.buffer_disable_undo(new_buffer)
            lisp.toggle_read_only(1)
            if switch:
                if window == 'current':
                    lisp.switch_to_buffer(new_buffer)
                else:
                    lisp.switch_to_buffer_other_window(new_buffer)
                lisp.goto_char(lisp.point_min())
            elif window == 'other':
                new_window = lisp.display_buffer(new_buffer)
                lisp.set_window_point(new_window, lisp.point_min())
                if fit_lines and lisp.fboundp(lisp['fit-window-to-buffer']):
                    lisp.fit_window_to_buffer(new_window, fit_lines)
                    lisp.bury_buffer(new_buffer)
        return new_buffer
Ejemplo n.º 7
0
def _switchToConsole():
    consolebuf = lisp.get_buffer_create("BicycleRepairManConsole")
    lisp.switch_to_buffer_other_window(consolebuf)
    lisp.compilation_mode("BicycleRepairMan")
    lisp.erase_buffer()
    lisp.insert("Bicycle Repair Man\n")
    lisp.insert("(Hint: Press Return a Link)\n")
Ejemplo n.º 8
0
def _switchToConsole():
    consolebuf = lisp.get_buffer_create("BicycleRepairManConsole")
    lisp.switch_to_buffer_other_window(consolebuf)
    lisp.compilation_mode("BicycleRepairMan")
    lisp.erase_buffer()
    lisp.insert("Bicycle Repair Man\n")
    lisp.insert("(Hint: Press Return a Link)\n")
Ejemplo n.º 9
0
    # Sample code : break on whitespace
    line = utils.cursor_line_number()

    # The +1 is because we prefer to have the result of an assignation when the cursor is on it, not one line later.
    var_info = jarvis.commands.external_inspect_vars(filename, line + 1)

    var_info = utils.inspect_format(var_info)

    found = False
    for window in lisp.window_list():
        buffer = lisp.window_buffer(window)
        if lisp.buffer_name(buffer) == BUFFER_NAME:
            found = True


    buffer = lisp.get_buffer_create(BUFFER_NAME)
    lisp.set_buffer(buffer)
    lisp.erase_buffer()
    lisp.insert(str(var_info))

    if not found:
        lisp.split_window_vertically(-10)
        lisp.other_window(1)
        lisp.switch_to_buffer(buffer)
        lisp.goto_line(1)
        lisp.other_window(1)

#    if not timer_installed:

    timer_installed = utils.get_command_global_var(VAR_KEY, False)
    if not timer_installed:
Ejemplo n.º 10
0
    # Sample code : break on whitespace
    line = utils.cursor_line_number()

    # The +1 is because we prefer to have the result of an assignation when the cursor is on it, not one line later.
    var_info = jarvis.commands.external_inspect_vars(filename, line + 1)

    var_info = utils.inspect_format(var_info)

    found = False
    for window in lisp.window_list():
        buffer = lisp.window_buffer(window)
        if lisp.buffer_name(buffer) == BUFFER_NAME:
            found = True

    buffer = lisp.get_buffer_create(BUFFER_NAME)
    lisp.set_buffer(buffer)
    lisp.erase_buffer()
    lisp.insert(str(var_info))

    if not found:
        lisp.split_window_vertically(-10)
        lisp.other_window(1)
        lisp.switch_to_buffer(buffer)
        lisp.goto_line(1)
        lisp.other_window(1)

#    if not timer_installed:

    timer_installed = utils.get_command_global_var(VAR_KEY, False)
    if not timer_installed: