[slim-vim] first try, some issues

Larry Clapp larry at theclapp.org
Mon Jul 24 07:20:04 CDT 2006


On Sun, Jul 23, 2006 at 08:56:12PM -0700, Brad Beveridge wrote:
> > I would like to see a couple minor usability enhancements.
> They all sound reasonable, more comments inline below.

I have a patch for several of these, but I saw that you did one of
them, so I pulled it, and now I have some design questions.

> >   - Allow sourcing ecl-slime.vim from anywhere.

Patch in hand.

> >   - Make the ecl-slime mappings local to their buffer, and only for
> >     Lisp buffers.  If you write a Vim function to do the mappings, I
> >     can show you how to write Vim autocommands to automatically call
> >     the function when editing any *.lisp file.

Patch in hand.

> >   - Make slim-vim code do nothing if you haven't connected to Swank
> >     yet.

I saw that you fixed this yourself, but I'd like to discuss a
different approach.

You wrapped each mapping in a call to VIM-SLIME::TEST-CONNECTED.

  before:
    nmap <Leader>x :ecl (vim-slime::slime-eval-defun)<CR>
  after:
    nmap <Leader>x :ecl (vim-slime::test-connected #'vim-slime::slime-eval-defun)<CR>

Which means that you have calls to it all over ecl-slime.vim, *and* it
means that you *still* shouldn't call the "naked" Slime functions
unless you know you have a connection.

I would remedy both of these points by wrapping all the map target
functions in (when (slime::slime-connected-p) ...).

<leader>x reverts to

  nmap <Leader>x :ecl (vim-slime::slime-eval-defun)<CR>

and slime-eval-defun (for example) becomes

 (defun slime-eval-defun ()
  (when (slime::slime-connected-p)
   ...
   ))

We'd do this several times; we should consider writing a
def-toplevel-command macro for it, along the lines of

  (defmacro def-toplevel-command (name args &body body)
    `(defun ,name ,args
	(when (slime:slime-connected-p)
	  , at body)))

The macro is just icing, but what do you think of the rest?

(I can certainly make these changes myself and send you a patch, but
slim-vim has been your baby so far, and I thought that would be rude.)

> >   - Implement a graceful disconnect & shutdown on Vim exit, or socket
> >     disconnect.
> Any ideas on how I could hook the :q :wq style commands?  I'm sure I
> can do it with an explicit disconnect function.  Everything else
> ought to be fine, though I imagine some environment var will be
> required.

Patch in hand for part of this; it doesn't deal with the remote Lisp
closing the socket yet.  See :help VimLeave.

> >   - Implement a pseudo-repl buffer, like ecl-repl has, that prints
> >     what you've done and what it returns.
> Good idea, any objections to making all the regular console output
> also go to this buffer?

No.

-- Larry



More information about the slim-vim mailing list