]> code.delx.au - gnu-emacs/blobdiff - src/print.c
(fns.o): Depend on md5.h.
[gnu-emacs] / src / print.c
index e06b8a0052dce812723fd1c11fd71bdfd0042d93..5f1506392c2509897f13eb171e0eadbb11806eca 100644 (file)
@@ -506,7 +506,7 @@ print_string (string, printcharfun)
        for (i = 0; i < size; i++)
          PRINTCHAR (SREF (string, i));
       else
-       for (i = 0; i < size_byte; i++)
+       for (i = 0; i < size_byte; )
          {
            /* Here, we must convert each multi-byte form to the
               corresponding character code before handing it to PRINTCHAR.  */
@@ -758,33 +758,42 @@ A printed representation of an object is text which describes that object.  */)
      (object, noescape)
      Lisp_Object object, noescape;
 {
-  PRINTDECLARE;
   Lisp_Object printcharfun;
   /* struct gcpro gcpro1, gcpro2; */
   Lisp_Object save_deactivate_mark;
   int count = specpdl_ptr - specpdl;
+  struct buffer *previous;
 
   specbind (Qinhibit_modification_hooks, Qt);
 
-  /* Save and restore this--we are altering a buffer
-     but we don't want to deactivate the mark just for that.
-     No need for specbind, since errors deactivate the mark.  */
-  save_deactivate_mark = Vdeactivate_mark;
-  /* GCPRO2 (object, save_deactivate_mark); */
-  abort_on_gc++;
+  {
+    PRINTDECLARE;
+
+    /* Save and restore this--we are altering a buffer
+       but we don't want to deactivate the mark just for that.
+       No need for specbind, since errors deactivate the mark.  */
+    save_deactivate_mark = Vdeactivate_mark;
+    /* GCPRO2 (object, save_deactivate_mark); */
+    abort_on_gc++;
+
+    printcharfun = Vprin1_to_string_buffer;
+    PRINTPREPARE;
+    print (object, printcharfun, NILP (noescape));
+    /* Make Vprin1_to_string_buffer be the default buffer after PRINTFINSH */
+    PRINTFINISH;
+  }
 
-  printcharfun = Vprin1_to_string_buffer;
-  PRINTPREPARE;
-  print (object, printcharfun, NILP (noescape));
-  /* Make Vprin1_to_string_buffer be the default buffer after PRINTFINSH */
-  PRINTFINISH;
+  previous = current_buffer;
   set_buffer_internal (XBUFFER (Vprin1_to_string_buffer));
   object = Fbuffer_string ();
   if (SBYTES (object) == SCHARS (object))
     STRING_SET_UNIBYTE (object);
 
+  /* Note that this won't make prepare_to_modify_buffer call 
+     ask-user-about-supersession-threat because this buffer
+     does not visit a file.  */
   Ferase_buffer ();
-  set_buffer_internal (old);
+  set_buffer_internal (previous);
 
   Vdeactivate_mark = save_deactivate_mark;
   /* UNGCPRO; */
@@ -2170,3 +2179,6 @@ that need to be recorded in the table.  */);
 
   defsubr (&Swith_output_to_temp_buffer);
 }
+
+/* arch-tag: bc797170-94ae-41de-86e3-75e20f8f7a39
+   (do not change this comment) */