GNU bug report logs - #61001
29.0.60; c-ts-mode: A recent update broke indent-according-to-mode

Previous Next

Package: emacs;

Reported by: Mohammed Sadiq <sadiq <at> sadiqpk.org>

Date: Sun, 22 Jan 2023 07:30:02 UTC

Severity: normal

Found in version 29.0.60

Fixed in version 30.1

Done: Theodor Thornhill <theo <at> thornhill.no>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 61001 in the body.
You can then email your comments to 61001 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#61001; Package emacs. (Sun, 22 Jan 2023 07:30:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Mohammed Sadiq <sadiq <at> sadiqpk.org>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sun, 22 Jan 2023 07:30:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Mohammed Sadiq <sadiq <at> sadiqpk.org>
To: bug-gnu-emacs <at> gnu.org
Subject: 29.0.60; c-ts-mode: A recent update broke indent-according-to-mode
Date: Sun, 22 Jan 2023 12:59:14 +0530
A recent update in c-ts-mode broke indent-according-to-mode. Some test
cases in my elisp scripts fails to succeed after a recent update.
The indentation seems to work fine when editing C source files though.

Minimal reproducible example (save to test.el):

(let ((buffer (generate-new-buffer "temp.c")))
  (with-current-buffer buffer
    (c-ts-mode)
    (insert "int main() {\n if ")
    (indent-according-to-mode)))

Execute the file with:
emacs -Q -batch -l test.el

