]> git.eshelyaron.com Git - emacs.git/commitdiff
Don't print named tree-sitter nodes with parenthesizes (bug#60696)
authorYuan Fu <casouri@gmail.com>
Tue, 10 Jan 2023 04:15:12 +0000 (20:15 -0800)
committerYuan Fu <casouri@gmail.com>
Tue, 10 Jan 2023 04:15:12 +0000 (20:15 -0800)
* src/print.c (print_vectorlike): Use empty string as delimiters if
the node is named.

src/print.c

index d4a9ff89246b377d3c8b2f833a5e69fd57eba7b6..e65b4c40b0ed827e0c5337a31f823bc3eb0dd946 100644 (file)
@@ -2034,8 +2034,13 @@ print_vectorlike (Lisp_Object obj, Lisp_Object printcharfun, bool escapeflag,
       /* Now the node must be up-to-date, and calling functions like
         Ftreesit_node_start will not signal.  */
       bool named = treesit_named_node_p (XTS_NODE (obj)->node);
-      const char *delim1 = named ? "(" : "\"";
-      const char *delim2 = named ? ")" : "\"";
+      /* We used to use () as delimiters for named nodes, but that
+        confuses pretty-printing a tad bit.  There might be more
+        little breakages here and there if we print parenthesizes
+        inside an object, so I guess better not do it.
+        (bug#60696)  */
+      const char *delim1 = named ? "" : "\"";
+      const char *delim2 = named ? "" : "\"";
       print_c_string (delim1, printcharfun);
       print_string (Ftreesit_node_type (obj), printcharfun);
       print_c_string (delim2, printcharfun);