From xemacs-m  Tue Jun 17 23:30:22 1997
Received: from jagor.srce.hr (hniksic@jagor.srce.hr [161.53.2.130])
	by xemacs.org (8.8.5/8.8.5) with ESMTP id XAA17355
	for <xemacs-beta@xemacs.org>; Tue, 17 Jun 1997 23:30:21 -0500 (CDT)
Received: (from hniksic@localhost)
          by jagor.srce.hr (8.8.5/8.8.4)
	  id GAA25910; Wed, 18 Jun 1997 06:30:22 +0200 (MET DST)
To: XEmacs Developers <xemacs-beta@xemacs.org>
Subject: [PATCH] Minor fix in subr.el
X-Attribution: Hrv
X-Face: Mie8:rOV<\c/~z{s.X4A{!?vY7{drJ([U]0O=W/<W*SMo/Mv:58:*_y~ki>xDi&N7XG
        KV^$k0m3Oe/)'e%3=$PCR&3ITUXH,cK>]bci&<qQ>Ff%x_>1`T(+M2Gg/fgndU%k*ft
        [(7._6e0n-V%|%'[c|q:;}td$#INd+;?!-V=c8Pqf}3J
From: Hrvoje Niksic <hniksic@srce.hr>
Date: 18 Jun 1997 06:30:21 +0200
Message-ID: <kigu3iwttwi.fsf@jagor.srce.hr>
Lines: 36
X-Mailer: Gnus v5.4.52/XEmacs 20.3(beta7)

I think we should use the new `save-current-buffer' macro instead of
`save-excursion', where applicable.  This patch makes such changes to
`with-output-to-string' and `with-temp-buffer'.

Note that I haven't tested this thoroughly (since it would require
recompiling of the whole XEmacs lisp tree, and I don't have CPU for
that), but it has passed all the test cases I could think of.

--- lisp/prim/subr.el.orig	Wed Jun 18 06:16:52 1997
+++ lisp/prim/subr.el	Wed Jun 18 06:20:25 1997
@@ -322,8 +322,7 @@
   "Collect output to `standard-output' while evaluating FORMS and return
 it as a string."
   ;; by "William G. Dubuque" <wgd@zurich.ai.mit.edu> w/ mods from Stig
-  (` (save-excursion
-       (set-buffer (get-buffer-create " *string-output*"))
+  (` (with-current-buffer (get-buffer-create " *string-output*")
        (setq buffer-read-only nil)
        (buffer-disable-undo (current-buffer))
        (erase-buffer)
@@ -366,8 +365,7 @@
     `(let ((,temp-buffer
 	    (get-buffer-create (generate-new-buffer-name " *temp*"))))
        (unwind-protect
-	   (save-excursion
-	     (set-buffer ,temp-buffer)
+	   (with-current-buffer ,temp-buffer
 	     ,@forms)
 	 (and (buffer-name ,temp-buffer)
 	      (kill-buffer ,temp-buffer))))))


-- 
Hrvoje Niksic <hniksic@srce.hr> | Student at FER Zagreb, Croatia
--------------------------------+--------------------------------
main(){printf(&unix["\021%six\012\0"],(unix)["have"]+"fun"-0x60);}

