unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#61001: 29.0.60; c-ts-mode: A recent update broke indent-according-to-mode
@ 2023-01-22  7:29 Mohammed Sadiq
       [not found] ` <handler.61001.B.16743725669585.ack@debbugs.gnu.org>
  2023-01-22  9:49 ` Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 2 replies; 8+ messages in thread
From: Mohammed Sadiq @ 2023-01-22  7:29 UTC (permalink / raw)
  To: 61001

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





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

* bug#61001: 29.0.60; c-ts-mode: A recent update broke indent-according-to-mode
       [not found] ` <handler.61001.B.16743725669585.ack@debbugs.gnu.org>
@ 2023-01-22  8:42   ` Mohammed Sadiq
  0 siblings, 0 replies; 8+ messages in thread
From: Mohammed Sadiq @ 2023-01-22  8:42 UTC (permalink / raw)
  To: 61001

Well, indent-according-to-mode is broken in interactive case too.





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

* bug#61001: 29.0.60; c-ts-mode: A recent update broke indent-according-to-mode
  2023-01-22  7:29 bug#61001: 29.0.60; c-ts-mode: A recent update broke indent-according-to-mode Mohammed Sadiq
       [not found] ` <handler.61001.B.16743725669585.ack@debbugs.gnu.org>
@ 2023-01-22  9:49 ` Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-01-22 10:01   ` Mohammed Sadiq
  1 sibling, 1 reply; 8+ messages in thread
From: Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-01-22  9:49 UTC (permalink / raw)
  To: Mohammed Sadiq; +Cc: 61001

Mohammed Sadiq <sadiq@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





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

* bug#61001: 29.0.60; c-ts-mode: A recent update broke indent-according-to-mode
  2023-01-22  9:49 ` Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-01-22 10:01   ` Mohammed Sadiq
  2023-01-22 10:03     ` Mohammed Sadiq
  0 siblings, 1 reply; 8+ messages in thread
From: Mohammed Sadiq @ 2023-01-22 10:01 UTC (permalink / raw)
  To: Theodor Thornhill; +Cc: 61001

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





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

* bug#61001: 29.0.60; c-ts-mode: A recent update broke indent-according-to-mode
  2023-01-22 10:01   ` Mohammed Sadiq
@ 2023-01-22 10:03     ` Mohammed Sadiq
  2023-01-22 10:12       ` Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 8+ messages in thread
From: Mohammed Sadiq @ 2023-01-22 10:03 UTC (permalink / raw)
  To: Theodor Thornhill; +Cc: 61001

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





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

* bug#61001: 29.0.60; c-ts-mode: A recent update broke indent-according-to-mode
  2023-01-22 10:03     ` Mohammed Sadiq
@ 2023-01-22 10:12       ` Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-01-22 10:29         ` Mohammed Sadiq
  0 siblings, 1 reply; 8+ messages in thread
From: Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-01-22 10:12 UTC (permalink / raw)
  To: Mohammed Sadiq; +Cc: 61001

Mohammed Sadiq <sadiq@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?





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

* bug#61001: 29.0.60; c-ts-mode: A recent update broke indent-according-to-mode
  2023-01-22 10:12       ` Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-01-22 10:29         ` Mohammed Sadiq
  2023-01-22 10:34           ` Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 8+ messages in thread
From: Mohammed Sadiq @ 2023-01-22 10:29 UTC (permalink / raw)
  To: Theodor Thornhill; +Cc: 61001

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





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

* bug#61001: 29.0.60; c-ts-mode: A recent update broke indent-according-to-mode
  2023-01-22 10:29         ` Mohammed Sadiq
@ 2023-01-22 10:34           ` Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 0 replies; 8+ messages in thread
From: Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-01-22 10:34 UTC (permalink / raw)
  To: Mohammed Sadiq; +Cc: 61001

Mohammed Sadiq <sadiq@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






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

end of thread, other threads:[~2023-01-22 10:34 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-22  7:29 bug#61001: 29.0.60; c-ts-mode: A recent update broke indent-according-to-mode Mohammed Sadiq
     [not found] ` <handler.61001.B.16743725669585.ack@debbugs.gnu.org>
2023-01-22  8:42   ` Mohammed Sadiq
2023-01-22  9:49 ` Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-01-22 10:01   ` Mohammed Sadiq
2023-01-22 10:03     ` Mohammed Sadiq
2023-01-22 10:12       ` Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-01-22 10:29         ` Mohammed Sadiq
2023-01-22 10:34           ` Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors

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).