&optional
from-readtable to-readtable → readtablecopy-readtable copies from-readtable.
If to-readtable is nil, a new readtable is created and returned. Otherwise the readtable specified by to-readtable is modified and returned.
copy-readtable copies the setting of readtable-case.
(defparameter zvar 123)
→ZVAR
(defparameter *backup-table* (copy-readtable))
→*BACKUP-TABLE*
(set-syntax-from-char #\z #\' *backup-table*)
→zvar
→123
(copy-readtable *backup-table* *readtable*)
→#<READTABLE 614000277>
zvar
→VAR
(setf *readtable* (copy-readtable))
→#<READTABLE 46210223>
zvar
→VAR
(setf *readtable* (copy-readtable nil))
→#<READTABLE 46302670>
zvar
→123
None.
None.
(setf *readtable* (copy-readtable nil))
restores the input syntax to standard Common Lisp syntax, even if the initial readtable has been clobbered (assuming it is not so badly clobbered that you cannot type in the above expression).
On the other hand,
(setf *readtable* (copy-readtable))
replaces the current readtable with a copy of itself. This is useful if you want to save a copy of a readtable for later use, protected from alteration in the meantime. It is also useful if you want to locally bind the readtable to a copy of itself, as in:
(let ((*readtable* (copy-readtable))) ...)
\issue{READ-CASE-SENSITIVITY:READTABLE-KEYWORDS}