theclapp

Search theclapp.blog-city.com

 

Latest Entries

blog moving; lw-vim-mode update

Saturday, 29-Dec-2007 2:42 A GMT-04
All future blogging will be done at my own domain on my own server using my own editor and ikiwiki. Please see http://theclapp.org/blog. I've written a one-off translator that takes the blog posts here and translates them to ikiwiki format. Unfortunately it leaves them in alphabetical order, all with the same timestamp. So once I get that sorted I'll put all the stuff that's here over there, and then not worry about this blog any more.

lw-vim-mode v5 posted; see http://theclapp.org/blog/posts/lw-vim-mode_v5_posted/.

Category: Rambling Lisp

Lispworks as a shell script, minor tweaks

Tuesday, 11-Dec-2007 11:17 A GMT-04
Updates to this entry. This version allows use of compiled files, and starts a listener (aka a REPL) if you run it standalone with no arguments.

Save the image. Don't use DELIVER, I want a full image with the GUI environment and the compiler and everything.

Usage:

lispworks-5-0-0-x86-linux -siteinit - -init save-image-shell-app.lisp

; save-image-shell-app.lisp
(load-all-patches)

; Load ASDF
(load "/my/path/to/asdf")
(setf asdf:*central-registry*
(append asdf:*central-registry*
(list "/my/home/lisp/systems/")))

(toggle-source-debugging t)

(setf hcl:*load-fasl-or-lisp-file* :load-newer-no-warn)

(load "~/lisp/shell-app")
(setf lw:*init-file-name* "~/.lw-console") ; use this instead of ~/.lispworks
(sys:define-top-loop-command :q () (quit)) ; use :q at the repl (if any) to quit
(save-image "~/bin/lw-console"
:restart-function #'shell-app-main
:environment nil
:multiprocessing t
:clean-down t)
(quit)

And the loaded code:

; shell-app.lisp

(in-package :cl-user)

(defvar *argv* nil)

;;; main function after save
(defun shell-app-main ()
(if (cdr sys:*line-arguments-list*)
(let* ((*argv* (cdr sys:*line-arguments-list*))
(shell-file (first *argv*)))
;; read the shell file
(read-shell-file shell-file)
(quit))
; if no cmd-line args, start a listener
(start-tty-listener)))

(defun read-shell-file (name)
(let ((compiled-version (probe-file (merge-pathnames (make-pathname :type "ufasl") name))))
(if compiled-version
(load compiled-version)
(with-open-file (shell-stream name :direction :input)
;; discard 1st line (the #!)
(read-line shell-stream)
;; load rest of file and run it
(load shell-stream)))))

;;; ensure that load is quiet
(setf *load-verbose* nil)
; (setf sys::*demand-load-verbose* nil) ; optional

tags:      
Category: Lisp

vim-mode update, 12/6/07

Thursday, 6-Dec-2007 1:38 P GMT-04
Updated my Wouldn't It Be Nice If list, here.

tags:  

Editing locally, saving remotely: Lispworks editor backed by rsync

Sunday, 2-Dec-2007 7:59 P GMT-04
I've written before about wanting to edit files locally but have changes propogated quickly to a remote server. A couple weeks back I put together a fairly general solution:
  • Mirror sub-trees "of interest" with a stand-alone script; run it every morning (or as often as seems appropriate)
  • Put a hook into Lispworks's "save file" code so that after you save, if the file comes from one of those "of interest" trees, use rsync to copy the changes remotely.
The mirror script is called update-mirrors (though for some reason Blog-City insists on removing dashes from the names of files I upload, so the URI is actually .../updatemirrors. :( ). The code to hook Lispworks's "save file" code is here (though again I call it "lw-rsync.lisp").

Hmm, I realize now that update-mirrors uses a small shell script ("drs") I wrote to make rsync look a little more like scp, provide a couple of default options, etc. So you can edit update-mirrors to call rsync directly (or email me and I will), or write your own "drs" script. (Given that my drs script is quite specific to my needs, and has the names of my employer and some servers in it, I'd just as soon not fiddle with it unless somebody actually wants it. It's fun shouting into the void and all, but unless somebody actually wants to use the fruits of my labor I see no reason to bother. :)

vim-mode update, 12/2/07

Sunday, 2-Dec-2007 7:15 P GMT-04
Uploaded v3 of the code here. Documentation updated on the wiki in the usual place. Most changes are internal, though d{motion} is beginning to work better (that is, at all).

tags:      
Category: Lisp