Skip to content

Instantly share code, notes, and snippets.

@elderica
Created October 28, 2024 11:39
Show Gist options
  • Save elderica/598b14ee2b2540987dc21d5571eef3f2 to your computer and use it in GitHub Desktop.
Save elderica/598b14ee2b2540987dc21d5571eef3f2 to your computer and use it in GitHub Desktop.
rlcl-setup.sh
# code taken from https://www.cliki.net/rlwrap
sbcl --script <<EOF
(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<))))
EOF
BREAK_CHARS="\(\)\{\}\[\],^%\\$\#\;''\"\"\\\\"
alias rlcl="rlwrap --remember --history-filename=$HOME/.sbcl_history --histsize=1000000 -c -b $BREAK_CHARS -f $HOME/.sbcl_completions sbcl --noinform"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment