GNU bug report logs - #78503
30.0.92; tree-sitter elixir-ts-mode structural movement broken

Previous Next

Package: emacs;

Reported by: Bart Otten <bart.otten85 <at> gmail.com>

Date: Tue, 20 May 2025 04:30:03 UTC

Severity: normal

Found in version 30.0.92

Full log


View this message in rfc822 format

From: Juri Linkov <juri <at> linkov.net>
To: Bart Otten <bart.otten85 <at> gmail.com>
Cc: Wilhelm H Kirschbaum <wkirschbaum <at> gmail.com>, 78503 <at> debbugs.gnu.org
Subject: bug#78503: 30.0.92; tree-sitter elixir-ts-mode structural movement broken
Date: Tue, 20 May 2025 09:46:34 +0300
> Trying to use elixir treesit mode, it seems the navigation of defun and lists seems broken.
>
> 1.) `defmodule` is considered a function definition and so moving up from the first
> actual function definition `def my_fun do` causes the point to jump to
> 'defmodule my_mod do'. Invoking `end-of-defun` jumps to the end of the defmodule block.
> Effectively, you have been ejected from the module body.
>
> ;; current scoped workaround
> ;; does not jump up to defmodule when using `beginning-of-defun`
> (defun elixir-ts--defun-p (node)
>   "Return non-nil when NODE is a defun."
>   (member (treesit-node-text
>            (treesit-node-child-by-field-name node "target"))
>           (append
>            (remove "defmodule" elixir-ts--definition-keywords)
>           elixir-ts--test-definition-keywords)))

This behavior may look logically flawed,
but still it makes sense for user convenience:
while navigating with 'C-M-a' it's handy
to use the same key to move over modules too.

The same navigation exists in other ts-modes as well:
for example, in java-ts-mode 'C-M-a' moves over classes, etc.
OTOH, in ruby-ts-mode it's restricted to methods only.

> 2.) When you use `down-list` while on a function definition line,
> nothing happens. I tried to fix it, ony to find out that
> `backward-up-list` will jump to `defmodule` when invoked while point is at a
> function argument, instead of navigating out of the argument list only.  
>
> Structural movement might need some extra love.

This part is not reproducible.  Do you use the latest master?




This bug report was last modified 11 days ago.

Previous Next


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