GNU bug report logs - #78065
31.0.50; treesit-simple-indent-rules: nth-sibling anchor preset doesn't work properly

Previous Next

Package: emacs;

Reported by: Roman Rudakov <rrudakov <at> fastmail.com>

Date: Fri, 25 Apr 2025 19:05:01 UTC

Severity: normal

Found in version 31.0.50

Done: Yuan Fu <casouri <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


Message #10 received at 78065-done <at> debbugs.gnu.org (full text, mbox):

From: Yuan Fu <casouri <at> gmail.com>
To: Roman Rudakov <rrudakov <at> fastmail.com>
Cc: 78065-done <at> debbugs.gnu.org
Subject: Re: bug#78065: 31.0.50; treesit-simple-indent-rules: nth-sibling
 anchor preset doesn't work properly
Date: Tue, 6 May 2025 21:30:49 -0700

> On Apr 25, 2025, at 12:04 PM, Roman Rudakov <rrudakov <at> fastmail.com> wrote:
> 
> 
> The bug itself is actually in 'treesit--simple-indent-eval' function.
> 
> Steps to reproduce:
> 
> Eval the following expression:
> (treesit--simple-indent-eval '(nth-sibling 1 t))
> 
> Expected result: anchor lambda is returned.
> 
> Actual result:
> 
> Debugger entered--Lisp error: (treesit-indent-error "Couldn't find the preset corresponding to expression" t)
> 
> The function 'treesit--simple-indent-eval' is called recursively for every element in the expression, at some point it's called for 't', which matches '(symbolp exp)' predicate and is not null, which causes the error.

Hey Roman, thank you for the report, and sorry for taking so long to reply.

I initially added a branch cases to allow exp to be t, but then I realized that there’s no point inhibiting exp from being an arbitrary symbol or keyword, since user can define indent presets that takes a symbol or keyword as argument. So I went a step further and removed the check.

I pushed the fix to emacs-30.

Yuan



This bug report was last modified 18 days ago.

Previous Next


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