Subject: html-ts-mode: treesit--simple-indent-eval: Wrong number of arguments: #<subr point-min>, 3

From: Vincenzo Pupillo <[email-masked]>
Date: Mon, 10 Apr 2023 16:32:35 +0200

Hi, 
I found a bug in html-ts-mode.
If you try to indent this simple html snippet (after enabling html-ts mode) 
and try to indent, say, the first or second line, emacs reports the following 
error:
Matched rule: ((parent-is "fragment") point-min 0)
treesit--simple-indent-eval: Wrong number of arguments: #<subr point-min>, 3

Using parent-bol instead of point-min solves the problem.

GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.37, cairo 
version 1.17.6) of 2023-04-09

The patch is attached.

The fragment is as follows:
<!DOCTYPE html>
<html>
<head>
<title>test</title>
<style>
body {
    background-color: linen;
}

h1 {
    color: maroon;
    margin-left: 40px;
}
</style>
<script>
function myFunc(theObject) {
    theObject.make = "Isotta fraschini";
}

const mycar = {
    make: "Iso Rivolta",
    model: "Grifo",
    year: 1965,
};

// x gets the value "Iso Rivolta"
const x = mycar.make;

myFunc(mycar);
// y gets the value "Isotta fraschini"
const y = mycar.make;

</script>
</head>
  <body>
    <h1 style="color:blue;text-align:center;">This is a heading</h1>
    <p style="color:red;">This is a paragraph.</p>
</body>
</html>

Thank you.
V.

>From 553358e481c4a81112d2ff84ae089ecfbfa20e12 Mon Sep 17 00:00:00 2001
From: Vincenzo Pupillo <[email-masked]>
Date: Mon, 10 Apr 2023 15:49:32 +0200
Subject: [PATCH] Fixed the html-ts-mode indentation rule.

The indentation rule ((parent-is "fragment") point-min 0) in
html-ts-mode causes an error if trying to indent nodes that have
'fragment' as parent.

* lisp/textmodes/html-ts-mode.el (html-ts-mode--indent-rules): use
parent-bol instead of point-min
---
 lisp/textmodes/html-ts-mode.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/textmodes/html-ts-mode.el b/lisp/textmodes/html-ts-mode.el
index 58dcc7d8cad..a58e3665ff8 100644
--- a/lisp/textmodes/html-ts-mode.el
+++ b/lisp/textmodes/html-ts-mode.el
@@ -42,7 +42,7 @@ html-ts-mode-indent-offset
 
 (defvar html-ts-mode--indent-rules
   `((html
-     ((parent-is "fragment") point-min 0)
+     ((parent-is "fragment") parent-bol 0)
      ((node-is "/>") parent-bol 0)
      ((node-is ">") parent-bol 0)
      ((node-is "end_tag") parent-bol 0)
-- 
2.39.2