[slim-vim] Problem with :ecl in Vim-7.x
Larry Clapp
larry at theclapp.org
Tue Jun 3 08:36:24 CDT 2008
On Tue, Jun 03, 2008 at 02:25:44PM +0200, Mikael Jansson wrote:
> Larry Clapp wrote:
> > I meant, you capture the string by binding *standard-output* to a
> > string-stream, and then you print the string via Vim's msg()
> > function (or whatever it's called -- echo(), maybe?).
> >
> Got it!
>
> ==========
> $ cat /tmp/foo.ecl
> ecl << EOF
> (let* ((s (make-string-output-stream))
> (*standard-output* s))
>
> (format t "Buffers: ~{~A~^, ~}"
> (mapcar (lambda (buffer) (vim:buffer-name :buffer buffer))
> (vim:buffers)))
>
> (vim:msg (get-output-stream-string s)))
> EOF
Check out with-output-to-string for a slightly easier way to do this.
> $ vim
> :source /tmp/foo.ecl
> <ee>
> Buffers: NIL
> ==========
>
> Second time I :source /tmp/foo.ecl, I don't get the <ee>, though.
> Any ideas there?
First, just what I've said before: make sure you've loaded if_ecl.lisp
before doing any ecl commands. Your best bet is to do it in your
.vimrc.
Second, I'd guess that somewhere you or ECL or Vim isn't
null-terminating a string, or aren't passing the right length, or
something like that.
Also, the neat thing about Lisp in Vim, and the way most of the core
functions are defined, is that you can redefine vim:msg to, for
example, save its input to a stack for later perusal. Don't be afraid
to scatter printfs or formats everywhere to try to get a handle on the
flow of control.
> To change the topic slightly: I might try to add if_ecl.* (and not
> the network/asynch patches) into the official Vim tree.
Cool.
> Would any of the original authors object? Tried getting hold of
> Eirik, but no response to the ntnu.no address I used. (I hope at
> least some of the others are lurking here on the list still).
No objection from me.
-- L
More information about the slim-vim
mailing list