Example #1
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*')
Example #2
0
    def wrapper():
        if lisp.mark_active.value():
            # fetch marked text
            start = lisp.point()
            end = lisp.mark(True)
        else:
            # fetch full line
            start = lisp.line_beginning_position()
            end = lisp.line_end_position()

        start, end = min(start, end), max(start, end)
            
        text = lisp.buffer_substring(start, end)
        new_text = func(text)
        if isinstance(new_text, str):
            # replace text with new text
            lisp.delete_region(start, end)
            lisp.insert(new_text)
Example #3
0
    def wrapper():
        if lisp.mark_active.value():
            # fetch marked text
            start = lisp.point()
            end = lisp.mark(True)
        else:
            # fetch full line
            start = lisp.line_beginning_position()
            end = lisp.line_end_position()

        start, end = min(start, end), max(start, end)

        text = lisp.buffer_substring(start, end)
        new_text = func(text)
        if isinstance(new_text, str):
            # replace text with new text
            lisp.delete_region(start, end)
            lisp.insert(new_text)
Example #4
0
def get_line_string ():
    start = lisp.line_beginning_position()
    end = lisp.line_end_position()
    return start, end, lisp.buffer_substring(start, end)