summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp/lisp.el
diff options
context:
space:
mode:
authorYuan Fu <casouri@gmail.com>2023-02-27 00:14:32 -0800
committerYuan Fu <casouri@gmail.com>2023-02-27 00:14:32 -0800
commitaee10ca1cbee1d653f89f028c34066bf3ebb32ab (patch)
tree2f95d63c61b4acb2dbd35965c866da045cf80caf /lisp/emacs-lisp/lisp.el
parentedf5b97686908114f254b5077c71e8202149545f (diff)
downloademacs-aee10ca1cbee1d653f89f028c34066bf3ebb32ab.tar.gz
emacs-aee10ca1cbee1d653f89f028c34066bf3ebb32ab.tar.bz2
emacs-aee10ca1cbee1d653f89f028c34066bf3ebb32ab.zip
Adjust tree-sitter defun navigation (bug#61617)
Before this change, when you use a tree-sitter navigation function to move to the next beginning of a thing, it jumps over the immediate next thing and lands you at the beginning of the next-next thing. Eg, when point is at the "|", and we evaluate (treesit--navigate-thing pos 1 'beg), we go from | (thing) (thing) to (thing) |(thing) But some might expect point to go to |(thing) (thing) instead, which makes sense. Also, that's how Emacs expect defun navigation functions to work. The discrepancy in expectation causes bug#61617. In this change I made tree-sitter navigation functions to work as what Emacs expects. And what I described for moving to the next beginning of thing is similarly applicable to moving to the end of previous end of thing. * lisp/treesit.el (treesit-beginning-of-defun) (treesit-end-of-defun): Handle the case where defun-skipper moves point back to where we started, by adding a retry. (treesit--navigate-thing): Add a single condition checking for progress to the condition form responsible for checking whether to skip the next defun. Namely (eq pos (funcall advance next)))). * test/src/treesit-tests.el: (treesit--ert-defun-navigation-nested-master) (treesit--ert-defun-navigation-top-level-master): Change tests to reflect the new expectation.
Diffstat (limited to 'lisp/emacs-lisp/lisp.el')
0 files changed, 0 insertions, 0 deletions