# HG changeset patch # User Steve Losh # Date 1503072746 14400 # Node ID 221dd87c701b362901ec27c6e6915e281598141d # Parent 4acbaf543177b3ea1452c0242cffa1381ede6c01 Remove ooze, bencode diff -r 4acbaf543177 -r 221dd87c701b .hgsub --- a/.hgsub Fri Aug 18 12:10:38 2017 -0400 +++ b/.hgsub Fri Aug 18 12:12:26 2017 -0400 @@ -2,7 +2,6 @@ mercurial/templates = [hg]https://bitbucket.org/sjl/mercurial-cli-templates vim/bundle/ack = [git]git://github.com/mileszs/ack.vim.git vim/bundle/badwolf = [hg]https://bitbucket.org/sjl/badwolf/ -vim/bundle/bencode = [hg]https://bitbucket.org/sjl/vim-bencode/ vim/bundle/clam = [hg]https://bitbucket.org/sjl/clam.vim/ vim/bundle/clojure-static = [git]git://github.com/guns/vim-clojure-static.git vim/bundle/commentary = [git]git://github.com/tpope/vim-commentary.git diff -r 4acbaf543177 -r 221dd87c701b .hgsubstate --- a/.hgsubstate Fri Aug 18 12:10:38 2017 -0400 +++ b/.hgsubstate Fri Aug 18 12:12:26 2017 -0400 @@ -2,7 +2,6 @@ 1fc4a9fbead7e0acc4c828b346f3be2658ec3df9 mercurial/templates f183a345a0c10caed7684d07dabae33e007c7590 vim/bundle/ack 451b8111344a3a8117996f4e32b6a255b629f87b vim/bundle/badwolf -2975b6f50397cc4912f04e3986906eca8fa441e7 vim/bundle/bencode a4d79fc208764917cb58e2aed6fbaeb5e3356d33 vim/bundle/clam f1c53e290b16885c2eb3fc96e57d9984b627f735 vim/bundle/clojure-static dc349bb7d30f713d770fc1fa0fe209e6aab82dc8 vim/bundle/commentary diff -r 4acbaf543177 -r 221dd87c701b vim/bundle/ooze/plugin/ooze.vim --- a/vim/bundle/ooze/plugin/ooze.vim Fri Aug 18 12:10:38 2017 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,434 +0,0 @@ -" TODO: -" fix showmode awfulness -" Disassembly mapping -" error handling -" multi-packet messages -" -if !exists("g:ooze_connection") - let g:ooze_connection = 0 -endif - -let s:pending = '' - -function! s:IsString(a) " {{{ - return type(a:a) == 1 -endfunction " }}} - -function! s:GetString(msg, key, extra) " {{{ - let val = get(a:msg, a:key) - if s:IsString(val) - return val . a:extra - else - return '' - endif -endfunction " }}} - -let g:ooze_scratch_buffer_name = '__OozeScratch__' -let g:ooze_traceback_buffer_name = '__OozeTraceback__' - -function! s:OpenOrGotoBuffer(name) " {{{ - let existing_buffer = bufnr(a:name) - - if existing_buffer == -1 - " The buffer doesn't exist at all. - " Split and edit. - wincmd s - execute "edit " . a:name - else - " The buffer exists, now we look for a window. - let existing_window = bufwinnr(existing_buffer) - - if existing_window == -1 - " The window doesn't exist. Split and show the (existing) buffer. - execute "split +buffer" . existing_buffer - else - " The window exists. Are we already in it? - let current_window = winnr() - - if current_window != existing_window - " We're not in it. Jump to it. - execute existing_window . "wincmd w" - else - " We're already where we need to be. Noop. - endif - endif - endif -endfunction " }}} -function! s:OpenOozeScratch(contents) " {{{ - if bufname('%') != g:ooze_scratch_buffer_name - " Preserve the current window's package (lame hack) - if exists("b:ooze_buffer_package") - let package = b:ooze_buffer_package - else - let package = "" - endif - - call s:OpenOrGotoBuffer(g:ooze_scratch_buffer_name) - - if package != "" - let b:ooze_buffer_package = package - endif - endif - - set filetype=lisp - setlocal foldlevel=99 - setlocal buftype=nofile - setlocal bufhidden=hide - setlocal noswapfile - setlocal buflisted - - " setlocal noreadonly - normal! gg"_dG - call append(0, a:contents) - normal! gg=G - " setlocal readonly -endfunction " }}} -function! s:DumpTraceback(frames) " {{{ - let current = bufnr('%') - let bn = bufnr(g:ooze_traceback_buffer_name) - - if bn == -1 - execute "edit " . g:ooze_traceback_buffer_name - setlocal buftype=nofile - setlocal bufhidden=hide - setlocal noswapfile - setlocal buflisted - else - execute "buffer " . bn - endif - - normal! gg"_dG - - for frame in a:frames - let call_form = frame[0] - let file = frame[1] - let line = frame[2] - - call append(line('$'), call_form . "\t" . file . "\t" . line) - endfor - normal! gg"_dd - set errorformat=%m\ %f\ %l,%m\ %f\ - execute "cbuffer" - - execute "buffer " . current - - return 1 -endfunction " }}} - -function! s:HandleMacroexpand(msg) " {{{ - let moutput = s:GetString(a:msg, 'macroexpand-1', "") - call s:OpenOozeScratch(split(moutput, "\n")) -endfunction " }}} -function! s:HandleStackTrace(msg) " {{{ - call s:DumpTraceback(get(a:msg, 'stack-trace')) - - let output = '' - - let output .= s:GetString(a:msg, 'error', "\n\n") - let output .= s:GetString(a:msg, 'original', "\n\n") - - if output != '' - echo substitute(output, '\n\+$', '', '') - endif - - copen -endfunction " }}} - -function! s:HandleMessage(msg) " {{{ - if has_key(a:msg, 'macroexpand-1') - return s:HandleMacroexpand(a:msg) - endif - if has_key(a:msg, 'stack-trace') - return s:HandleStackTrace(a:msg) - endif - - let output = '' - let output .= s:GetString(a:msg, 'stdout', "") - let output .= s:GetString(a:msg, 'stderr', "") - let output .= s:GetString(a:msg, 'value', "") - - let output .= s:GetString(a:msg, 'function-arglist', "\n\n") - let output .= s:GetString(a:msg, 'function-docstring', "\n") - if output != '' - echo substitute(output, '\n\+$', '', '') - endif -endfunction " }}} - -function! s:HandleData(data) " {{{ - let s:pending .= a:data - - try - let messages = bencode#BdecodeAll(s:pending) - catch /bencode.*truncated/ - return - endtry - - let s:pending = '' - - for msg in messages - call s:HandleMessage(msg) - endfor -endfunction " }}} - -" NeoVim job-handling {{{ - -silent! function s:JobHandler(job_id, data, event) " {{{ - if a:event == 'stdout' - call s:HandleData(join(a:data, "\n")) - elseif a:event == 'stderr' - 1 - else - 1 - endif -endfunction " }}} - -let s:callbacks = { -\ 'on_stdout': function('s:JobHandler'), -\ 'on_stderr': function('s:JobHandler'), -\ 'on_exit': function('s:JobHandler') -\ } - -function! OozeSendMessage(msg) - if !g:ooze_connection - throw "Not connected!" - endif - try - call jobsend(g:ooze_connection, bencode#Bencode(a:msg)) - catch /E900/ - echo "Ooze connection died!" - let g:ooze_connection = 0 - endtry -endfunction! - -" }}} - -function! s:FindPackage() " {{{ - if !exists("b:ooze_buffer_package") - let view = winsaveview() - - let result = "" - call cursor(1, 1) - if search('\v^\(in-package>\s*(\n\s*)?\k', 'c', 40) - normal! W - execute "normal v\(sexp_inner_element)" - let old_z = @z - normal! "zy - let result = @z - let b:ooze_buffer_package = result - let @z = old_z - endif - - call winrestview(view) - return result - else - return b:ooze_buffer_package - endif - - return "" -endfunction " }}} - -function! OozeDisconnect() " {{{ - if g:ooze_connection - call jobstop(g:ooze_connection) - let g:ooze_connection = 0 - endif -endfunction " }}} -function! OozeConnectToPort(port) " {{{ - if g:ooze_connection - call OozeDisconnect() - endif - let g:ooze_connection = jobstart(['nc', 'localhost', a:port], s:callbacks) -endfunction " }}} -function! OozeConnect() " {{{ - call OozeConnectToPort('8675') -endfunction " }}} - -function! OozeMacroexpand(form) " {{{ - let msg = {"op": "macroexpand", "form": a:form} - - let package = s:FindPackage() - if package != "" - let msg["in-package"] = package - endif - - call OozeSendMessage(msg) -endfunction " }}} -function! OozeMacroexpandSelection() " {{{ - let z = @z - normal! gv"zy - call OozeMacroexpand(@z) - let @z = z -endfunction " }}} - -function! OozeDocument(symbol) " {{{ - let msg = {"op": "documentation", "symbol": a:symbol} - - let package = s:FindPackage() - if package != "" - let msg["in-package"] = package - endif - - call OozeSendMessage(msg) -endfunction " }}} -function! OozeDocumentSelection() " {{{ - let z = @z - normal! gv"zy - call OozeDocument(@z) - let @z = z -endfunction " }}} -function! OozeDocumentFormHead() " {{{ - let view = winsaveview() - execute "normal v\(sexp_inner_list)o\(sexp_inner_element)" - call OozeDocumentSelection() - call winrestview(view) -endfunction " }}} - -function! OozeArglist(symbol) " {{{ - if !g:ooze_connection - return - endif - let msg = {"op": "arglist", "symbol": a:symbol} - - let package = s:FindPackage() - if package != "" - let msg["in-package"] = package - endif - - set noshowmode - call OozeSendMessage(msg) -endfunction " }}} -function! OozeArglistSelection() " {{{ - let z = @z - normal! gv"zy - call OozeArglist(@z) - let @z = z -endfunction " }}} -function! OozeArglistFormHead() " {{{ - let view = winsaveview() - - let syntaxElement = synIDattr(synIDtrans(synID(line("."),col("."),1)),"name") - - if syntaxElement == "Comment" || syntaxElement == "String" - " bail if we're in a comment or string - " TODO: make this suck less - else - execute "normal v\(sexp_inner_list)o\(sexp_inner_element)" - call OozeArglistSelection() - endif - - call winrestview(view) -endfunction " }}} - -function! OozeEval(code) " {{{ - let msg = {"op": "eval", "code": a:code} - - let package = s:FindPackage() - if package != "" - let msg["in-package"] = package - endif - - call OozeSendMessage(msg) -endfunction " }}} -function! OozeEvalSelection() " {{{ - let z = @z - normal! gv"zy - call OozeEval(@z) - let @z = z -endfunction " }}} - -function! OozeLoad(path) " {{{ - let msg = {"op": "load-file", "path": a:path} - call OozeSendMessage(msg) -endfunction " }}} -function! OozeLoadCurrent() " {{{ - call OozeLoad(expand('%:p')) -endfunction " }}} - -function! OozeSelectTopLevelForm() " {{{ - execute "normal v\(sexp_outer_top_list)" -endfunction " }}} - -function! OozeHyperspec(symbol) " {{{ - vnew - call termopen('clhs ' . a:symbol) - normal! a -endfunction " }}} -function! OozeHyperspecForm() " {{{ - let view = winsaveview() - let z = @z - execute "normal v\(sexp_inner_element)o\(sexp_inner_element)" - normal! gv"zy - call OozeHyperspec(@z) - let @z = z - call winrestview(view) -endfunction " }}} - -function! OozeSpaceMap() " {{{ - if exists("b:ooze_vblock") || mode() == "R" - " Don't fuck with visual block mode or replace mode - return "\" - else - return "\\:\call OozeArglistFormHead()\a" - endif -endfunction " }}} -function! OozeTrackVblock() " {{{ - " end my life - let b:ooze_vblock = 1 - return "I" -endfunction " }}} -function! OozeUntrackVblock() " {{{ - " end my life - if exists("b:ooze_vblock") - unlet b:ooze_vblock - endif -endfunction " }}} - -function! OozeMapKeys() " {{{ - " [C]onnect and [K]ill - nnoremap C :call OozeConnect() - nnoremap K :call OozeDisconnect() - - " [h]yperspec - nnoremap h :call OozeHyperspecForm() - nnoremap H :call OozeHyperspec(input("? ")) - - " [e]val ([f]orm) - nnoremap E :call OozeEval(input("? ")) - vnoremap e :call OozeEvalSelection() - nnoremap e mz:call OozeSelectTopLevelForm():call OozeEvalSelection()`z - nnoremap f mzvab:call OozeEvalSelection()`z - - " [M]anual and [D]ocument - nnoremap D :call OozeDocument(input("? ")) - inoremap :call OozeDocumentFormHead() - nnoremap M mzviw:call OozeDocumentSelection()`z - - " [m]acroexpand - nnoremap M :call OozeMacroexpand(input("? ")) - nnoremap m mzvab:call OozeMacroexpandSelection()`z - - " [r]eload - nnoremap r :call OozeLoadCurrent() - - " magic arglist shit - inoremap OozeSpaceMap() - vnoremap I OozeTrackVblock() - augroup ooze_vblock - au! - autocmd InsertLeave call OozeUntrackVblock() - augroup END -endfunction " }}} - -augroup ooze_dev " {{{ - au! - autocmd BufWritePost ooze.vim source % -augroup END " }}} - -augroup ooze_showmode_save - au! - " We save showmode around insert mode because the arglist command needs - " to disable it. - au InsertEnter * :let g:ooze_save_showmode=&showmode - au InsertLeave * :let &showmode=g:ooze_save_showmode - au InsertLeave * :let &showmode=g:ooze_save_showmode -augroup END diff -r 4acbaf543177 -r 221dd87c701b vim/bundle/ooze/scratch.lisp --- a/vim/bundle/ooze/scratch.lisp Fri Aug 18 12:10:38 2017 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,5 +0,0 @@ -(ql:quickload "nrepl") - -(ql:quickload "optima") - -(ql:quickload 'beef)