[slimpl] some comments about vim internals
Jim Bailey
dgym.bailey at gmail.com
Mon Mar 6 10:54:19 CST 2006
On Mon, 6 Mar 2006 09:47:12 -0500
Larry Clapp <larry at theclapp.org> wrote:
<snip>
> Jim made it very easy to follow the code. For example, to find
> out what #'window-cursor does, start at the top and see that the
> VIM package exports the WINDOW-CURSOR symbol. Search forward to
> find that the WINDOW-CURSOR function does nothing but call
> WINDOW-CURSOR-INT. Search forward for WINDOW-CURSOR-INT to find
> that it's an ECL foreign function aliased to the C function
> cl_vim_window_cursor_int. Search backwards to find that
> cl_vim_window_cursor_int returns a cons of the cursor's line and
> column number. (Once you set Vim's "iskeyword" flag to include
> dashes (":set iskeyword+=-"), you can do most of this navigation
> with the # and * keys. I found the C definition of #'command in 7
> keystrokes (not counting shift keys). Or you could just trust the
> naming scheme and search directly for "cl_vim_command_int" -- and
> you'd be right. My point is, it's easy. Thanks, Jim!)
I hope I made it a little easier than that, although it is kind of hard
to see the lisp strings in c strings so its easy to miss. When you
search for "window-cursor" the first found is indeed in the
(:export ...) and the second is the function written in lisp, and that
is where I did something very unusal for me and put a lisp function
documentation string saying:
"returns the cursor of a window (defaults to (current-window))
cursors are (lnum . col) cons cells".
I made sure every C callback was _int, and had a wrapper written in
lisp so it was easy to write and locate the documentation strings, and
they are available to lisp.
Of course non of that is any excuse for me not learning how to write
vim help pages and finishing the job off properly!
More information about the slimpl
mailing list