Alexander Reinwarth <alexander(a)reinwarth.de> wrote:
 
 The problem seems to be in `with-output-to-string', which opens
 temporary buffers, but instead of removing them, just deletes the
 buffers' content.
 
 I locally defined a substitute for `with-output-to-string', replacing 
 the last line of
 
 ,----
 | (defmacro with-output-to-string (&rest forms)
 |   "Collect output to `standard-output' while evaluating FORMS and return
 | it as a string."
 |   ;; by "William G. Dubuque" <wgd(a)zurich.ai.mit.edu> w/ mods from Stig
 |   `(with-current-buffer (get-buffer-create
 | 			 (generate-new-buffer-name " *string-output*"))
 |      (setq buffer-read-only nil)
 |      (buffer-disable-undo (current-buffer))
 |      (erase-buffer)
 |      (let ((standard-output (current-buffer)))
 |        ,@forms)
 |      (prog1
 | 	 (buffer-string)
 |        (erase-buffer))))
 `----
 
 with
 	(kill-buffer(current-buffer)))))
 
 and now everything works as expected for me.
 
 Is this something which should be changed in the XEmacs-distribution
 or did I just misunderstand the purpose and/or implementation of
 `with-output-to-string'? 
It should be changed.  Here is the GNU version:
(defmacro with-output-to-string (&rest body)
  "Execute BODY, return the text it sent to `standard-output', as a
string."
  `(let ((standard-output
	  (get-buffer-create (generate-new-buffer-name " *string-output*"))))
     (let ((standard-output standard-output))
       ,@body)
     (with-current-buffer standard-output
       (prog1
	   (buffer-string)
	 (kill-buffer nil)))))
I'm not sure why the XEmacs version dorks about doing:
     (setq buffer-read-only nil)
     (buffer-disable-undo (current-buffer))
     (erase-buffer)
with a brand-spanking-new buffer.
Also, the GNU version will only return what was printed to
`standard-output'; BODY can still modify the current buffer, which
seems neat.
-- 
John Paul Wallington