summaryrefslogtreecommitdiff
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
parentdc249e80847adfdc9d0c00eaa44963af390ca279 (diff)
downloaddotfiles-138384ea8f483a3aef83d61771f0992547f6b124.tar.gz
enhance CL-USER & add C-c g l binding to get there
-rw-r--r--.emacs.d/init.el11
l---------[-rw-r--r--].sbclrc11
-rw-r--r--lib-src/cl-user.lisp6
-rw-r--r--lib-src/startup.lisp68
4 files changed, 85 insertions, 11 deletions
diff --git a/.emacs.d/init.el b/.emacs.d/init.el
index 92fd95fd..2a4397f5 100644
--- a/.emacs.d/init.el
+++ b/.emacs.d/init.el
@@ -2619,6 +2619,15 @@ Called by '~/src/dotfiles/bin/emacsclient --spw/update-environment'."
(spw/add-once-hook 'slime-connected-hook #'load))))
(global-set-key "\C-cgc" #'spw/go-to-consfig)
+(defun spw/go-to-cl-user ()
+ (interactive)
+ (if (not (ignore-errors (slime-output-buffer)))
+ (let ((default-directory (expand-file-name "~/")))
+ (slime))
+ (slime-switch-to-output-buffer)
+ (slime-repl-set-package "CL-USER")))
+(global-set-key "\C-cgl" #'spw/go-to-cl-user)
+
;; These configure flags are for my workstation development builds. We do not
;; have --with-native-compilation at present for the following reasons:
;;
@@ -2691,7 +2700,7 @@ Called by '~/src/dotfiles/bin/emacsclient --spw/update-environment'."
(start-process "ssh-and-tmux" nil "foot" "ssh-and-tmux" host
(format "--container-name=%s" container)
"--container-cmd=lxc-unpriv-attach -n %s --keep-var TERM --clear-env -vHOME=/root"))
-(global-set-key "\C-cgl" #'spw/ssh-and-lxc-attach-term)
+(global-set-key "\C-cgL" #'spw/ssh-and-lxc-attach-term)
(defun spw/proced-root ()
(interactive)
diff --git a/.sbclrc b/.sbclrc
index 0f12ba40..d9da102d 100644..120000
--- a/.sbclrc
+++ b/.sbclrc
@@ -1,10 +1 @@
-(require "asdf")
-
-;; get some additional useful functions in CL-USER
-(when (asdf:find-system "alexandria" nil)
- (asdf:load-system "alexandria")
- (use-package :alexandria))
-
-;; get a DROP-THEM restart when we delete symbols from the exports list in a
-;; DEFPACKAGE and then reevaluate that DEFPACKAGE
-(setq *on-package-variance* '(:error t))
+lib-src/startup.lisp \ No newline at end of file
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)))