#!/bin/sh BREAK_CHARS="(){}[],^%$#@\"\";''|\\" RLWRAP= if [ $TERM == "dumb" ]; then # slime RLWRAP= else RLWRAP="rlwrap --remember --history-filename=$HOME/.sbcl_history --histsize=1000000 -c -b $BREAK_CHARS -f $HOME/.sbcl_completions" fi if [ $# -eq 0 ]; then exec $RLWRAP /opt/local/bin/sbcl else # permits #!/usr/bin/env sbcl , but breaks sbcl --help, etc. exec /opt/local/bin/sbcl --script $* fi
And here's an SBCL script to generate the completions:
#! /usr/bin/env sbcl (let (symbols) (do-all-symbols (sym) (let ((package (symbol-package sym))) (cond ((not (fboundp sym))) ((or (eql #.(find-package :cl) package) (eql #.(find-package :cl-user) package)) (pushnew (symbol-name sym) symbols)) ((eql #.(find-package :keyword) package) (pushnew (concatenate 'string ":" (symbol-name sym)) symbols)) (package (pushnew (concatenate 'string (package-name package) ":" (symbol-name sym)) symbols))))) (with-open-file (output #.(concatenate 'string (posix-getenv "HOME") "/.sbcl_completions") :direction :output :if-exists :overwrite :if-does-not-exist :create) (format output "~{~(~A~)~%~}" (sort symbols #'string<))))
Development