summaryrefslogtreecommitdiff
path: root/src/print.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/print.c')
-rw-r--r--src/print.c25
1 files changed, 23 insertions, 2 deletions
diff --git a/src/print.c b/src/print.c
index 7818565ce62..cc2902acb2b 100644
--- a/src/print.c
+++ b/src/print.c
@@ -970,6 +970,26 @@ debug_print (arg)
Fprin1 (arg, Qexternal_debugging_output);
fprintf (stderr, "\r\n");
}
+
+void
+safe_debug_print (arg)
+ Lisp_Object arg;
+{
+ int valid = valid_lisp_object_p (arg);
+
+ if (valid > 0)
+ debug_print (arg);
+ else
+ fprintf (stderr, "#<%s_LISP_OBJECT 0x%08lx>\r\n",
+ !valid ? "INVALID" : "SOME",
+#ifdef NO_UNION_TYPE
+ (unsigned long) arg
+#else
+ (unsigned long) arg.i
+#endif
+ );
+}
+
DEFUN ("error-message-string", Ferror_message_string, Serror_message_string,
1, 1, 0,
@@ -1294,7 +1314,7 @@ print_preprocess (obj)
/* Give up if we go so deep that print_object will get an error. */
/* See similar code in print_object. */
if (print_depth >= PRINT_CIRCLE)
- return;
+ error ("Apparently circular structure being printed");
/* Avoid infinite recursion for circular nested structure
in the case where Vprint_circle is nil. */
@@ -1325,7 +1345,8 @@ print_preprocess (obj)
{
/* OBJ appears more than once. Let's remember that. */
PRINT_NUMBER_STATUS (Vprint_number_table, i) = Qt;
- return;
+ print_depth--;
+ return;
}
/* OBJ is not yet recorded. Let's add to the table. */