unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#60655: 30.0.50; tree-sitter: `treesit-transpose-sexps' is broken.
@ 2023-01-08 10:53 Mickey Petersen
  2023-01-09  6:38 ` Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-12-30 18:22 ` Juri Linkov
  0 siblings, 2 replies; 8+ messages in thread
From: Mickey Petersen @ 2023-01-08 10:53 UTC (permalink / raw)
  To: 60655


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





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

end of thread, other threads:[~2025-01-04 18:30 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-08 10:53 bug#60655: 30.0.50; tree-sitter: `treesit-transpose-sexps' is broken Mickey Petersen
2023-01-09  6:38 ` Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-01-09  8:48   ` Mickey Petersen
2023-01-09 12:29     ` Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-01-09 12:30       ` Mickey Petersen
2023-01-09 13:37         ` Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-30 18:22 ` Juri Linkov
2025-01-04 18:30   ` Juri Linkov

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