diff --git a/doc/slimv.txt b/doc/slimv.txt index 874ca80..25f922b 100644 --- a/doc/slimv.txt +++ b/doc/slimv.txt @@ -1,7 +1,7 @@ -*slimv.txt* Slimv Last Change: 05 Oct 2011 +*slimv.txt* Slimv Last Change: 13 Oct 2011 Slimv *slimv* - Version 0.9.0 + Version 0.9.1 The Superior Lisp Interaction Mode for Vim. This plugin is aimed to help Lisp development by interfacing between Vim and @@ -176,6 +176,8 @@ For the Swank options plese visit |swank-configuration|. |g:slimv_simple_compl| Use simple completion instead of fuzzy completion. +|g:slimv_sldb_wrap| Set wrap mode for the SLDB buffer. + |g:slimv_swank_clojure| Command used to start the Clojure SWANK server. |g:slimv_swank_cmd| Command used to start the Lisp SWANK server. @@ -410,6 +412,11 @@ This is the default behaviour as it is how regular REPL windows work. This mode also enables keybindings for cursor movements, so that an keypress will move the cursor one line on the display and not one line in the document. + *g:slimv_sldb_wrap* +Set wrap mode for the SLDB buffer, which means the lines longer than the +window width will not be hidden to the right. Instead they will be continued +in the next display line. Disabled by default. + *g:slimv_echolines* If a long form is evaluated then echo only this number of lines from the beginning of the form. This option prevents filling the REPL buffer with @@ -1213,6 +1220,22 @@ FAQ *slimv-faq* =============================================================================== CHANGE LOG *slimv-changelog* +0.9.1 - Improved frame number identification in SLDB buffer. + - Moved frame source location above frame locals in SLDB. + - Fold frame source location if more than 2 lines. + - Inspect-In-Frame: preselect symbol under cursor only in variable lines. + - Inspect-In-Frame: open Inspector in the other window. + - Improved XRef file location parsing. + - Use current paragraph when no range set for Eval-Region and + Compile-Region. + - Added option g:slimv_sldb_wrap, do not set wrap for source buffers. + - Added Set-Breakpoint command mapped to B (thanks to + Philipp Marek), changed Profile-By-Substring mapping to P. + - Set Lisp keyword characters also in SLDB buffer. + - Bugfix: error messages at Connect-Server. + - Bugfix: error message for frame source location without filename. + - Bugfix: XRef output sometimes cut. + 0.9.0 - Separate buffers for SLDB and Inspector. - Toggle frame information in SLDB buffer by pressing Enter. - Look up source when pressing Enter on filename with location in SLDB. diff --git a/ftplugin/clojure/slimv-clojure.vim b/ftplugin/clojure/slimv-clojure.vim index 9703361..0015410 100644 --- a/ftplugin/clojure/slimv-clojure.vim +++ b/ftplugin/clojure/slimv-clojure.vim @@ -1,7 +1,7 @@ " slimv-clojure.vim: " Clojure filetype plugin for Slimv -" Version: 0.9.0 -" Last Change: 20 Sep 2011 +" Version: 0.9.1 +" Last Change: 07 Oct 2011 " Maintainer: Tamas Kovacs " License: This file is placed in the public domain. " No warranty, express or implied. @@ -152,13 +152,13 @@ endfunction function! b:SlimvReplInit( lisp_version ) " Import functions commonly used in REPL but not present when not running in repl mode if a:lisp_version[0:2] >= '1.3' - call SlimvSend( ["(use '[clojure.repl :only (source apropos dir pst doc find-doc)])", - \ "(use '[clojure.java.javadoc :only (javadoc)])", - \ "(use '[clojure.pprint :only (pp pprint)])"], 0 ) + call SlimvSendSilent( ["(use '[clojure.repl :only (source apropos dir pst doc find-doc)])", + \ "(use '[clojure.java.javadoc :only (javadoc)])", + \ "(use '[clojure.pprint :only (pp pprint)])"] ) elseif a:lisp_version[0:2] >= '1.2' - call SlimvSend( ["(use '[clojure.repl :only (source apropos)])", - \ "(use '[clojure.java.javadoc :only (javadoc)])", - \ "(use '[clojure.pprint :only (pp pprint)])"], 0 ) + call SlimvSendSilent( ["(use '[clojure.repl :only (source apropos)])", + \ "(use '[clojure.java.javadoc :only (javadoc)])", + \ "(use '[clojure.pprint :only (pp pprint)])"] ) endif endfunction diff --git a/ftplugin/slimv.vim b/ftplugin/slimv.vim index 830e6ee..dd1c4ac 100644 --- a/ftplugin/slimv.vim +++ b/ftplugin/slimv.vim @@ -1,6 +1,6 @@ " slimv.vim: The Superior Lisp Interaction Mode for VIM -" Version: 0.9.0 -" Last Change: 05 Oct 2011 +" Version: 0.9.1 +" Last Change: 12 Oct 2011 " Maintainer: Tamas Kovacs " License: This file is placed in the public domain. " No warranty, express or implied. @@ -226,6 +226,11 @@ if !exists( 'g:slimv_repl_wrap' ) let g:slimv_repl_wrap = 1 endif +" Wrap long lines in SLDB buffer +if !exists( 'g:slimv_sldb_wrap' ) + let g:slimv_sldb_wrap = 0 +endif + " Maximum number of lines echoed from the evaluated form if !exists( 'g:slimv_echolines' ) let g:slimv_echolines = 4 @@ -326,6 +331,7 @@ let s:current_buf = -1 " Swank action was req let s:current_win = -1 " Swank action was requested from this window let s:skip_sc = 'synIDattr(synID(line("."), col("."), 0), "name") =~ "[Ss]tring\\|[Cc]omment"' " Skip matches inside string or comment +let s:frame_def = '^\s\{0,2}\d\{1,3}:' " Regular expression to match SLDB restart or frame identifier let s:sldb_name = 'Slimv.SLDB' " Name of the SLDB buffer let s:inspect_name = 'Slimv.INSPECT' " Name of the Inspect buffer @@ -647,7 +653,7 @@ function! SlimvOpenReplBuffer() noremap j gj noremap 0 g0 noremap $ :call EndOfScreenLine() - set wrap + setlocal wrap endif hi SlimvNormal term=none cterm=none gui=none @@ -696,6 +702,11 @@ function SlimvOpenSldbBuffer() setlocal foldmethod=marker setlocal foldmarker={{{,}}} setlocal foldtext=substitute(getline(v:foldstart),'{{{','','') + setlocal iskeyword+=+,-,*,/,%,<,=,>,:,$,?,!,@-@,94,~,#,\|,&,{,},[,] + if g:slimv_sldb_wrap + setlocal wrap + endif + if version < 703 " conceal mechanism is defined since Vim 7.3 syn match Ignore /{{{/ @@ -705,7 +716,7 @@ function SlimvOpenSldbBuffer() syn match Comment /{{{/ conceal syn match Comment /}}}/ conceal endif - syn match Type /^\s*\d\+:/ + syn match Type /^\s\{0,2}\d\{1,3}:/ syn match Type /^\s\+in "\(.*\)" \(line\|byte\) \(\d\+\)$/ endfunction @@ -734,6 +745,22 @@ function SlimvQuitSldb() b # endfunction +" Open SLDB buffer and place cursor on the given frame +function SlimvGotoFrame( frame ) + call SlimvOpenSldbBuffer() + let bcktrpos = search( '^Backtrace:', 'bcnw' ) + let line = getline( '.' ) + let item = matchstr( line, '^\s*' . a:frame . ':' ) + if item != '' && line('.') > bcktrpos + " Already standing on the frame + return + endif + + " Must locate the frame starting from the 'Backtrace:' string + call search( '^Backtrace:', 'bcw' ) + call search( '^\s*' . a:frame . ':', 'w' ) +endfunction + " Set 'iskeyword' option depending on file type function! s:SetKeyword() if SlimvGetFiletype() == 'clojure' @@ -984,7 +1011,9 @@ function! SlimvSend( args, echoing, output ) " Open a new line for the output call append( '$', '' ) endif - call SlimvMarkBufferEnd() + if a:output + call SlimvMarkBufferEnd() + endif call SlimvCommand( 'python swank_input("s:swank_form")' ) let s:swank_package = '' let s:refresh_disabled = 0 @@ -1301,24 +1330,23 @@ function! SlimvHandleEnterSldb() let line = getline('.') if s:debug_activated " Check if Enter was pressed in a section printed by the SWANK debugger - let item = matchstr( line, '^\s*\d\+' ) + if foldlevel('.') + " With a fold just toggle visibility + normal za + return + endif + let item = matchstr( line, s:frame_def ) if item != '' - let item = substitute( item, '\s', '', 'g' ) + let item = substitute( item, '\s\|:', '', 'g' ) if search( '^Backtrace:', 'bnW' ) > 0 - if foldlevel('.') - " With a fold just toggle visibility - normal za - return - endif " Display item-th frame call SlimvMakeFold() - call setpos( "'s", [0, line('.'), col('.'), 0] ) + silent execute 'python swank_frame_locals("' . item . '")' if b:SlimvImplementation() != 'clisp' " These are not implemented for CLISP - silent execute 'python swank_frame_call("' . item . '")' silent execute 'python swank_frame_source_loc("' . item . '")' + silent execute 'python swank_frame_call("' . item . '")' endif - silent execute 'python swank_frame_locals("' . item . '")' return endif if search( '^Restarts:', 'bnW' ) > 0 @@ -1509,6 +1537,7 @@ endfunction " Start and connect slimv server " This is a quite dummy function that just evaluates the empty string function! SlimvConnectServer() + call SlimvBeginUpdate() let repl_buf = bufnr( g:slimv_repl_file ) let repl_win = bufwinnr( repl_buf ) if repl_buf == -1 || ( g:slimv_repl_split && repl_win == -1 ) @@ -1529,7 +1558,15 @@ function! SlimvGetRegion() range let firstcol = col( a:firstline ) - 1 let lastcol = col( a:lastline ) - 2 else + " No range was selected, select current paragraph + normal! vap + execute "normal! \" + call setpos( '.', oldpos ) let lines = getline( "'<", "'>" ) + if lines == [] || lines == [''] + call SlimvError( "No range selected." ) + return [] + endif let firstcol = col( "'<" ) - 1 let lastcol = col( "'>" ) - 2 endif @@ -1556,7 +1593,9 @@ endfunction " Eval buffer lines in the given range function! SlimvEvalRegion() range let lines = SlimvGetRegion() - call SlimvEval( lines ) + if lines != [] + call SlimvEval( lines ) + endif endfunction " Eval contents of the 's' register @@ -1621,12 +1660,16 @@ function! s:DebugFrame() " Check if we are in SLDB let repl_buf = bufnr( s:sldb_name ) if repl_buf != -1 && repl_buf == bufnr( "%" ) - let line = getline('.') - let item = matchstr( line, '\d\+' ) - if item != '' - let section = getline( line('.') - item - 1 ) - if section[0:9] == 'Backtrace:' - return item + let bcktrpos = search( '^Backtrace:', 'bcnw' ) + let framepos = line( '.' ) + if matchstr( getline('.'), s:frame_def ) == '' + let framepos = search( s:frame_def, 'bcnw' ) + endif + if framepos > 0 && bcktrpos > 0 && framepos > bcktrpos + let line = getline( framepos ) + let item = matchstr( line, s:frame_def ) + if item != '' + return substitute( item, '\s\|:', '', 'g' ) endif endif endif @@ -1650,7 +1693,7 @@ function! SlimvInteractiveEval() let frame = s:DebugFrame() if frame != '' " We are in the debugger, eval expression in the frame the cursor stands on - let e = input( 'Eval in frame: ' ) + let e = input( 'Eval in frame ' . frame . ': ' ) if e != '' let result = SlimvCommandGetResponse( ':eval-string-in-frame', 'python swank_eval_in_frame("' . e . '", ' . frame . ')' ) if result != '' @@ -1735,6 +1778,19 @@ function! SlimvMacroexpandAll() endif endfunction +" Set a breakpoint on the beginning of a function +function! SlimvBreak() + if s:swank_connected + let s = input( 'Set breakpoint: ', SlimvSelectSymbol() ) + if s != '' + call SlimvCommandUsePackage( 'python swank_set_break("' . s . '")' ) + redraw! + endif + else + call SlimvError( "Not connected to SWANK server." ) + endif +endfunction + " Switch trace on for the selected function (toggle for swank) function! SlimvTrace() if s:swank_connected @@ -1777,10 +1833,28 @@ function! SlimvInspect() let frame = s:DebugFrame() if frame != '' " Inspect selected for a frame in the debugger's Backtrace section - let s = input( 'Inspect in frame ' . frame . ': ' ) - call SlimvCommand( 'python swank_inspect_in_frame("' . s . '", ' . frame . ')' ) - call SlimvRefreshReplBuffer() - return + let line = getline( '.' ) + if matchstr( line, s:frame_def ) != '' + " This is the base frame line in form ' 1: xxxxx' + let sym = '' + elseif matchstr( line, '^\s\+in "\(.*\)" \(line\|byte\)' ) != '' + " This is the source location line + let sym = '' + elseif matchstr( line, '^\s\+No source line information' ) != '' + " This is the no source location line + let sym = '' + elseif matchstr( line, '^\s\+Locals:' ) != '' + " This is the 'Locals' line + let sym = '' + else + let sym = SlimvSelectSymbolExt() + endif + let s = input( 'Inspect in frame ' . frame . ' (evaluated): ', sym ) + if s != '' + call SlimvBeginUpdate() + call SlimvCommand( 'python swank_inspect_in_frame("' . s . '", ' . frame . ')' ) + call SlimvRefreshReplBuffer() + endif else let s = input( 'Inspect: ', SlimvSelectSymbolExt() ) if s != '' @@ -1974,6 +2048,9 @@ endfunction function! SlimvCompileRegion() range let oldpos = getpos( '.' ) let lines = SlimvGetRegion() + if lines == [] + return + endif let region = join( lines, "\n" ) if s:swank_connected let s:swank_form = region @@ -2292,16 +2369,17 @@ call s:MenuMap( 'Slim&v.&Evaluation.&Undefine-Function', g:slimv_leader.' " Debug commands call s:MenuMap( 'Slim&v.De&bugging.Macroexpand-&1', g:slimv_leader.'1', g:slimv_leader.'m1', ':call SlimvMacroexpand()' ) call s:MenuMap( 'Slim&v.De&bugging.&Macroexpand-All', g:slimv_leader.'m', g:slimv_leader.'ma', ':call SlimvMacroexpandAll()' ) - call s:MenuMap( 'Slim&v.De&bugging.Toggle-&Trace\.\.\.', g:slimv_leader.'t', g:slimv_leader.'dt', ':call SlimvTrace()' ) call s:MenuMap( 'Slim&v.De&bugging.U&ntrace-All', g:slimv_leader.'T', g:slimv_leader.'du', ':call SlimvUntrace()' ) - +call s:MenuMap( 'Slim&v.De&bugging.Set-&Breakpoint', g:slimv_leader.'B', g:slimv_leader.'db', ':call SlimvBreak()' ) call s:MenuMap( 'Slim&v.De&bugging.Disassemb&le\.\.\.', g:slimv_leader.'l', g:slimv_leader.'dd', ':call SlimvDisassemble()' ) call s:MenuMap( 'Slim&v.De&bugging.&Inspect\.\.\.', g:slimv_leader.'i', g:slimv_leader.'di', ':call SlimvInspect()' ) +call s:MenuMap( 'Slim&v.De&bugging.-SldbSep-', '', '', ':' ) call s:MenuMap( 'Slim&v.De&bugging.&Abort', g:slimv_leader.'a', g:slimv_leader.'da', ':call SlimvDebugCommand("swank_invoke_abort")' ) call s:MenuMap( 'Slim&v.De&bugging.&Quit-to-Toplevel', g:slimv_leader.'q', g:slimv_leader.'dq', ':call SlimvDebugCommand("swank_throw_toplevel")' ) call s:MenuMap( 'Slim&v.De&bugging.&Continue', g:slimv_leader.'n', g:slimv_leader.'dc', ':call SlimvDebugCommand("swank_invoke_continue")' ) -call s:MenuMap( 'Slim&v.De&bugging.&List-Threads', g:slimv_leader.'H', g:slimv_leader.'dl', ':call SlimvListThreads()' ) +call s:MenuMap( 'Slim&v.De&bugging.-ThreadSep-', '', '', ':' ) +call s:MenuMap( 'Slim&v.De&bugging.List-T&hreads', g:slimv_leader.'H', g:slimv_leader.'dl', ':call SlimvListThreads()' ) call s:MenuMap( 'Slim&v.De&bugging.&Kill-Thread\.\.\.', g:slimv_leader.'K', g:slimv_leader.'dk', ':call SlimvKillThread()' ) call s:MenuMap( 'Slim&v.De&bugging.&Debug-Thread\.\.\.', g:slimv_leader.'G', g:slimv_leader.'dg', ':call SlimvDebugThread()' ) @@ -2324,7 +2402,7 @@ call s:MenuMap( 'Slim&v.&Xref.List-Call&ees', g:slimv_leader.' " Profile commands call s:MenuMap( 'Slim&v.&Profiling.Toggle-&Profile\.\.\.', g:slimv_leader.'p', g:slimv_leader.'pp', ':call SlimvProfile()' ) -call s:MenuMap( 'Slim&v.&Profiling.Profile-&By-Substring\.\.\.',g:slimv_leader.'B', g:slimv_leader.'pb', ':call SlimvProfileSubstring()' ) +call s:MenuMap( 'Slim&v.&Profiling.Profile-&By-Substring\.\.\.',g:slimv_leader.'P', g:slimv_leader.'pb', ':call SlimvProfileSubstring()' ) call s:MenuMap( 'Slim&v.&Profiling.Unprofile-&All', g:slimv_leader.'U', g:slimv_leader.'pa', ':call SlimvUnprofileAll()' ) call s:MenuMap( 'Slim&v.&Profiling.&Show-Profiled', g:slimv_leader.'?', g:slimv_leader.'ps', ':call SlimvShowProfiled()' ) call s:MenuMap( 'Slim&v.&Profiling.-ProfilingSep-', '', '', ':' ) diff --git a/ftplugin/swank.py b/ftplugin/swank.py index 2869d92..4fbe391 100644 --- a/ftplugin/swank.py +++ b/ftplugin/swank.py @@ -4,8 +4,8 @@ # # SWANK client for Slimv # swank.py: SWANK client code for slimv.vim plugin -# Version: 0.9.0 -# Last Change: 04 Oct 2011 +# Version: 0.9.1 +# Last Change: 12 Oct 2011 # Maintainer: Tamas Kovacs # License: This file is placed in the public domain. # No warranty, express or implied. @@ -170,9 +170,10 @@ def parse_sexpr( sexpr ): ############################################################################### class swank_action: - def __init__ (self, id, name): + def __init__ (self, id, name, data): self.id = id self.name = name + self.data = data self.result = '' self.pending = True @@ -213,7 +214,7 @@ def parse_plist(lst, keyword): return unquote(lst[i+1]) return '' -def parse_location(fname, loc): +def parse_filepos(fname, loc): lnum = 1 cnum = 1 pos = loc @@ -236,6 +237,32 @@ def format_filename(fname): fname = '"' + fname + '"' return fname +def parse_location(lst): + fname = '' + line = '' + pos = '' + if lst[0] == ':location': + if type(lst[1]) == str: + return unquote(lst[1]) + for l in lst[1:]: + if l[0] == ':file': + fname = l[1] + if l[0] == ':line': + line = l[1] + if l[0] == ':position': + pos = l[1] + if fname == '': + fname = 'Unknown file' + if line != '': + return 'in ' + format_filename(fname) + ' line ' + line + if pos != '': + [lnum, cnum] = parse_filepos(unquote(fname), int(pos)) + if lnum > 0: + return 'in ' + format_filename(fname) + ' line ' + str(lnum) + else: + return 'in ' + format_filename(fname) + ' byte ' + pos + return 'no source line information' + def unicode_len(text): return len(unicode(text, "utf-8")) @@ -377,15 +404,7 @@ def swank_parse_xref(struct): """ buf = '' for e in struct: - buf = buf + unquote(e[0]) + ' - ' - if len(e) > 1: - key = e[1][0] - if key == ':error': - buf = buf + 'no source information\n' - elif type(unquote(e[1][1])) == str: - buf = unquote(e[1][1]) + '\n' - else: - buf = unquote(e[1][1][1]) + '\n' + buf = buf + unquote(e[0]) + ' - ' + parse_location(e[1]) + '\n' return buf def swank_parse_compile(struct): @@ -426,7 +445,7 @@ def swank_parse_compile(struct): lnum = pos cnum = 1 else: - [lnum, cnum] = parse_location(fname, int(pos)) + [lnum, cnum] = parse_filepos(fname, int(pos)) msg = msg.replace("'", "' . \"'\" . '") qfentry = "{'filename':'"+fname+"','lnum':'"+str(lnum)+"','col':'"+str(cnum)+"','text':'"+msg+"'}" logprint(qfentry) @@ -447,12 +466,11 @@ def swank_parse_list_threads(tl): idx = idx + 1 return buf -def swank_parse_frame_call(struct): +def swank_parse_frame_call(struct, action): """ Parse frame call output """ - vim.command('call SlimvOpenSldbBuffer()') - vim.command('normal! `s') + vim.command('call SlimvGotoFrame(' + action.data + ')') buf = vim.current.buffer win = vim.current.window line = win.cursor[0] @@ -462,45 +480,55 @@ def swank_parse_frame_call(struct): buf[line:line] = ['No frame call information'] vim.command('call SlimvEndUpdate()') -def swank_parse_frame_source(struct): +def swank_parse_frame_source(struct, action): """ Parse frame source output http://comments.gmane.org/gmane.lisp.slime.devel/9961 ;-( 'Well, let's say a missing feature: source locations are currently not available for code loaded as source.' """ - vim.command('call SlimvOpenSldbBuffer()') - vim.command('normal! `s') + vim.command('call SlimvGotoFrame(' + action.data + ')') buf = vim.current.buffer win = vim.current.window line = win.cursor[0] if type(struct) == list and len(struct) == 4: - [lnum, cnum] = parse_location(unquote(struct[1][1]), int(struct[2][1])) - fname = format_filename(struct[1][1]) + if struct[1] == 'nil': + [lnum, cnum] = [int(struct[2][1]), 1] + fname = 'Unknown file' + else: + [lnum, cnum] = parse_filepos(unquote(struct[1][1]), int(struct[2][1])) + fname = format_filename(struct[1][1]) if lnum > 0: - s = ' in ' + fname + ' line ' + str(lnum) + s = ' in ' + fname + ' line ' + str(lnum) else: - s = ' in ' + fname + ' byte ' + struct[2][1] - buf[line:line] = s.splitlines(); + s = ' in ' + fname + ' byte ' + struct[2][1] + slines = s.splitlines() + if len(slines) > 2: + # Make a fold (closed) if there are too many lines + slines[ 0] = slines[ 0] + '{{{' + slines[-1] = slines[-1] + '}}}' + buf[line:line] = slines + vim.command(str(line+1) + 'foldclose') + else: + buf[line:line] = slines else: - buf[line:line] = [' No source line information'] + buf[line:line] = [' No source line information'] vim.command('call SlimvEndUpdate()') -def swank_parse_locals(struct): +def swank_parse_locals(struct, action): """ Parse frame locals output """ - vim.command('call SlimvOpenSldbBuffer()') - vim.command('normal! `s') + vim.command('call SlimvGotoFrame(' + action.data + ')') buf = vim.current.buffer win = vim.current.window line = win.cursor[0] if type(struct) == list: - lines = ' Locals:\n' + lines = ' Locals:' for f in struct: name = parse_plist(f, ':name') id = parse_plist(f, ':id') value = parse_plist(f, ':value') - lines = lines + ' ' + name + ' = ' + value + '\n' + lines = lines + '\n ' + name + ' = ' + value else: lines = ' No locals' buf[line:line] = lines.split("\n") @@ -687,11 +715,11 @@ def swank_listen(): retval = retval + '\n' + ' ' + f retval = retval + '\n' + prompt + '> ' elif action.name == ':frame-call': - swank_parse_frame_call(params) + swank_parse_frame_call(params, action) elif action.name == ':frame-source-location': - swank_parse_frame_source(params) + swank_parse_frame_source(params, action) elif action.name == ':frame-locals-and-catch-tags': - swank_parse_locals(params) + swank_parse_locals(params, action) elif action.name == ':profiled-functions': retval = retval + '\n' + 'Profiled functions:\n' for f in params: @@ -733,14 +761,14 @@ def swank_listen(): empty_last_line = (retval[-1] == '\n') return retval -def swank_rex(action, cmd, package, thread): +def swank_rex(action, cmd, package, thread, data=''): """ Send an :emacs-rex command to SWANK """ global id id = id + 1 key = str(id) - actions[key] = swank_action(key, action) + actions[key] = swank_action(key, action, data) form = '(:emacs-rex ' + cmd + ' ' + package + ' ' + thread + ' ' + str(id) + ')\n' swank_send(form) @@ -790,7 +818,7 @@ def swank_eval(exp): def swank_eval_in_frame(exp, n): cmd = '(swank:eval-string-in-frame ' + requote(exp) + ' ' + str(n) + ')' - swank_rex(':eval-string-in-frame', cmd, get_swank_package(), current_thread) + swank_rex(':eval-string-in-frame', cmd, get_swank_package(), current_thread, str(n)) def swank_pprint_eval(exp): cmd = '(swank:pprint-eval ' + requote(exp) + ')' @@ -801,7 +829,7 @@ def swank_interrupt(): def swank_invoke_restart(level, restart): cmd = '(swank:invoke-nth-restart-for-emacs ' + level + ' ' + restart + ')' - swank_rex(':invoke-nth-restart-for-emacs', cmd, 'nil', current_thread) + swank_rex(':invoke-nth-restart-for-emacs', cmd, 'nil', current_thread, restart) def swank_throw_toplevel(): swank_rex(':throw-to-toplevel', '(swank:throw-to-toplevel)', 'nil', current_thread) @@ -818,15 +846,15 @@ def swank_require(contrib): def swank_frame_call(frame): cmd = '(swank-backend:frame-call ' + frame + ')' - swank_rex(':frame-call', cmd, 'nil', current_thread) + swank_rex(':frame-call', cmd, 'nil', current_thread, frame) def swank_frame_source_loc(frame): cmd = '(swank:frame-source-location ' + frame + ')' - swank_rex(':frame-source-location', cmd, 'nil', current_thread) + swank_rex(':frame-source-location', cmd, 'nil', current_thread, frame) def swank_frame_locals(frame): cmd = '(swank:frame-locals-and-catch-tags ' + frame + ')' - swank_rex(':frame-locals-and-catch-tags', cmd, 'nil', current_thread) + swank_rex(':frame-locals-and-catch-tags', cmd, 'nil', current_thread, frame) def swank_set_package(pkg): cmd = '(swank:set-package "' + pkg + '")' @@ -867,18 +895,18 @@ def swank_inspect(symbol): def swank_inspect_nth_part(n): cmd = '(swank:inspect-nth-part ' + str(n) + ')' - swank_rex(':inspect-nth-part', cmd, 'nil', 't') + swank_rex(':inspect-nth-part', cmd, 'nil', 't', str(n)) def swank_inspector_nth_action(n): cmd = '(swank:inspector-call-nth-action ' + str(n) + ')' - swank_rex(':inspector-call-nth-action', cmd, 'nil', 't') + swank_rex(':inspector-call-nth-action', cmd, 'nil', 't', str(n)) def swank_inspector_pop(): swank_rex(':inspector-pop', '(swank:inspector-pop)', 'nil', 't') def swank_inspect_in_frame(symbol, n): cmd = '(swank:inspect-in-frame "' + symbol + '" ' + str(n) + ')' - swank_rex(':inspect-in-frame', cmd, get_swank_package(), current_thread) + swank_rex(':inspect-in-frame', cmd, get_swank_package(), current_thread, str(n)) def swank_quit_inspector(): swank_rex(':quit-inspector', '(swank:quit-inspector)', 'nil', 't') @@ -957,11 +985,11 @@ def swank_list_threads(): def swank_kill_thread(index): cmd = '(swank:kill-nth-thread ' + str(index) + ')' - swank_rex(':kill-thread', cmd, get_package(), 't') + swank_rex(':kill-thread', cmd, get_package(), 't', str(index)) def swank_debug_thread(index): cmd = '(swank:debug-nth-thread ' + str(index) + ')' - swank_rex(':debug-thread', cmd, get_package(), 't') + swank_rex(':debug-thread', cmd, get_package(), 't', str(index)) ############################################################################### # Generic SWANK connection handling