GNU bug report logs - #61208
29.0.60; treesit-beginning/end-of-defun problem with macros in c-ts-mode

Previous Next

Package: emacs;

Reported by: yingchao.yang <at> seaboxdata.com

Date: Wed, 1 Feb 2023 09:14:02 UTC

Severity: normal

Merged with 61209

Found in version 29.0.60

Full log


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

From: Eli Zaretskii <eliz <at> gnu.org>
To: casouri <at> gmail.com
Cc: yingchao.yang <at> seaboxdata.com, theo <at> thornhill.no, 61208 <at> debbugs.gnu.org,
 yang.yingchao <at> qq.com
Subject: Re: bug#61208: 29.0.60;
 treesit-beginning/end-of-defun problem with macros in c-ts-mode
Date: Thu, 02 Feb 2023 20:22:31 +0200
> Cc: yingchao.yang <at> seaboxdata.com, 61208 <at> debbugs.gnu.org, theo <at> thornhill.no,
>  yang.yingchao <at> qq.com
> Date: Thu, 02 Feb 2023 09:41:23 +0200
> From: Eli Zaretskii <eliz <at> gnu.org>
> 
> > Treesit-defun-tactic being ’nested isn’t the problem here, at least not the direct cause of the problem. c-ts-mode doesn’t consider switch cases or if-else statements as defuns. It only considers function, struct, enum, union, as defun. So in a preprocessed C source file, C-M-a will move point to the beginning of the function, line E. It does not in this particular file because tree-sitter is thrown off by the SWITCH() and CASE() macro: it can’t tell what they are and parses them as function definitions.
> > 
> > I don’t object setting treesit-defun-tactic to ’top-level in c-ts-mode, though. It can hide problems like this. Just be aware that it merely hides the problem.
> 
> OK, I think I will make that change soon.

Done.




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

Previous Next


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