[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


From: Drew Adams
Subject: with-output-to-temp-buffer
Date: Thu, 1 Jun 2006 15:53:26 -0700

I had this code:

  (set-buffer (get-buffer-create "foo"))
  (let (...) ...)
  (select-frame (make-frame ...))

I changed it to this code:

  (with-output-to-temp-buffer "foo" ...)
  (let ((temp-buffer-setup-hook nil)
        (temp-buffer-show-functions nil)
  (select-window (get-buffer-window "foo" 'visible))
  (modify-frame-parameters (selected-frame) ...)

The rest of the code (i.e. "...") is identical. The latter code runs about
twice as fast (clock time)! I don't use any print functions inside the
with-* - I use only `insert', so I wouldn't think that with-* would be of
any special benefit here.

I don't understand this. A glance at the C code makes me think that
with-output-to-temp-buffer would only do more, not less, stuff.

(Thinking that the difference might be make-frame vs
modify-frame-parameters, I tried using modify-frame-* for the first code
too, but that made no difference. I guess it must be with-* that speeds
things up.)

Is this to be expected? If so, should something be said about this in the
doc - for example, say something about what with-output-* does, and mention
that it might be faster than creating and setting a buffer?

reply via email to

[Prev in Thread] Current Thread [Next in Thread]