all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#62752: html-ts-mode: treesit--simple-indent-eval: Wrong number of arguments: #<subr point-min>, 3
@ 2023-04-10 14:32 Vincenzo Pupillo
  2023-04-10 21:24 ` Dmitry Gutov
  0 siblings, 1 reply; 6+ messages in thread
From: Vincenzo Pupillo @ 2023-04-10 14:32 UTC (permalink / raw)
  To: 62752

[-- Attachment #1: Type: text/plain, Size: 1179 bytes --]

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.


[-- Attachment #2: 0001-Fixed-the-html-ts-mode-indentation-rule.patch --]
[-- Type: text/x-patch, Size: 1046 bytes --]

From 553358e481c4a81112d2ff84ae089ecfbfa20e12 Mon Sep 17 00:00:00 2001
From: Vincenzo Pupillo <v.pupillo@gmail.com>
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


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-04-11 19:38 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-10 14:32 bug#62752: html-ts-mode: treesit--simple-indent-eval: Wrong number of arguments: #<subr point-min>, 3 Vincenzo Pupillo
2023-04-10 21:24 ` Dmitry Gutov
2023-04-11  5:53   ` Eli Zaretskii
2023-04-11  8:25     ` Vincenzo Pupillo
2023-04-11 19:31     ` Dmitry Gutov
2023-04-11 19:38       ` Eli Zaretskii

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.