aboutsummaryrefslogtreecommitdiffstats
path: root/sbcl
diff options
context:
space:
mode:
authorGravatar Tom Willemse2026-09-03 00:18:15 -0700
committerGravatar Tom Willemse2026-09-12 01:00:38 -0700
commit64ec173e01d1808390be5fa59898c2ded677cc0f (patch)
treec0d8631cb24d2e4020835152f37a725de47385c6 /sbcl
parenta429219f7c4e9aba8996346a962d1f9d67f19956 (diff)
downloadnew-dotfiles-64ec173e01d1808390be5fa59898c2ded677cc0f.tar.gz
new-dotfiles-64ec173e01d1808390be5fa59898c2ded677cc0f.zip
sbcl: Make ‘C-d’ quit the REPL on an empty line
I'm quite used to typing in ‘C-d’ to quit any kind of REPL. Most accept that an EOF marker showing up means that it's time to quit. SBCL (with linedit) just reports that it's happened. This change makes it work the way I prefer again.
Diffstat (limited to 'sbcl')
-rw-r--r--sbcl/sbclrc12
1 files changed, 10 insertions, 2 deletions
diff --git a/sbcl/sbclrc b/sbcl/sbclrc
index 228ae53..47baaef 100644
--- a/sbcl/sbclrc
+++ b/sbcl/sbclrc
@@ -7,12 +7,20 @@
(when (probe-file quicklisp-init)
(load quicklisp-init)))
+(require :linedit)
+
;;; Enable linedit, a readline-like module for SBCL. Install through
;;; (ql:quickload "linedit").
(if (member "--no-linedit" sb-ext:*posix-argv* :test 'equal)
(setf sb-ext:*posix-argv*
(remove "--no-linedit" sb-ext:*posix-argv* :test 'equal))
(when (interactive-stream-p *terminal-io*)
+ (require :asdf)
(require :sb-aclrepl)
- (require :linedit)
- (funcall (intern "INSTALL-REPL" :linedit) :wrap-current t)))
+ (funcall (intern "INSTALL-REPL" :linedit) :wrap-current t)
+
+ (defun delete-char-forwards-or-quit (chord editor)
+ (if (equal "" (linedit::get-string editor))
+ (sb-ext:quit)
+ (linedit::delete-char-forwards chord editor)))
+ (linedit::defcommand "C-D" 'delete-char-forwards-or-quit)))