def _insert_import(self, name, module): lineno = self.autoimport.find_insertion_line(self.source) current = lisp.point() lisp.goto_line(lineno) newimport = 'from %s import %s\n' % (module, name) lisp.insert(newimport) lisp.goto_char(current + len(newimport))
def _goto_location(self, resource, lineno): if resource: if resource.project == self.project: lisp.find_file(str(resource.real_path)) else: lisp.find_file_read_only(str(resource.real_path)) if lineno: lisp.goto_line(lineno)
def promptCallback(filename,line,colbegin,colend): let = Let().push_excursion() # gets popped when let goes out of scope buffer = lisp.current_buffer() if let: ans = 0 lisp.find_file(filename) lisp.goto_line(line) lisp.move_to_column(colbegin) lisp.set_mark(lisp.point() + (colend - colbegin)) if is_xemacs: lisp.activate_region() ans = lisp.y_or_n_p("Couldn't deduce object type - rename this method reference? ") del let lisp.switch_to_buffer(buffer) return ans
def promptCallback(filename, line, colbegin, colend): let = Let().push_excursion() # gets popped when let goes out of scope buffer = lisp.current_buffer() if let: ans = 0 lisp.find_file(filename) lisp.goto_line(line) lisp.move_to_column(colbegin) lisp.set_mark(lisp.point() + (colend - colbegin)) if is_xemacs: lisp.activate_region() ans = lisp.y_or_n_p( "Couldn't deduce object type - rename this method reference? ") del let lisp.switch_to_buffer(buffer) return ans
def find_definition(self): lisp.save_some_buffers() filename = lisp.buffer_file_name() line,col = _getCoords() defns = brmctx.findDefinitionByCoordinates(filename,line,col) try: firstdefn = defns.next() lisp.find_file_other_window(firstdefn.filename) lisp.goto_line(firstdefn.lineno) lisp.forward_char(firstdefn.colno) except StopIteration: pass else: numRefs = 1 for defn in defns: if numRefs == 1: _switchToConsole() _insertRefLineIntoConsole(firstdefn) _insertRefLineIntoConsole(defn) numRefs += 1
def find_definition(self): lisp.save_some_buffers() filename = lisp.buffer_file_name() line, col = _getCoords() defns = brmctx.findDefinitionByCoordinates(filename, line, col) try: firstdefn = defns.next() lisp.find_file_other_window(firstdefn.filename) lisp.goto_line(firstdefn.lineno) lisp.forward_char(firstdefn.colno) except StopIteration: pass else: numRefs = 1 for defn in defns: if numRefs == 1: _switchToConsole() _insertRefLineIntoConsole(firstdefn) _insertRefLineIntoConsole(defn) numRefs += 1
def insert_line(self, line, lineno): current = lisp.point() lisp.goto_line(lineno) lisp.insert(line + '\n') lisp.goto_char(current + len(line) + 1)
def goto_line(self, lineno): lisp.goto_line(lineno)
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: utils.set_command_global_var(VAR_KEY, True) # This is a bit unstable right now, it trigger refresh of the window when needed ... #lisp.run_at_time(True, 1.0, lisp.j_inspect_vars_refresh)
def t(): lisp.message(msg) lisp.set_buffer("*LogBuffer*") lisp.goto_line(lisp.point_max()) lisp.insert(msg+"\n")
# 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: utils.set_command_global_var(VAR_KEY, True) # This is a bit unstable right now, it trigger refresh of the window when needed ... #lisp.run_at_time(True, 1.0, lisp.j_inspect_vars_refresh)
def t(): lisp.message(msg) lisp.set_buffer("*LogBuffer*") lisp.goto_line(lisp.point_max()) lisp.insert(msg + "\n")
from Pymacs import lisp import jarvis errorpath = jarvis.get_filename(jarvis.ERROR_FILE) f = open(errorpath).read() finalfilename = None finalline = None for l in f.split("\n"): if "File \"" in l: parts = l.split() filename = parts[1][1:-2] line = parts[3].strip(",") finalfilename = filename finalline = line if finalfilename != None and finalline != None: lisp.find_file(finalfilename) lisp.goto_line(int(finalline))