all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Vincenzo Pupillo <v.pupillo@gmail.com>
To: 62752@debbugs.gnu.org
Subject: bug#62752: html-ts-mode: treesit--simple-indent-eval: Wrong number of arguments: #<subr point-min>, 3
Date: Mon, 10 Apr 2023 16:32:35 +0200	[thread overview]
Message-ID: <9103509.CDJkKcVGEf@zarathustrawsp500> (raw)

[-- 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


             reply	other threads:[~2023-04-10 14:32 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-10 14:32 Vincenzo Pupillo [this message]
2023-04-10 21:24 ` bug#62752: html-ts-mode: treesit--simple-indent-eval: Wrong number of arguments: #<subr point-min>, 3 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9103509.CDJkKcVGEf@zarathustrawsp500 \
    --to=v.pupillo@gmail.com \
    --cc=62752@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.