fitness fitness log misc vim mode

Welcome to my blog. Have a look at the most recent posts below, or browse the tag cloud on the right. An archive of all posts is also available.

I do not play the piano and know nothing about prostate health. You may be looking for one of these.

Last post on this blog. My new(est) blog (as of June 2009) is here.

Posted Fri 19 Jun 2009 07:38:15 AM EDT

"McDonald's Happy Meals In San Francisco To Include Gay Marriage License"

A quick search finds that the spam leads to a virus installer masquerading as a video codec. Those wacky spammers!

Posted Wed 23 Jul 2008 02:49:15 PM EDT Tags: misc

I reimaged the machine that serves yesterday (7/20/08). I've restored most of it, but if you're missing the darcs repositories, email me.

Posted Mon 21 Jul 2008 08:33:17 AM EDT Tags: misc

v8 of lw-vim-mode has been posted to

Download: darcs get

For further announcements, please subscribe to the lw-vim-mode-announce mailing list.

Posted Fri 13 Jun 2008 08:17:00 AM EDT Tags: vim mode

I mirror some subtrees from the work server and edit files locally. (I write them back using this.) The base directory I mirror these subtrees into is 30 characters long, and the remote path can also be pretty long, which leaves me with some awfully long pathnames in the buffer-list panel. zsh has a facility where you can name a directory, and then it refers to those directories by name from then on. A sort-of real-life example:

~lmc > deployments=/home/lmc/work/xxx/xxxxxx/xxx/home/clappl/xxxxxx/xxxxxxxxxxxxxxxxxxxxxxxxxx/deployments
~lmc > cd ~deployments
~deployments > _

(And, of course, ~deployments has more stuff under it.)

So I wanted something like that for the Lispworks buffer list. After some poking at the Lispworks Window Browser, and the Inspecter, and various other tools, I came up with something that seems to work.

There are two basic tricks.

The buffer list is a standard multi-column-list-panel. This kind of panel will display lists of anything, as long as you give it a function to turn whatever it is, into a string. By default, the Editor buffer-list uses princ-to-string to turn the pathname of the file into a string. I installed my own print function that does the mangling I wanted. That's the first trick.

The second trick is getting a reference to the Editor object, after it's fully initialized (e.g. putting an :after method on initialize-instance of a lispworks-tools:editor object is too soon), so that you can perform the first trick. For that, I installed some :after advice on capi:display, so I can look at every top-level window that the IDE creates, and if it's an Editor window, I install the print functions as above.

Surprisingly, I do all this using only one undocumented function and one non-external slot, and they're both in a single function. Everything else was "above board", so to speak.

So anyway, here's the code.

Update 1, 6/5/08: It occurs to me (only now, of course, that I've completely implemented it, and even blogged about it) that perhaps logical pathnames would do the trick. I'll have to look at that. Oh well. :) It was fun, anyway.

Update 2, 6/6/08: And with just a few more undocumented functions, I've set the default sort in a buffer-list to be by pathname. LW is cool. :) (But see also update 4, below.)

Update 3, 6/8/08: Usage examples & screenshot (after all the other updates):

(add-translation "/home/lmc" "~lmc")
(add-translation "/home/lmc/lisp" "~lisp")
(add-translation "/home/lmc/lisp/lw-vim-mode" "~lw-vim-mode")
(add-translation "/home/lmc/" "~blog")

Update 4, 6/10/08: Change setting the default sort to use only documented, exported functions, to wit:

(capi:sorted-object-sort-by buffers-list :pathname)


Posted Thu 05 Jun 2008 11:58:15 PM EDT Tags: lisp

I got approved for a project at I haven't uploaded my source tree yet, but I have done a tarball.

Also, there are two mailing lists (one for developers and one for announcements), and even a wiki and bug tracking page (which I can't currently log in to; I've emailed the admin about that).

Update 30 May 2008: Gary King fixed it (trac) on Memorial Day and dropped me an email. Thanks, Gary! Also, I uploaded a source tree and put it under darcs. See here.

Posted Thu 22 May 2008 10:40:45 PM EDT Tags: vim mode

I got no replies (so far) or emails about my announcement yesterday, but I got a lot of hits on the website. I'm going to look on the bright side and hope that people are interested and not pointing and laughing and/or shaking their heads in disbelief. :)

So I requested a project at with darcs and trac and mailing lists and everything. More updates as events warrant.

Posted Tue 20 May 2008 08:23:17 AM EDT Tags: vim mode

I've written a partial vi-mode for the Lispworks editor.


Why did I publicize it?

Beyond a certain point, working in a vacuum sucks. I'd like to know if anyone else is interested in it.

