-
Notifications
You must be signed in to change notification settings - Fork 0
/
format.lisp
23 lines (20 loc) · 1.05 KB
/
format.lisp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
(in-package #:extrinsicl)
(defclass extrinsicl-format-client (inravina-extrinsic:extrinsic-client)
((%client :initarg :client :reader client)
(%environment :initarg :environment :reader environment)))
(defmethod invistra:coerce-function-designator ((client extrinsicl-format-client) object)
(etypecase object
(function object)
(t (clostrum:fdefinition (client client) (environment client) object))))
(defun install-format (client environment)
(let ((fmt-client (make-instance 'extrinsicl-format-client
:client client :environment environment)))
(defaliases client environment
(format (destination control-string &rest format-arguments)
(let ((incless-extrinsic:*client* fmt-client)
(destination
(if (eql destination 't)
(funcall (clostrum:fdefinition client environment 'symbol-value)
'*standard-output*)
destination)))
(apply #'invistra-extrinsic:format destination control-string format-arguments))))))