Error log:
Error: treesit-indent-error ("Couldn't find the preset corresponding to 
expression" c-ts-mode--looking-at-star)
  mapbacktrace(#f(compiled-function (evald func args flags) #<bytecode 
-0x10efd02ab0517942>))
  debug-early-backtrace()
  debug-early(error (treesit-indent-error "Couldn't find the preset 
corresponding to expression" c-ts-mode--looking-at-star))
  signal(treesit-indent-error ("Couldn't find the preset corresponding 
to expression" c-ts-mode--looking-at-star))
  treesit--simple-indent-eval(c-ts-mode--looking-at-star)
  mapcar(treesit--simple-indent-eval ((parent-is "comment") 
c-ts-mode--looking-at-star))
  treesit--simple-indent-eval((and (parent-is "comment") 
c-ts-mode--looking-at-star))
  treesit--simple-indent-eval(((and (parent-is "comment") 
c-ts-mode--looking-at-star) #<treesit-node "if" in 15-17> #<treesit-node 
ERROR in 1-17> 15))
  treesit-simple-indent(#<treesit-node "if" in 15-17> #<treesit-node 
ERROR in 1-17> 15)
  treesit--indent-1()
  treesit-indent()
  indent-according-to-mode()
  (save-current-buffer (set-buffer buffer) (c-ts-mode) (insert "int 
main() {\n if ") (indent-according-to-mode))
  (let ((buffer (generate-new-buffer "temp.c"))) (save-current-buffer 
(set-buffer buffer) (c-ts-mode) (insert "int main() {\n if ") 
(indent-according-to-mode)))
  eval-buffer(#<buffer  *load*> nil "/home/sadiq/test.el" nil t)
  load-with-code-conversion("/home/sadiq/test.el" "/home/sadiq/test.el" 
nil t)
  load("/home/sadiq/test.el" nil t)
  command-line-1(("-l" "test.el"))
  command-line()
  normal-top-level()
Generic tree-sitter indentation error: "Couldn't find the preset 
corresponding to expression", c-ts-mode--looking-at-star


In GNU Emacs 29.0.60 (build 5, x86_64-pc-linux-gnu, GTK+ Version
 3.24.36, cairo version 1.16.0) of 2023-01-22 built on purism
Repository revision: e74ba72a6a34221abf47145ecf0ec4fc8cda2555
Repository branch: emacs-29
Windowing system distributor 'The X.Org Foundation', version 
11.0.12101006
System Description: Debian GNU/Linux bookworm/sid




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#61001; Package emacs. (Sun, 22 Jan 2023 08:43:02 GMT) Full text and rfc822 format available.

Message #8 received at 61001 <at> debbugs.gnu.org (full text, mbox):

From: Mohammed Sadiq <sadiq <at> sadiqpk.org>
To: 61001 <at> debbugs.gnu.org
Subject: 29.0.60; c-ts-mode: A recent update broke indent-according-to-mode
Date: Sun, 22 Jan 2023 14:12:30 +0530
Well, indent-according-to-mode is broken in interactive case too.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#61001; Package emacs. (Sun, 22 Jan 2023 09:50:02 GMT) Full text and rfc822 format available.

Message #11 received at 61001 <at> debbugs.gnu.org (full text, mbox):

From: Theodor Thornhill <theo <at> thornhill.no>
To: Mohammed Sadiq <sadiq <at> sadiqpk.org>
Cc: 61001 <at> debbugs.gnu.org
Subject: Re: bug#61001: 29.0.60; c-ts-mode: A recent update broke
 indent-according-to-mode
Date: Sun, 22 Jan 2023 10:49:36 +0100
Mohammed Sadiq <sadiq <at> sadiqpk.org> writes:

> A recent update in c-ts-mode broke indent-according-to-mode. Some test
> cases in my elisp scripts fails to succeed after a recent update.
> The indentation seems to work fine when editing C source files though.
>
> Minimal reproducible example (save to test.el):
>
> (let ((buffer (generate-new-buffer "temp.c")))
>   (with-current-buffer buffer
>     (c-ts-mode)
>     (insert "int main() {\n if ")
>     (indent-according-to-mode)))
>
> Execute the file with:
> emacs -Q -batch -l test.el
>
> Error log:
> Error: treesit-indent-error ("Couldn't find the preset corresponding to
> expression" c-ts-mode--looking-at-star)

Seems I missed one replace.  Better now?  Added a change to emacs-29
branch.

Theo




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#61001; Package emacs. (Sun, 22 Jan 2023 10:02:02 GMT) Full text and rfc822 format available.

Message #14 received at 61001 <at> debbugs.gnu.org (full text, mbox):

From: Mohammed Sadiq <sadiq <at> sadiqpk.org>
To: Theodor Thornhill <theo <at> thornhill.no>
Cc: 61001 <at> debbugs.gnu.org
Subject: Re: bug#61001: 29.0.60; c-ts-mode: A recent update broke
 indent-according-to-mode
Date: Sun, 22 Jan 2023 15:31:43 +0530
On 2023-01-22 15:19, Theodor Thornhill wrote:
> Seems I missed one replace.  Better now?  Added a change to emacs-29
> branch.

I still get the following error:
Error: treesit-indent-error ("Couldn't find the preset corresponding to 
expression" c-ts-common--looking-at-star)
  mapbacktrace(#f(compiled-function (evald func args flags) #<bytecode 
0xcc3221d4fae87dc>))
  debug-early-backtrace()
  debug-early(error (treesit-indent-error "Couldn't find the preset 
corresponding to expression" c-ts-common--looking-at-star))
  signal(treesit-indent-error ("Couldn't find the preset corresponding 
to expression" c-ts-common--looking-at-star))
  treesit--simple-indent-eval(c-ts-common--looking-at-star)
  mapcar(treesit--simple-indent-eval ((parent-is "comment") 
c-ts-common--looking-at-star))
  treesit--simple-indent-eval((and (parent-is "comment") 
c-ts-common--looking-at-star))
  treesit--simple-indent-eval(((and (parent-is "comment") 
c-ts-common--looking-at-star) #<treesit-node "if" in 15-17> 
#<treesit-node ERROR in 1-17> 15))
  treesit-simple-indent(#<treesit-node "if" in 15-17> #<treesit-node 
ERROR in 1-17> 15)
  treesit--indent-1()
  treesit-indent()
  indent-according-to-mode()
  (save-current-buffer (set-buffer buffer) (c-ts-mode) (insert "int 
main() {\n if ") (indent-according-to-mode))
  (let ((buffer (generate-new-buffer "temp.c"))) (save-current-buffer 
(set-buffer buffer) (c-ts-mode) (insert "int main() {\n if ") 
(indent-according-to-mode)))
  eval-buffer(#<buffer  *load*> nil "/home/sadiq/test.el" nil t)
  load-with-code-conversion("/home/sadiq/test.el" "/home/sadiq/test.el" 
nil t)
  load("/home/sadiq/test.el" nil t)
  command-line-1(("-l" "test.el"))
  command-line()
  normal-top-level()
Generic tree-sitter indentation error: "Couldn't find the preset 
corresponding to expression", c-ts-common--looking-at-star




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#61001; Package emacs. (Sun, 22 Jan 2023 10:04:02 GMT) Full text and rfc822 format available.

Message #17 received at 61001 <at> debbugs.gnu.org (full text, mbox):

From: Mohammed Sadiq <sadiq <at> sadiqpk.org>
To: Theodor Thornhill <theo <at> thornhill.no>
Cc: 61001 <at> debbugs.gnu.org
Subject: Re: bug#61001: 29.0.60; c-ts-mode: A recent update broke
 indent-according-to-mode
Date: Sun, 22 Jan 2023 15:33:15 +0530
On 2023-01-22 15:31, Mohammed Sadiq wrote:
> On 2023-01-22 15:19, Theodor Thornhill wrote:
>> Seems I missed one replace.  Better now?  Added a change to emacs-29
>> branch.

I think you want c-ts-common-looking-at-star




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#61001; Package emacs. (Sun, 22 Jan 2023 10:14:01 GMT) Full text and rfc822 format available.

Message #20 received at 61001 <at> debbugs.gnu.org (full text, mbox):

From: Theodor Thornhill <theo <at> thornhill.no>
To: Mohammed Sadiq <sadiq <at> sadiqpk.org>
Cc: 61001 <at> debbugs.gnu.org
Subject: Re: bug#61001: 29.0.60; c-ts-mode: A recent update broke
 indent-according-to-mode
Date: Sun, 22 Jan 2023 11:12:59 +0100
Mohammed Sadiq <sadiq <at> sadiqpk.org> writes:

> On 2023-01-22 15:31, Mohammed Sadiq wrote:
>> On 2023-01-22 15:19, Theodor Thornhill wrote:
>>> Seems I missed one replace.  Better now?  Added a change to emacs-29
>>> branch.
>
> I think you want c-ts-common-looking-at-star

Hehe yeah, saw it too late... Better now?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#61001; Package emacs. (Sun, 22 Jan 2023 10:30:01 GMT) Full text and rfc822 format available.

Message #23 received at 61001 <at> debbugs.gnu.org (full text, mbox):

From: Mohammed Sadiq <sadiq <at> sadiqpk.org>
To: Theodor Thornhill <theo <at> thornhill.no>
Cc: 61001 <at> debbugs.gnu.org
Subject: Re: bug#61001: 29.0.60; c-ts-mode: A recent update broke
 indent-according-to-mode
Date: Sun, 22 Jan 2023 15:59:13 +0530
On 2023-01-22 15:42, Theodor Thornhill wrote:
>> I think you want c-ts-common-looking-at-star
> 
> Hehe yeah, saw it too late... Better now?

Yes, It works fine now.

thanks




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#61001; Package emacs. (Sun, 22 Jan 2023 10:35:01 GMT) Full text and rfc822 format available.

Message #26 received at 61001 <at> debbugs.gnu.org (full text, mbox):

From: Theodor Thornhill <theo <at> thornhill.no>
To: Mohammed Sadiq <sadiq <at> sadiqpk.org>
Cc: 61001 <at> debbugs.gnu.org
Subject: Re: bug#61001: 29.0.60; c-ts-mode: A recent update broke
 indent-according-to-mode
Date: Sun, 22 Jan 2023 11:34:03 +0100
Mohammed Sadiq <sadiq <at> sadiqpk.org> writes:

> On 2023-01-22 15:42, Theodor Thornhill wrote:
>>> I think you want c-ts-common-looking-at-star
>> 
>> Hehe yeah, saw it too late... Better now?
>
> Yes, It works fine now.
>
> thanks

Great, thanks for the report :)

Theo





bug marked as fixed in version 30.1, send any further explanations to 61001 <at> debbugs.gnu.org and Mohammed Sadiq <sadiq <at> sadiqpk.org> Request was from Theodor Thornhill <theo <at> thornhill.no> to control <at> debbugs.gnu.org. (Sun, 22 Jan 2023 10:35:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 19 Feb 2023 12:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 38 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.