WRITE takes as keyword argument :pprint-dispatch, indicating the pprint
dispatch table to use.
It seems that whether or not the supplied table is actually used,
depends on whether the current package is the package in which the
dispatch table is located.
I think this is a bug: the dispatch table should always be used when it
is provided as an argument.
* (load "foo.cl")
; Loading #p"/home/wilm/dev/fmt/lisp/mp/foo.cl".
T
* *package*
#<The COMMON-LISP-USER package, 4/9 internal, 0/9 external>
* (write '(mark 4) :pretty t :pprint-dispatch foo:*mpd*)
(MARK 4) ;; <-- standard dispatch table: wrong?
(MARK 4)
* (in-package foo)
#<The FOO package, 2/8 internal, 1/2 external>
* (write '(mark 4) :pretty t :pprint-dispatch foo:*mpd*)
*mpd* mark ;; <-- foo:*mpd* dispatch table is used: correct
(MARK 4)
*
This is using version:
CMU Common Lisp CVS release-18e-branch + minimal debian patches
Loaded subsystems:
Python 1.1, target Intel x86
CLOS 18e (based on PCL September 16 92 PCL (f))
--- test file ---
(defpackage foo
(:use common-lisp)
(:export "*MPD*"))
(in-package foo)
(defvar *mpd* (copy-pprint-dispatch nil))
(set-pprint-dispatch '(cons (member mark))
(lambda (s cons)
(declare (ignore cons))
(format s "*mpd* mark"))
0 *mpd*)