abclrc @ 4f28fbfd7d63

More
author Steve Losh <steve@stevelosh.com>
date Tue, 09 Apr 2024 09:20:04 -0400
parents 384770359545
children (none)
(load "~/.lisprc")

(defvar *last-package* nil)
(defvar *cached-prompt* nil)

(defun package-prompt (stream)
  (when (not (eq *last-package* *package*))
    (setf *cached-prompt*
          (format nil "~%[Armed Bear] ~A> "
                  (or (first (package-nicknames *package*))
                      (package-name *package*))))
    (setf *last-package* *package*))
  (terpri)
  (princ *cached-prompt* stream))

(defun debug-prompt (stream)
  (format stream "[~D] > " top-level::*debug-level*))

(defun sjl-prompt (stream)
  (if (zerop top-level::*debug-level*)
    (package-prompt stream)
    (debug-prompt stream)))

(setf top-level::*repl-prompt-fun* #'sjl-prompt)