コード例 #1
0
ファイル: ipython-tex.py プロジェクト: nupur89/kod
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")
コード例 #2
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")
コード例 #3
0
def pick_method():
    '''
    pick the whole line from the list of function calls (completions)
    '''
    print "in pick method"
    thing, start = thing_at_point(RIGHT2, LEFT2)
    prev_buffer = os.environ['BUFFER']
    print "-"+prev_buffer+"-"
    lisp.kill_buffer(lisp.get_buffer("*PyJde*"))
    lisp.switch_to_buffer(prev_buffer)
    lisp.insert(thing)
    pos = lisp.point()
    print "pos="+(str(pos-1))
    lisp.goto_char(pos-1)
    lisp.delete_other_windows()
コード例 #4
0
 def reload_files(self, filenames, moves={}):
     if self.filename() in moves:
         initial = None
     else:
         initial = lisp.current_buffer()
     for filename in filenames:
         buffer = lisp.find_buffer_visiting(filename)
         if buffer:
             if filename in moves:
                 lisp.kill_buffer(buffer)
                 lisp.find_file(moves[filename])
             else:
                 lisp.set_buffer(buffer)
                 lisp.revert_buffer(False, True)
     if initial is not None:
         lisp.set_buffer(initial)
コード例 #5
0
 def reload_files(self, filenames, moves={}):
     if self.filename() in moves:
         initial = None
     else:
         initial = lisp.current_buffer()
     for filename in filenames:
         buffer = lisp.find_buffer_visiting(filename)
         if buffer:
             if filename in moves:
                 lisp.kill_buffer(buffer)
                 lisp.find_file(moves[filename])
             else:
                 lisp.set_buffer(buffer)
                 lisp.revert_buffer(False, True)
     if initial is not None:
         lisp.set_buffer(initial)
コード例 #6
0
ファイル: interface.py プロジェクト: FredSanders/emacs.d
 def _reload_buffers_for_changes(self, changed_resources,
                                 moved_resources={}):
     if self._get_resource() in moved_resources:
         initial = None
     else:
         initial = lisp.current_buffer()
     for resource in changed_resources:
         buffer = lisp.find_buffer_visiting(str(resource.real_path))
         if buffer:
             if resource.exists():
                 lisp.set_buffer(buffer)
                 lisp.revert_buffer(False, True)
             elif resource in moved_resources:
                 new_resource = moved_resources[resource]
                 lisp.kill_buffer(buffer)
                 lisp.find_file(new_resource.real_path)
     if initial is not None:
         lisp.set_buffer(initial)
コード例 #7
0
def pick_import():
    '''
    pick the whole line from the list of imports
    '''
    print "in pick import"
    thing, start = thing_at_point_regex("\n", "\n")
    prev_buffer = os.environ['BUFFER']
    print "-"+prev_buffer+"-"
    lisp.kill_buffer(lisp.get_buffer("*PyJde*"))
    lisp.switch_to_buffer(prev_buffer)

    remember_where = lisp.point()
    content = lisp.buffer_substring(1, lisp.point())    
    insert_where = re.search("package\s.*;", content).span()[1]
    lisp.goto_char(insert_where + 1)
    lisp.insert("\n\nimport " + thing + ";")
    lisp.message(thing + " is imported")
    lisp.goto_char(remember_where)

    lisp.delete_other_windows()