diff src/editfns.c @ 16298:17304eb73f97

(Fsave_current_buffer): New function. (syms_of_editfns): defsubr it.
author Richard M. Stallman <rms@gnu.org>
date Mon, 23 Sep 1996 04:37:40 +0000
parents 79e6c47054c5
children 9b919c5464a4
line wrap: on
line diff
--- a/src/editfns.c	Mon Sep 23 04:36:43 1996 +0000
+++ b/src/editfns.c	Mon Sep 23 04:37:40 1996 +0000
@@ -335,7 +335,22 @@
   int count = specpdl_ptr - specpdl;
 
   record_unwind_protect (save_excursion_restore, save_excursion_save ());
-			 
+
+  val = Fprogn (args);
+  return unbind_to (count, val);
+}
+
+DEFUN ("save-current-buffer", Fsave_current_buffer, Ssave_current_buffer, 0, UNEVALLED, 0,
+  "Save the current buffer; execute BODY; restore the current buffer.\n\
+Executes BODY just like `progn'.")
+  (args)
+     Lisp_Object args;
+{
+  register Lisp_Object val;
+  int count = specpdl_ptr - specpdl;
+
+  record_unwind_protect (Fset_buffer, Fcurrent_buffer ());
+
   val = Fprogn (args);
   return unbind_to (count, val);
 }
@@ -2515,6 +2530,7 @@
 /*  defsubr (&Smark); */
 /*  defsubr (&Sset_mark); */
   defsubr (&Ssave_excursion);
+  defsubr (&Ssave_current_buffer);
 
   defsubr (&Sbufsize);
   defsubr (&Spoint_max);