reattatchabe slime
Here is a little makedef file to start/stop a lisp application and allow the developer to attach to the running process with attachtty or slime.

For a new application you create a new Makefile, define LISP_DIR and LISP_APP and then include this makedef file. You can then use the following targets with your application: start, stop, restart, attach, slime, dribble and log.

makedef

# -*- makefile -*-
### User needs to define the lisp working directory
#LISP_DIR=${HOME}/lisp/website
### ...and lisp application
#LISP_APP=server.lisp

######################################################################
DETACHTTY_EXE=/usr/bin/detachtty
ATTACHTTY_EXE=/usr/bin/attachtty
RUNTIME_DIR=${LISP_DIR}/.runtime
DRIBBLE_FILE=${RUNTIME_DIR}/${LISP_APP}.dribble
LOG_FILE=${RUNTIME_DIR}/${LISP_APP}.detachtty
PID_FILE=${RUNTIME_DIR}/${LISP_APP}.pid
SOCKET_FILE=${RUNTIME_DIR}/${LISP_APP}.socket
SLIME_PORT=4005
######################################################################
all: help

help:
        @echo ""
        @echo "start   - start the lisp server"
        @echo "stop    - stop the lisp server"
        @echo "restart - restart the lisp server"
        @echo "attach  - attach to the lisp server"
        @echo "slime   - connect emacs to the lisp server"
        @echo "dribble - tail the dribble file"
        @echo "log     - cat the log file"
        @echo ""

start: cleanup setup start_server log attach
start_server:
        ${DETACHTTY_EXE} \
        --dribble-file ${DRIBBLE_FILE} \
        --log-file ${LOG_FILE} \
        --pid-file ${PID_FILE} \
        ${SOCKET_FILE} \
        /usr/bin/sbcl --noinform \
        --eval "(asdf:operate 'asdf:load-op :modlisp)" \
        --eval "(asdf:operate 'asdf:load-op :swank)" \
        --eval "(swank:create-swank-server ${SLIME_PORT} swank:*communication-style* #'(lambda (p) p) t)" \
        --eval '(load "${LISP_DIR}/${LISP_APP}")' \
        --eval '(start-apache-listener)'
        @sleep 2

setup:
        @mkdir -p ${RUNTIME_DIR}

stop: stop_server cleanup

stop_server: ${PID_FILE}
        @echo "kill `cat ${PID_FILE}`"
        @kill -9 `cat ${PID_FILE}`

restart: stop start

cleanup: 
        @rm -fv ${PID_FILE}
        @rm -fv ${SOCKET_FILE}
        @rm -fv ${DRIBBLE_FILE}
        @rm -fv ${LOG_FILE}
attach: 
        @${ATTACHTTY_EXE} ${SOCKET_FILE} || true

dribble:
        @tail -f ${DRIBBLE_FILE} || true
log:
        @cat ${LOG_FILE}
slime:
        @emacs -nw --eval '(slime-connect "localhost" 4005)'

sample Makefile

LISP_DIR=${HOME}/lisp/website
LISP_APP=server.lisp

include ../makedefs.sbcl

create_db:
        mysql -u username < databasename.sql
show_db:
        mysqldump databasename


Category Slime ??

This page is presently Uncategorized: please add appropriate topic markers and remove this text