You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to vimcl...@googlegroups.com
Hi,
Often when testing or working with multi-methods, I want to completely
obliterate a namespace and start from scratch. So I added this to my
.vim/after/ftplugin/clojure.vim:
function! s:ResetNamespace()
let ns = foreplay#ns()
" switch to neutral ground, kill the ns, switch back to the ns.
let cmd = "(in-ns 'clojure.core)(remove-ns '" . ns . ")(ns " . ns . ")"
echo cmd
try
call foreplay#eval(cmd)
catch /^Clojure:.*/
return ''
endtry
endfunction
" Command that brutally guts a namespace.
command! -buffer -bar ResetNamespace :call s:ResetNamespace()
It leaves the ns empty so you'll have to re-require.
Anyway, I've found it very useful, so I thought I'd share and solicit
feedback, especially on the lame VimL cribbed from foreplay.
Cheers,
Dave
Meikel Brandmeyer
unread,
Jan 14, 2013, 2:58:44 AM1/14/13
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to vimcl...@googlegroups.com
Hi,
you might want to use in-ns instead of ns to switch back. Using ns sets up all reference to clojure.core which will lead to trouble in case you want special treatment there:
(ns foo.bar
(:refer-clojure :exclude (==)))
Meikel
Meikel Brandmeyer
unread,
Jan 14, 2013, 2:59:18 AM1/14/13
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to vimcl...@googlegroups.com
As a rule of thumb: ns is not about namespace switching.
Meikel
Dave Ray
unread,
Jan 14, 2013, 10:41:14 AM1/14/13
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to vimcl...@googlegroups.com
Thanks Meikel. Good point. I try to avoid needing :refer-clojure if I
can help it so I don't think about it much :)
On Sun, Jan 13, 2013 at 11:59 PM, Meikel Brandmeyer <m...@kotka.de> wrote:
> As a rule of thumb: ns is not about namespace switching.
>
> Meikel
>