unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* with-output-to-temp-buffer
@ 2006-06-01 22:53 Drew Adams
  2006-06-02  0:17 ` with-output-to-temp-buffer Thien-Thi Nguyen
  2006-06-02 22:07 ` with-output-to-temp-buffer Kevin Rodgers
  0 siblings, 2 replies; 4+ messages in thread
From: Drew Adams @ 2006-06-01 22:53 UTC (permalink / raw)


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?

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2006-06-02 22:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-06-01 22:53 with-output-to-temp-buffer Drew Adams
2006-06-02  0:17 ` with-output-to-temp-buffer Thien-Thi Nguyen
2006-06-02  0:29   ` with-output-to-temp-buffer Drew Adams
2006-06-02 22:07 ` with-output-to-temp-buffer Kevin Rodgers

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).