If nobody is, I'll keep working on it at my current widely variable pace, for my own edification and instruction. But if other people want to use it too, then I'll do all the usual stuff for an Open Source software project, like make my Wiki actually editable by others, create a mailing list, use an actual distributed revision control system instead of RCS on my local box, that sort of thing.

Doing all that takes a certain amount of time, work, and effort, though, and if all I hear is crickets, then I won't bother. :)

Why did I write it?

Mostly 'cause I like the vi input model and because I've used it for circa 18 years.

Other reasons, in varying degrees of usefulness:





ASDF / ASDF-install?

No, just a load file at the moment. Not even a Lispworks project file. See the documentation link above.




You're looking at it. See also here.

Mailing lists?

None yet. If and only if people are interested, I'll set one up here or get a project page at For now, post in the forum [update: disabled], reply to the thread on c.l.l, email me at larry at theclapp dot org, or start something on In particular, please do not discuss this on the Lispworks HUG mailing list.

Prominently missing features

  • Visual mode
  • Ex mode
  • registers
  • yank / put
  • Syntax highlighting (except for Lisp, of course)
  • folding

I'm most interested in "visual mode", but that requires an Ex mode to do much of anything useful with, and marks and registers too, so it'll have to wait.

Of course the Emacs emulation has a kind of visual mode, and registers, and yank/put, and lots of other stuff, I just haven't wired in the vi-ish analogs.

In part I posted everywhere about it to find out what people would want next.

"What the heck are you talking about?"

If the first you're hearing about this is via a subscription to my blog, I published a very brief notice on the Lispworks HUG and slim-vim mailing lists, and also on comp.lang.lisp and comp.editors.

Posted Mon 19 May 2008 09:07:35 AM EDT Tags: vim mode

lw-vim-mode v7 posted here. Changelog:

v7, 5/19/2008

General changes:

  • Works with LW 5.1. May not work any more with 5.0, haven't tried it.
  • Make Escape work like it should. As a necessary side effect, the use of Escape for "Meta" changes to Ctrl-Escape, and the change is global to the running image, whether a buffer is in a Vim mode or not. Ctrl-[ still works, though.
  • Put all code in the :vim package instead of the :editor package. Did a brute-force wrapper of most of the editor functions I use. Partly this was to prepare for wrapping these commands for use of Kenny Tilton's Cells library.
  • You can now . after an insert or append.
  • Counts on . work better now, maybe even correctly.
  • New macro: def-start-insert, used for i, I, a, and anything else that starts an insert.

Mappings changed:

  • Function formerly bound to p now bound to P, since it puts the cut text in front of the current line.
  • J now joins with the next line instead of the previous line.

Mappings added:

  • Esc in insert mode
  • | -- move to column
  • P -- Put cut text above the current line
  • C-y/C-e
  • n/N -- repeat most recent search, forward / backwards
  • ,l -- evaluate code in Listener

Not much to show for 2.5 months work, but on the other hand most of it was actually in the last few weeks. :)

Posted Mon 19 May 2008 08:26:44 AM EDT Tags: vim mode

Got a shiny new system with 4 GB ram. I haven't installed too much on it yet, so /usr only has a gig or so in it, but it's cool to be able to cache all of it.

% time du -s /usr  
1055912 /usr
du -D -s /usr  0.08s user 0.72s system 4% cpu 19.991 total

% time du -s /usr
1055912 /usr
du -D -s /usr  0.06s user 0.11s system 97% cpu 0.172 total

% free
             total       used       free     shared    buffers     cached
Mem:       3632284     205500    3426784          0      32976      67444
-/+ buffers/cache:     105080    3527204
Swap:      2650684          0    2650684

% time find /usr -type f 2> /dev/null | xargs cat > /dev/null 2>&1
find /usr -type f 2> /dev/null  0.04s user 0.10s system 0% cpu 2:11.43 total
xargs cat > /dev/null 2>&1  0.22s user 4.65s system 3% cpu 2:25.38 total

% free
             total       used       free     shared    buffers     cached
Mem:       3632284    1196660    2435624          0      45052    1041212
-/+ buffers/cache:     110396    3521888
Swap:      2650684          0    2650684

% time find /usr -type f 2> /dev/null | xargs cat > /dev/null 2>&1
find /usr -type f 2> /dev/null  0.04s user 0.10s system 18% cpu 0.766 total
xargs cat > /dev/null 2>&1  0.15s user 0.69s system 98% cpu 0.847 total

"What does this mean?", you ask. It means that whatever fraction of time I used to have to wait for a program to load its code from disk, I now have to wait less than one one-hundredth of that while it loads its code from memory.

Posted Thu 15 May 2008 03:41:15 PM EDT Tags: misc

This blog is powered by ikiwiki.