Hi!
It is SLIME-specific problem. I hope I have already described the problem in previous posts. E.g. you type in SLIME:
(in-package :p1) (in-readtable :rt1)
; rt1 is now associated to p1
(in-package :cl-user)
; switched to standard readtable
(in-package :p1)
; switched to rt1
(in-package :cl-user)
; switched to standard readtable
(compile-file "foo")
where foo.lisp is: (in-package :p1) (in-readtable :rt2) EOF compilation failed...
(in-package :p1)
; switched to rt2
Of course, we can not say it is completely unpredictible, but is rather hard to predict sometimes.
When we type the same code in bare common lisp prompt, no readtable switching occurs. This is another misleading situation. We can conclude that we should avoid adding new values to *readtable-alist*. This is why I suggest creating new readtable-switching form instead of (in-readtable).
Another thing I don't fully understand in your idea (but I did reimplement it that way) is why the readtable information has to go on every Emacs->Lisp request,
E.g. request can contain (read-from-string), which can occur in proper readtable context. But frankly, I just copied package-related policy to readtables without any serious design work :)