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
Exemple #2
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
Exemple #3
0
def show_version(num):
    print "Getting this version ago:" + str(num)
    dot_git_dir = find_dot_git()
    os.chdir(dot_git_dir)
    
    fname=lisp.buffer_file_name()
    
    # subtract the .git location from the beginning part of the 
    # full path because git show does not like it
    print "fname="+fname
    print "dot_git_dir="+dot_git_dir
    suitable_dir_for_git_show = re.sub(dot_git_dir, "", fname)
    print suitable_dir_for_git_show

    # also get rid of the first / 
    suitable_dir_for_git_show = re.sub("^/", "", suitable_dir_for_git_show)
    print suitable_dir_for_git_show
    
    cmd = "git show master~" + str(num) + ":" + suitable_dir_for_git_show
    print cmd
    
    list = run_command(cmd)
    
    lisp.switch_to_buffer_other_window(cmd)
    for item in list:
        lisp.insert(item)
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")
Exemple #5
0
def show_version(num):
    print "Getting this version ago:" + str(num)
    dot_git_dir = find_dot_git()
    os.chdir(dot_git_dir)

    fname = lisp.buffer_file_name()

    # subtract the .git location from the beginning part of the
    # full path because git show does not like it
    print "fname=" + fname
    print "dot_git_dir=" + dot_git_dir
    suitable_dir_for_git_show = re.sub(dot_git_dir, "", fname)
    print suitable_dir_for_git_show

    # also get rid of the first /
    suitable_dir_for_git_show = re.sub("^/", "", suitable_dir_for_git_show)
    print suitable_dir_for_git_show

    cmd = "git show master~" + str(num) + ":" + suitable_dir_for_git_show
    print cmd

    list = run_command(cmd)

    lisp.switch_to_buffer_other_window(cmd)
    for item in list:
        lisp.insert(item)
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")
def occurrences_next(arg, reset):
    lisp.switch_to_buffer_other_window('*rope-occurrences*', True)
    if reset:
        lisp.goto_char(lisp.point_min())
    lisp.forward_line(arg)
    if lisp.eobp():
        lisp.message("Cycling rope occurences")
        lisp.goto_char(lisp.point_min())
    occurrences_goto()
Exemple #8
0
def occurrences_next(arg, reset):
    lisp.switch_to_buffer_other_window('*rope-occurrences*', True)
    if reset:
        lisp.goto_char(lisp.point_min())
    lisp.forward_line(arg)
    if lisp.eobp():
        lisp.message("Cycling rope occurences")
        lisp.goto_char(lisp.point_min())
    occurrences_goto()
Exemple #9
0
def complete_py():
    thing, start = thing_at_point()
    lisp.message(thing)
    text, matches = ip.complete(thing)
    lisp.switch_to_buffer("*pytexipy*")
    lisp.kill_buffer(lisp.get_buffer("*pytexipy*"))
    lisp.switch_to_buffer_other_window("*pytexipy*")
    lisp.insert(thing)
    for item in matches:        
        lisp.insert(item)
        lisp.insert("\n")
Exemple #10
0
def complete_py():
    thing, start = thing_at_point()
    lisp.message(thing)
    text, matches = ip.complete(thing)
    lisp.switch_to_buffer("*pytexipy*")
    lisp.kill_buffer(lisp.get_buffer("*pytexipy*"))
    lisp.switch_to_buffer_other_window("*pytexipy*")
    lisp.insert(thing)
    for item in matches:
        lisp.insert(item)
        lisp.insert("\n")
Exemple #11
0
 def occurrences_goto_occurrence(self):
     self._check_project()
     start = lisp.line_beginning_position()
     end = lisp.line_end_position()
     line = lisp.buffer_substring_no_properties(start, end)
     tokens = line.split()
     if tokens:
         resource = self.project.get_resource(tokens[0])
         offset = int(tokens[2])
         lisp.find_file_other_window(resource.real_path)
         lisp.goto_char(offset + 1)
         lisp.switch_to_buffer_other_window('*rope-occurrences*')
def occurrences_goto_occurrence():
    lisp.end_of_line()
    end = lisp.point()
    lisp.beginning_of_line()
    start = lisp.point()
    line = lisp.buffer_substring_no_properties(start, end)
    tokens = line.split()
    if tokens:
        filename = tokens[0]
        offset = int(tokens[-1])
        resource = _interface._get_resource(filename)
        LispUtils().find_file(resource.real_path, other=True)
        lisp.goto_char(offset + 1)
        lisp.switch_to_buffer_other_window('*rope-occurrences*')
Exemple #13
0
def show_version(num):
    print "Getting this version ago:" + str(num)
    dot_git_dir = find_dot_git()
    os.chdir(dot_git_dir)

    fname = lisp.buffer_file_name()

    # subtract the .git location from the beginning part of the
    # full path because git show does not like it
    suitable_dir_for_git_show = re.sub(dot_git_dir, "", fname)

    # also get rid of the first /
    suitable_dir_for_git_show = re.sub("^/", "", suitable_dir_for_git_show)

    cmd = "git show %s~%d:%s" % (branch(), num, suitable_dir_for_git_show)

    res = run_command(cmd)
    lisp.switch_to_buffer_other_window(cmd)
    for item in res:
        lisp.insert(item)
Exemple #14
0
def show_version(num):
    print "Getting this version ago:" + str(num)
    dot_git_dir = find_dot_git()
    os.chdir(dot_git_dir)

    fname = lisp.buffer_file_name()

    # subtract the .git location from the beginning part of the
    # full path because git show does not like it
    suitable_dir_for_git_show = re.sub(dot_git_dir, "", fname)

    # also get rid of the first /
    suitable_dir_for_git_show = re.sub("^/", "", suitable_dir_for_git_show)

    cmd = "git show %s~%d:%s" % (branch(), num, suitable_dir_for_git_show)

    res = run_command(cmd)
    lisp.switch_to_buffer_other_window(cmd)
    for item in res:
        lisp.insert(item)
Exemple #15
0
def ready_output():
    """
    finds pyjde output buffer kills it and starts a new one
    """
    lisp.switch_to_buffer_other_window("*PyJde*")