December 28, 2004
Christmas, Lisp Work and SLIME

Lori and I spent Christmas weekend relaxing in Las Vegas and hanging out with family, and I got quite a bit of hacking done. LispWorks was used, and since I am now a SLIME-based lifeform, that meant trying Bill Clementson's and Kevin Birch's AppleScript-style SLIME enabler.

I had to modify the AppleScript as posted on Bill's weblog in three minor ways to get it to work reliably:

  1. The keystroke "(load "~/.slime.lisp")" line is missing backslashes to escape the double quotes, it should be keystroke "(load \"~/.slime.lisp\")".
  2. My .emacs contains (setq mac-command-key-is-meta nil) so I can use command-c/command-x/command-v in the only ways that my finger ganglia know how: as copy/cut/paste commands. This seemed to screw up the keystroke "x" using {command down} line, so instead I use key code 53 (which is equivalent to hitting the esc key) followed by keystroke "x".
  3. After starting LispWorks, I inserted a two second pause before telling emacs to connect via SLIME. I was getting intermittent connection refused errors that the short pause seemed to resolve.

The complete script: lw-start.applescript.

Posted by jjwiseman at December 28, 2004 12:51 PM

I meant to mention to Bill about escaping the quotes, but I had already asked him to make two other changes, so I didn't want to be a pest about it. As for the meta key, you could have also used "using {option down}", since I belive that if you aren't using command-as-meta, it defaults to the option/alt key next door.

You must have a lot more RAM than me, my 12" G4 wasn't able to switch between LispWorks and Emacs before LW had finished loading SLIME :-).

FYI, you don't need to shell out to pause an AppleScript, the Standard Additions component provides a "delay <n>" command to sleep for n seconds.

I want to point out to anyone that may be using this that nothing will work until you enable the accesability framework as described in Apple's overview of GUI scripting:

Posted by: Kevin Birch on December 28, 2004 11:19 PM

Hi John,

Thanks for picking up the problems with the script. I had escaped the quotes in the AppleScript but had neglected to double-escape them when I pasted them into the blog entry. Also, I had a pause in between starting LW and emacs in the original win32 script but didn't seem to need it in the Mac version. Depending on your processor speed, this may or may not be necessry. I'll make a note of your comments in my original posting and link back to your post.

Thanks again,

Posted by: Bill Clementson on December 29, 2004 04:57 AM
Post a comment

Email Address:


Unless you answer this question, your comment will be classified as spam and will not be posted.
(I'll give you a hint: the answer is “lisp”.)


Remember info?