]> code.delx.au - gnu-emacs/blobdiff - src/print.c
(xg_separator_p) <separator_names>: Move to file scope.
[gnu-emacs] / src / print.c
index c81f99f6436cf2e0f4d04c99c324c445e19549e3..cae80d1acfe5c483ddaedcb93dfcf69316b6cacf 100644 (file)
@@ -1,13 +1,13 @@
 /* Lisp object printing and output streams.
    Copyright (C) 1985, 1986, 1988, 1993, 1994, 1995, 1997,
                  1998, 1999, 2000, 2001, 2002, 2003, 2004,
-                 2005, 2006 Free Software Foundation, Inc.
+                 2005, 2006, 2007 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
 GNU Emacs is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
+the Free Software Foundation; either version 3, or (at your option)
 any later version.
 
 GNU Emacs is distributed in the hope that it will be useful,
@@ -33,6 +33,7 @@ Boston, MA 02110-1301, USA.  */
 #include "dispextern.h"
 #include "termchar.h"
 #include "intervals.h"
+#include "blockinput.h"
 
 Lisp_Object Vstandard_output, Qstandard_output;
 
@@ -92,8 +93,8 @@ Lisp_Object Vfloat_output_format, Qfloat_output_format;
 /* Avoid actual stack overflow in print.  */
 int print_depth;
 
-/* Nonzero if inside outputting backquote in old style.  */
-int old_backquote_output;
+/* Level of nesting inside outputting backquote in new style.  */
+int new_backquote_output;
 
 /* Detect most circularities to print finite output.  */
 #define PRINT_CIRCLE 200
@@ -689,7 +690,7 @@ If variable `temp-buffer-show-function' is non-nil, call it at the end
 to get the buffer displayed instead of just displaying the non-selected
 buffer and calling the hook.  It gets one argument, the buffer to display.
 
-usage: (with-output-to-temp-buffer BUFNAME BODY ...)  */)
+usage: (with-output-to-temp-buffer BUFNAME BODY...)  */)
      (args)
      Lisp_Object args;
 {
@@ -795,7 +796,7 @@ A printed representation of an object is text which describes that object.  */)
   Lisp_Object printcharfun;
   /* struct gcpro gcpro1, gcpro2; */
   Lisp_Object save_deactivate_mark;
-  int count = specpdl_ptr - specpdl;
+  int count = SPECPDL_INDEX ();
   struct buffer *previous;
 
   specbind (Qinhibit_modification_hooks, Qt);
@@ -976,7 +977,11 @@ append to existing target file.  */)
      Lisp_Object file, append;
 {
   if (initial_stderr_stream != NULL)
-    fclose (stderr);
+    {
+      BLOCK_INPUT;
+      fclose (stderr);
+      UNBLOCK_INPUT;
+    }
   stderr = initial_stderr_stream;
   initial_stderr_stream = NULL;
 
@@ -1286,13 +1291,14 @@ print (obj, printcharfun, escapeflag)
      register Lisp_Object printcharfun;
      int escapeflag;
 {
-  old_backquote_output = 0;
+  new_backquote_output = 0;
 
   /* Reset print_number_index and Vprint_number_table only when
      the variable Vprint_continuous_numbering is nil.  Otherwise,
      the values of these variables will be kept between several
      print functions.  */
-  if (NILP (Vprint_continuous_numbering))
+  if (NILP (Vprint_continuous_numbering)
+      || NILP (Vprint_number_table))
     {
       print_number_index = 0;
       Vprint_number_table = Qnil;
@@ -1750,14 +1756,24 @@ print_object (obj, printcharfun, escapeflag)
          print_object (XCAR (XCDR (obj)), printcharfun, escapeflag);
        }
       else if (print_quoted && CONSP (XCDR (obj)) && NILP (XCDR (XCDR (obj)))
-              && ! old_backquote_output
+              && ((EQ (XCAR (obj), Qbackquote))))
+       {
+         print_object (XCAR (obj), printcharfun, 0);
+         new_backquote_output++;
+         print_object (XCAR (XCDR (obj)), printcharfun, escapeflag);
+         new_backquote_output--;
+       }
+      else if (print_quoted && CONSP (XCDR (obj)) && NILP (XCDR (XCDR (obj)))
+              && new_backquote_output
               && ((EQ (XCAR (obj), Qbackquote)
                    || EQ (XCAR (obj), Qcomma)
                    || EQ (XCAR (obj), Qcomma_at)
                    || EQ (XCAR (obj), Qcomma_dot))))
        {
          print_object (XCAR (obj), printcharfun, 0);
+         new_backquote_output--;
          print_object (XCAR (XCDR (obj)), printcharfun, escapeflag);
+         new_backquote_output++;
        }
       else
        {
@@ -1777,9 +1793,7 @@ print_object (obj, printcharfun, escapeflag)
              print_object (Qbackquote, printcharfun, 0);
              PRINTCHAR (' ');
 
-             ++old_backquote_output;
              print_object (XCAR (XCDR (tem)), printcharfun, 0);
-             --old_backquote_output;
              PRINTCHAR (')');
 
              obj = XCDR (obj);