]> git.eshelyaron.com Git - emacs.git/commitdiff
Make xwidgets print nicer
authorPo Lu <luangruo@yahoo.com>
Sat, 6 Nov 2021 05:58:52 +0000 (13:58 +0800)
committerLars Ingebrigtsen <larsi@gnus.org>
Sun, 7 Nov 2021 01:59:41 +0000 (02:59 +0100)
* src/print.c (print_vectorlike): Print xwidgets with ID and widget
pointer, and print xwidget views separately.

src/print.c

index c13294c8e62323bd5d8ab903b7160d23bb759d6a..eca389158f9e90a5496dd39042cb6d6ca969346f 100644 (file)
@@ -1521,8 +1521,20 @@ print_vectorlike (Lisp_Object obj, Lisp_Object printcharfun, bool escapeflag,
       printchar ('>', printcharfun);
       break;
 
-    case PVEC_XWIDGET: case PVEC_XWIDGET_VIEW:
-      print_c_string ("#<xwidget ", printcharfun);
+    case PVEC_XWIDGET:
+#ifdef HAVE_XWIDGETS
+      {
+       int len = sprintf (buf, "#<xwidget %u %p>",
+                          XXWIDGET (obj)->xwidget_id,
+                          XXWIDGET (obj)->widget_osr);
+       strout (buf, len, len, printcharfun);
+       break;
+      }
+#else
+      emacs_abort ();
+#endif
+    case PVEC_XWIDGET_VIEW:
+      print_c_string ("#<xwidget view", printcharfun);
       printchar ('>', printcharfun);
       break;