GNU bug report logs - #60655
30.0.50; tree-sitter: `treesit-transpose-sexps' is broken.

Previous Next

Package: emacs;

Reported by: Mickey Petersen <mickey <at> masteringemacs.org>

Date: Sun, 8 Jan 2023 10:54:01 UTC

Severity: normal

Found in version 30.0.50

Fixed in version 31.0.50

Done: Juri Linkov <juri <at> linkov.net>

Bug is archived. No further changes may be made.

Full log


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

From: Mickey Petersen <mickey <at> masteringemacs.org>
To: bug-gnu-emacs <at> gnu.org
Subject: 30.0.50; tree-sitter: `treesit-transpose-sexps' is broken.
Date: Sun, 08 Jan 2023 10:53:33 +0000
The tree-sitter-enabled function, `treesit-transpose-sexps', that is called by transpose-sexps, is broken.

It uses a naive method of sibling adjacency to determine transpositions. But it is unfortunately not correct.

Python:


  def -!-foo():
      pass
   
Turns into this with `C-M-t':

  def ()foo:
      pass

But it ought to be:

  foo def():
      pass


It's swapping two siblings that are indeed adjacent in the tree, but not on screen, which is confusing and a regression from its previous behaviour. 

You could make a cogent argument that both approaches are wrong from a syntactic perspective, but I think that misses the broader point that `C-M-t' now does something errant and unexpected.

Worse, it's not possible to revert to the old behaviour (see bug#60654)



In GNU Emacs 30.0.50 (build 6, x86_64-pc-linux-gnu, GTK+ Version
 3.24.20, cairo version 1.16.0) of 2023-01-02 built on mickey-work
Repository revision: c209802f7b3721a1b95113290934a23fee88f678
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12013000
System Description: Ubuntu 20.04.3 LTS




This bug report was last modified 196 days ago.

Previous Next


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