38 lines
1.4 KiB
Common Lisp
38 lines
1.4 KiB
Common Lisp
;;;; babel.lisp - Personal function library loaded at sbcl startup
|
|
;;;; Author: Marcus Kammer <marcus.kammer@metalisp.dev>
|
|
;;;; MIT License
|
|
|
|
;; Put the following lines into your .sbclrc:
|
|
;;
|
|
;; (let ((babel (merge-pathnames ".emacs.d/babel.lisp" (user-homedir-pathname))))
|
|
;; (when (probe-file babel)
|
|
;; (load babel)))
|
|
|
|
;;; --- snip ---
|
|
(defun print-condition-hook (condition hook)
|
|
"This function is designed to be used as a custom debugger hook.
|
|
It prints the condition (error message), clears any remaining input,
|
|
and aborts the current operation."
|
|
;; Ignore the hook argument since it's not used in this function.
|
|
(declare (ignore hook))
|
|
;; Print the error message associated with the condition.
|
|
(princ condition)
|
|
;; Clear any pending input from the stream.
|
|
(clear-input)
|
|
;; Abort the current operation and return to the top-level.
|
|
(abort))
|
|
;; Get the value of the global variable *debugger-hook*.
|
|
*debugger-hook*
|
|
;; Set the global variable *debugger-hook* to the custom debugger hook
|
|
;; function 'print-condition-hook'. This function will now be called
|
|
;; whenever an unhandled error occurs.
|
|
(setf *debugger-hook* #'print-condition-hook)
|
|
(sb-ext:set-sbcl-source-location #P"~/sbcl/")
|
|
|
|
(defun get-external-symbols (package-name)
|
|
(let ((package (find-package package-name)))
|
|
(when package
|
|
(let ((result '()))
|
|
(do-external-symbols (symbol package)
|
|
(push symbol result))
|
|
result))))
|