printing support for Guile objects
[bpt/emacs.git] / src / print.c
index 6ed0f51..672a780 100644 (file)
@@ -96,6 +96,7 @@ bool print_output_debug_flag EXTERNALLY_VISIBLE = 1;
    Use PRINTCHAR to output one character,
    or call strout to output a block of characters.  */
 
+/* {{coccinelle:skip_start}} */
 #define PRINTDECLARE                                                   \
    struct buffer *old = current_buffer;                                        \
    ptrdiff_t old_point = -1, start_point = -1;                         \
@@ -196,6 +197,7 @@ bool print_output_debug_flag EXTERNALLY_VISIBLE = 1;
    set_buffer_internal (old);
 
 #define PRINTCHAR(ch) printchar (ch, printcharfun)
+/* {{coccinelle:skip_end}} */
 
 /* This is used to restore the saved contents of print_buffer
    when there is a recursive call to print.  */
@@ -2144,6 +2146,19 @@ print_object (Lisp_Object obj, Lisp_Object printcharfun, bool escapeflag)
        }
       break;
 
+    case Lisp_Other:
+      {
+        SCM port = scm_open_output_string ();
+        if (escapeflag)
+          scm_display (obj, port);
+        else
+          scm_write (obj, port);
+        strout (scm_to_locale_string (scm_get_output_string (port)),
+                -1, -1, printcharfun);
+        scm_close_port (port);
+      }
+      break;
+
     default:
     badtype:
       {