summaryrefslogtreecommitdiff
path: root/lib-src
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2023-02-24 08:19:17 -0700
committerSean Whitton <spwhitton@spwhitton.name>2023-02-24 08:19:22 -0700
commit138384ea8f483a3aef83d61771f0992547f6b124 (patch)
tree29c5ffa2c282962719556deea05e0a807bff85a1 /lib-src
parentdc249e80847adfdc9d0c00eaa44963af390ca279 (diff)
downloaddotfiles-138384ea8f483a3aef83d61771f0992547f6b124.tar.gz
enhance CL-USER & add C-c g l binding to get there
Diffstat (limited to 'lib-src')
-rw-r--r--lib-src/cl-user.lisp6
-rw-r--r--lib-src/startup.lisp68
2 files changed, 74 insertions, 0 deletions
diff --git a/lib-src/cl-user.lisp b/lib-src/cl-user.lisp
new file mode 100644
index 00000000..d9a6b74d
--- /dev/null
+++ b/lib-src/cl-user.lisp
@@ -0,0 +1,6 @@
+;;; cl-user.lisp --- Personal utilities -*- mode: lisp -*-
+;;; Should be loadable in a variety of implementations.
+
+(in-package :cl-user)
+(named-readtables:in-readtable :cl-user)
+(set-dispatch-macro-character #\# #\? #'cl-interpol:interpol-reader)
diff --git a/lib-src/startup.lisp b/lib-src/startup.lisp
new file mode 100644
index 00000000..917a83a1
--- /dev/null
+++ b/lib-src/startup.lisp
@@ -0,0 +1,68 @@
+;;; startup.lisp --- Lisp implementation configuration -*- mode: lisp -*-
+
+;;; Copyright (C) 2023 Sean Whitton <spwhitton@spwhitton.name>
+
+;;; This file is free software; you can redistribute it and/or modify
+;;; it under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3, or (at your option)
+;;; any later version.
+
+;;; This file is distributed in the hope that it will be useful,
+;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;;; GNU General Public License for more details.
+
+;;; You should have received a copy of the GNU General Public License
+;;; along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+(require "asdf")
+(in-package :cl-user)
+
+#+package-local-nicknames
+(let ((cl-user-file (merge-pathnames "src/dotfiles/lib-src/cl-user.lisp"
+ (user-homedir-pathname)))
+ (cl-user-systems '(#:alexandria #:anaphora #:cl-ppcre #:consfigurator
+ #:named-readtables #:cl-interpol)))
+ ;; We have to have them all the systems available in order to be able to
+ ;; load cl-user.lisp, such that all packages are defined for the reader, and
+ ;; all macro definitions are loaded for the compiler.
+ (when (and (uiop:file-exists-p cl-user-file)
+ (every (lambda (s) (asdf:find-system s nil)) cl-user-systems))
+ (mapc #'asdf:load-system cl-user-systems)
+
+ (mapc #'use-package '(#:alexandria #:anaphora))
+ (uiop:symbol-call '#:uiop/package-local-nicknames
+ '#:add-package-local-nickname '#:re '#:cl-ppcre)
+ ;; Import everything in UIOP that can be imported without name conflicts.
+ (do-external-symbols (symbol :uiop)
+ (handler-case (import symbol)
+ (package-error ())))
+
+ (dolist (cons '((#:consfigurator
+
+ #:multiple-value-mapcan
+ #:lines #:unlines #:words #:unwords)))
+ (let ((package (car cons)))
+ (import (mapcar (lambda (s) (find-symbol (symbol-name s) package))
+ (cdr cons)))))
+
+ ;; We'll build it up programmatically throughout cl-user.lisp.
+ (unless (uiop:symbol-call '#:named-readtables '#:find-readtable :cl-user)
+ (uiop:symbol-call '#:named-readtables '#:make-readtable :cl-user
+ :merge '(:standard)))
+
+ ;; Load Swank if we have it in order to update its associations between
+ ;; readtables and packages.
+ (when (asdf:find-system "swank" nil)
+ (asdf:load-system "swank"))
+ ;; Want output indicating we had all the libraries.
+ (load cl-user-file :verbose t)))
+
+
+;;;; SBCL configuration
+
+#+sbcl
+(progn
+ ;; Enable DROP-THEM restart for when we delete symbols from the exports list
+ ;; in a DEFPACKAGE and then reevaluate that DEFPACKAGE.
+ (setq *on-package-variance* '(:error t)))