unofficial mirror of bug-gnu-emacs@gnu.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

* bug#62752: html-ts-mode: treesit--simple-indent-eval: Wrong number of arguments: #<subr point-min>, 3
  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
  0 siblings, 1 reply; 6+ messages in thread
From: Dmitry Gutov @ 2023-04-10 21:24 UTC (permalink / raw)
  To: Vincenzo Pupillo, 62752-done

Hi!

Thanks for the report.

On 10/04/2023 17:32, Vincenzo Pupillo wrote:
> 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

I think the indention here was to use 'column-0', though. The mode was 
just missed in the update in commit 4c16fd3a51286e1b1.

The practical difference is minimal, but still.

I've pushed this change to master; closing. Let us know if something's 
still amiss, though.





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

* bug#62752: html-ts-mode: treesit--simple-indent-eval: Wrong number of arguments: #<subr point-min>, 3
  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
  0 siblings, 2 replies; 6+ messages in thread
From: Eli Zaretskii @ 2023-04-11  5:53 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: v.pupillo, 62752

> Resent-To: bug-gnu-emacs@gnu.org
> Date: Tue, 11 Apr 2023 00:24:54 +0300
> From: Dmitry Gutov <dmitry@gutov.dev>
> 
> > 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
> 
> I think the indention here was to use 'column-0', though. The mode was 
> just missed in the update in commit 4c16fd3a51286e1b1.
> 
> The practical difference is minimal, but still.
> 
> I've pushed this change to master; closing. Let us know if something's 
> still amiss, though.

Thanks.

Any reasons not to backport to emacs-29?  This mode is new in Emacs
29, so no compatibility issues should exist.





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

* bug#62752: html-ts-mode: treesit--simple-indent-eval: Wrong number of arguments: #<subr point-min>, 3
  2023-04-11  5:53   ` Eli Zaretskii
@ 2023-04-11  8:25     ` Vincenzo Pupillo
  2023-04-11 19:31     ` Dmitry Gutov
  1 sibling, 0 replies; 6+ messages in thread
From: Vincenzo Pupillo @ 2023-04-11  8:25 UTC (permalink / raw)
  To: Dmitry Gutov, Eli Zaretskii; +Cc: 62752

Thank you Dmitry.
V.

In data marted� 11 aprile 2023 07:53:58 CEST, Eli Zaretskii ha scritto:
> > Resent-To: bug-gnu-emacs@gnu.org
> > Date: Tue, 11 Apr 2023 00:24:54 +0300
> > From: Dmitry Gutov <dmitry@gutov.dev>
> > 
> > > 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
> > 
> > I think the indention here was to use 'column-0', though. The mode was 
> > just missed in the update in commit 4c16fd3a51286e1b1.
> > 
> > The practical difference is minimal, but still.
> > 
> > I've pushed this change to master; closing. Let us know if something's 
> > still amiss, though.
> 
> Thanks.
> 
> Any reasons not to backport to emacs-29?  This mode is new in Emacs
> 29, so no compatibility issues should exist.
> 








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

* bug#62752: html-ts-mode: treesit--simple-indent-eval: Wrong number of arguments: #<subr point-min>, 3
  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
  1 sibling, 1 reply; 6+ messages in thread
From: Dmitry Gutov @ 2023-04-11 19:31 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: v.pupillo, 62752

On 11/04/2023 08:53, Eli Zaretskii wrote:
>> Resent-To:bug-gnu-emacs@gnu.org
>> Date: Tue, 11 Apr 2023 00:24:54 +0300
>> From: Dmitry Gutov<dmitry@gutov.dev>
>>
>>> 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
>> I think the indention here was to use 'column-0', though. The mode was
>> just missed in the update in commit 4c16fd3a51286e1b1.
>>
>> The practical difference is minimal, but still.
>>
>> I've pushed this change to master; closing. Let us know if something's
>> still amiss, though.
> Thanks.
> 
> Any reasons not to backport to emacs-29?  This mode is new in Emacs
> 29, so no compatibility issues should exist.

html-ts-mode is not in emacs-29.





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

* bug#62752: html-ts-mode: treesit--simple-indent-eval: Wrong number of arguments: #<subr point-min>, 3
  2023-04-11 19:31     ` Dmitry Gutov
@ 2023-04-11 19:38       ` Eli Zaretskii
  0 siblings, 0 replies; 6+ messages in thread
From: Eli Zaretskii @ 2023-04-11 19:38 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: v.pupillo, 62752

> Date: Tue, 11 Apr 2023 22:31:02 +0300
> Cc: 62752@debbugs.gnu.org, v.pupillo@gmail.com
> From: Dmitry Gutov <dmitry@gutov.dev>
> 
> > Any reasons not to backport to emacs-29?  This mode is new in Emacs
> > 29, so no compatibility issues should exist.
> 
> html-ts-mode is not in emacs-29.

Oops, I confused it with css-ts-mode.





^ permalink raw reply	[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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).