Because we can't switch back afterwards, the compiler will blame the
wrong thing. Also, if the output stream isn't position-aware, it's
probably because we're in the midst of pretty-printing something, and
forcing `#line' directives will produce hideous results.
This is all rather unfortunate. It's clearly a bug that we can't
produce pretty output and have useful error location information, but I
think this is the best I can manage right now.
(line (file-location-line location))
(filename (file-location-filename location)))
(cond (line
- (format stream "~&#line ~D~@[ ~S~]~%" line filename)
+ (when (typep stream 'position-aware-stream)
+ (format stream "~&#line ~D~@[ ~S~]~%" line filename))
(funcall thunk)
(when (typep stream 'position-aware-stream)
(fresh-line stream)