Chimp Patch - MacroExpand command

2008-10-28 Thread J. McConnell

For anyone using Meikel Brandmeyer's Chimp plugin for Vim, below is a
patch that adds a MacroExpand command, which sends a (macroexpand-1
...) for the inner s-expr. Hope someone finds it useful.

- J.

Index: chimp.vim
===
--- chimp.vim   (revision 3)
+++ chimp.vim   (working copy)
@@ -2,7 +2,7 @@
 -
  Copyright 2008 (c) Meikel Brandmeyer.
  All rights reserved.
-
+
  Permission is hereby granted, free of charge, to any person obtaining a copy
  of this software and associated documentation files (the Software), to deal
  in the Software without restriction, including without limitation the rights
@@ -219,6 +219,19 @@

call chimp#SendMessage(s:ChimpId, '(println *e) (. *e printStackTrace)')
 endfunction
+
+function! s:SendMacroExpand() dict
+   call s:Connect()
+   call s:ChangeNamespaceIfNecessary()
+
+  call chimp#SendMessage(s:ChimpId, (macroexpand-1 ')
+   call s:WithSavedPosition({'f': function(s:SendSexp),
'flags': self.flags})
+  call chimp#SendMessage(s:ChimpId, ))
+endfunction
+
+function! s:MacroExpand()
+   call s:WithSavedPosition({'f': function(s:SendMacroExpand),
'flags': ''})
+endfunction
  [ }}} ]
 ## [ }}} ]

@@ -234,6 +247,7 @@
call s:MakePlug('n', 'LookupDoc', 'LookupDoc()')
call s:MakePlug('n', 'FindDoc', 'FindDoc()')
call s:MakePlug('n', 'PrintException', 'PrintException()')
+   call s:MakePlug('n', 'MacroExpand', 'MacroExpand()')

call s:MapPlug('v', 'eb', 'EvalBlock')
call s:MapPlug('n', 'es', 'EvalInnerSexp')
@@ -245,6 +259,7 @@
call s:MapPlug('n', 'ld', 'LookupDoc')
call s:MapPlug('n', 'fd', 'FindDoc')
call s:MapPlug('n', 'pe', 'PrintException')
+   call s:MapPlug('n', 'me', 'MacroExpand')
 endif
 ## [ }}} ]

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Clojure group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: Chimp Patch - MacroExpand command

2008-10-28 Thread mb

Hi,

On 28 Okt., 19:52, J. McConnell [EMAIL PROTECTED] wrote:
 For anyone using Meikel Brandmeyer's Chimp plugin for Vim, below is a
 patch that adds a MacroExpand command, which sends a (macroexpand-1
 ...) for the inner s-expr. Hope someone finds it useful.

Thank you for the patch. I added \me for macroexpand and
\m1 for macroexpand-1. Changes are in the mercurial repository.

  http://kotka.de/repositories/hg/chimp

Sincerely
Meikel
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Clojure group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: Chimp Patch - MacroExpand command

2008-10-28 Thread J. McConnell

On Tue, Oct 28, 2008 at 4:44 PM, mb [EMAIL PROTECTED] wrote:

 I added \me for macroexpand and \m1 for macroexpand-1.

Great, thanks Meikel!

- J.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Clojure group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---