diff options
| author | Yuan Fu | 2023-01-09 20:15:12 -0800 |
|---|---|---|
| committer | Yuan Fu | 2023-01-09 20:15:12 -0800 |
| commit | aa9df1260c3fe5e872bef926288ce345bedbe1bb (patch) | |
| tree | b557c8b4b935e9e1c367045f470d31aa8a465d1e /src | |
| parent | e385c099b8c3eda3c7e3ad397c1b4a8ff2be4010 (diff) | |
| download | emacs-aa9df1260c3fe5e872bef926288ce345bedbe1bb.tar.gz emacs-aa9df1260c3fe5e872bef926288ce345bedbe1bb.zip | |
Don't print named tree-sitter nodes with parenthesizes (bug#60696)
* src/print.c (print_vectorlike): Use empty string as delimiters if
the node is named.
Diffstat (limited to 'src')
| -rw-r--r-- | src/print.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/print.c b/src/print.c index d4a9ff89246..e65b4c40b0e 100644 --- a/src/print.c +++ b/src/print.c | |||
| @@ -2034,8 +2034,13 @@ print_vectorlike (Lisp_Object obj, Lisp_Object printcharfun, bool escapeflag, | |||
| 2034 | /* Now the node must be up-to-date, and calling functions like | 2034 | /* Now the node must be up-to-date, and calling functions like |
| 2035 | Ftreesit_node_start will not signal. */ | 2035 | Ftreesit_node_start will not signal. */ |
| 2036 | bool named = treesit_named_node_p (XTS_NODE (obj)->node); | 2036 | bool named = treesit_named_node_p (XTS_NODE (obj)->node); |
| 2037 | const char *delim1 = named ? "(" : "\""; | 2037 | /* We used to use () as delimiters for named nodes, but that |
| 2038 | const char *delim2 = named ? ")" : "\""; | 2038 | confuses pretty-printing a tad bit. There might be more |
| 2039 | little breakages here and there if we print parenthesizes | ||
| 2040 | inside an object, so I guess better not do it. | ||
| 2041 | (bug#60696) */ | ||
| 2042 | const char *delim1 = named ? "" : "\""; | ||
| 2043 | const char *delim2 = named ? "" : "\""; | ||
| 2039 | print_c_string (delim1, printcharfun); | 2044 | print_c_string (delim1, printcharfun); |
| 2040 | print_string (Ftreesit_node_type (obj), printcharfun); | 2045 | print_string (Ftreesit_node_type (obj), printcharfun); |
| 2041 | print_c_string (delim2, printcharfun); | 2046 | print_c_string (delim2, printcharfun); |