* bug#66989: 30.0.50; tree-sitter: treesit-defun-at-point wrong behavior in python-ts-mode
@ 2023-11-07 16:16 Denis Zubarev
2023-11-08 7:08 ` Yuan Fu
0 siblings, 1 reply; 8+ messages in thread
From: Denis Zubarev @ 2023-11-07 16:16 UTC (permalink / raw)
To: 66989
Steps to reproduce:
1. emacs -Q
2. M-x find-file /tmp/t.py
3. paste to the buffer
def premain():
pa|ss
def main():
pass
where | is cursor position for further steps
4. M-x python-ts-mode
5. M-x eval-expression (treesit-defun-at-point)
treesit-defun-at-point returns nil, but I expect that it will return
a node for `premain`.
If you move the cursor to the beginning of the word `pass` and try again
it will return node for `premain` function.
If you eval `(treesit--things-around (point) treesit-defun-type-regexp)`,
it returns `(nil #<treesit-node function_definition ...> nil)`
It seems that when cursor is not on the beginning of the node, treesit
erroneously finds next sibling.
It prevents finding parent node correctly (premain function in this case).
I managed to fix the problem by replacing
`(cursor (or (nth 0 result) (nth 1 result) node)` with ~(cursor node)~ - here
https://github.com/emacs-mirror/emacs/blob/12d1f33ceb37a2d0399af7e4054024c60a465ab8/lisp/treesit.el#L2383
But I'm sure it is not the proper fix.
In GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version
3.24.33, cairo version 1.16.0) of 2023-11-07 built on NUC-here
Repository revision: a1abb6a85e6605c256595b8d7b885018e5421c28
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12101004
System Description: Ubuntu 22.04.3 LTS
Configured using:
'configure --with-modules --with-native-compilation=aot
--with-imagemagick --with-json --with-tree-sitter --with-xft'
Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ
IMAGEMAGICK JPEG JSON LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2
M17N_FLT MODULES NATIVE_COMP NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP
SOUND THREADS TIFF TOOLKIT_SCROLL_BARS TREE_SITTER X11 XDBE XIM XINPUT2
XPM GTK3 ZLIB
Important settings:
value of $LC_MONETARY: ru_RU.UTF-8
value of $LC_NUMERIC: ru_RU.UTF-8
value of $LC_TIME: ru_RU.UTF-8
value of $LANG: en_US.UTF-8
locale-coding-system: utf-8-unix
Major mode: ELisp/l
Minor modes in effect:
git-gutter-mode: t
dap-tooltip-mode: t
dap-ui-mode: t
treemacs-filewatch-mode: t
treemacs-git-mode: t
treemacs-fringe-indicator-mode: t
dap-mode: t
lispyville-mode: t
lispy-mode: t
highlight-quoted-mode: t
rainbow-delimiters-mode: t
save-place-mode: t
global-so-long-mode: t
winum-mode: t
projectile-mode: t
flycheck-popup-tip-mode: t
+emacs-lisp-non-package-mode: t
vi-tilde-fringe-mode: t
display-line-numbers-mode: t
hl-todo-mode: t
outline-minor-mode: t
global-git-commit-mode: t
yas-global-mode: t
yas-minor-mode: t
recentf-mode: t
which-key-mode: t
savehist-mode: t
better-jumper-mode: t
better-jumper-local-mode: t
global-company-mode: t
company-mode: t
vertico-mode: t
marginalia-mode: t
evil-goggles-mode: t
evil-escape-mode: t
evil-snipe-override-mode: t
evil-snipe-mode: t
evil-snipe-override-local-mode: t
evil-snipe-local-mode: t
pcre-mode: t
server-mode: t
gcmh-mode: t
global-hl-line-mode: t
hl-line-mode: t
winner-mode: t
smartparens-global-mode: t
ws-butler-global-mode: t
ws-butler-mode: t
undo-fu-session-global-mode: t
undo-fu-session-mode: t
undo-fu-mode: t
global-flycheck-mode: t
flycheck-mode: t
persp-mode: t
global-jinx-mode: t
jinx-mode: t
doom-modeline-mode: t
solaire-global-mode: t
highlight-numbers-mode: t
hexl-follow-ascii: t
global-evil-surround-mode: t
evil-surround-mode: t
dirvish-override-dired-mode: t
direnv-mode: t
evil-mode: t
evil-local-mode: t
+popup-mode: t
override-global-mode: t
general-override-mode: t
global-eldoc-mode: t
eldoc-mode: t
show-paren-mode: t
electric-indent-mode: t
mouse-wheel-mode: t
file-name-shadow-mode: t
global-font-lock-mode: t
font-lock-mode: t
window-divider-mode: t
minibuffer-regexp-mode: t
size-indication-mode: t
column-number-mode: t
line-number-mode: t
transient-mark-mode: t
auto-composition-mode: t
auto-encryption-mode: t
auto-compression-mode: t
Load-path shadows:
/home/denin/.emacs.d/.local/straight/build-30.0.50/ivy/elpa hides /home/denin/.emacs.d/.local/straight/build-30.0.50/lispy/elpa
/home/denin/.emacs.d/.local/straight/build-30.0.50/transient/transient hides /usr/local/share/emacs/30.0.50/lisp/transient
/home/denin/.emacs.d/.local/straight/build-30.0.50/bind-key/bind-key hides /usr/local/share/emacs/30.0.50/lisp/bind-key
/home/denin/.emacs.d/.local/straight/build-30.0.50/use-package/use-package-delight hides /usr/local/share/emacs/30.0.50/lisp/use-package/use-package-delight
/home/denin/.emacs.d/.local/straight/build-30.0.50/use-package/use-package-lint hides /usr/local/share/emacs/30.0.50/lisp/use-package/use-package-lint
/home/denin/.emacs.d/.local/straight/build-30.0.50/use-package/use-package-jump hides /usr/local/share/emacs/30.0.50/lisp/use-package/use-package-jump
/home/denin/.emacs.d/.local/straight/build-30.0.50/use-package/use-package-diminish hides /usr/local/share/emacs/30.0.50/lisp/use-package/use-package-diminish
/home/denin/.emacs.d/.local/straight/build-30.0.50/use-package/use-package-ensure hides /usr/local/share/emacs/30.0.50/lisp/use-package/use-package-ensure
/home/denin/.emacs.d/.local/straight/build-30.0.50/use-package/use-package hides /usr/local/share/emacs/30.0.50/lisp/use-package/use-package
/home/denin/.emacs.d/.local/straight/build-30.0.50/use-package/use-package-bind-key hides /usr/local/share/emacs/30.0.50/lisp/use-package/use-package-bind-key
/home/denin/.emacs.d/.local/straight/build-30.0.50/use-package/use-package-core hides /usr/local/share/emacs/30.0.50/lisp/use-package/use-package-core
/home/denin/.emacs.d/.local/straight/build-30.0.50/project/project hides /usr/local/share/emacs/30.0.50/lisp/progmodes/project
/home/denin/.emacs.d/.local/straight/build-30.0.50/gdb-mi/gdb-mi hides /usr/local/share/emacs/30.0.50/lisp/progmodes/gdb-mi
/home/denin/.emacs.d/.local/straight/build-30.0.50/xref/xref hides /usr/local/share/emacs/30.0.50/lisp/progmodes/xref
/home/denin/.emacs.d/.local/straight/build-30.0.50/org/ob-ref hides /usr/local/share/emacs/30.0.50/lisp/org/ob-ref
/home/denin/.emacs.d/.local/straight/build-30.0.50/org/ol-irc hides /usr/local/share/emacs/30.0.50/lisp/org/ol-irc
/home/denin/.emacs.d/.local/straight/build-30.0.50/org/org-crypt hides /usr/local/share/emacs/30.0.50/lisp/org/org-crypt
/home/denin/.emacs.d/.local/straight/build-30.0.50/org/org-attach hides /usr/local/share/emacs/30.0.50/lisp/org/org-attach
/home/denin/.emacs.d/.local/straight/build-30.0.50/org/org-mouse hides /usr/local/share/emacs/30.0.50/lisp/org/org-mouse
/home/denin/.emacs.d/.local/straight/build-30.0.50/org/ob-latex hides /usr/local/share/emacs/30.0.50/lisp/org/ob-latex
/home/denin/.emacs.d/.local/straight/build-30.0.50/org/ol-eww hides /usr/local/share/emacs/30.0.50/lisp/org/ol-eww
/home/denin/.emacs.d/.local/straight/build-30.0.50/org/ob-ditaa hides /usr/local/share/emacs/30.0.50/lisp/org/ob-ditaa
/home/denin/.emacs.d/.local/straight/build-30.0.50/org/ob-groovy hides /usr/local/share/emacs/30.0.50/lisp/org/ob-groovy
/home/denin/.emacs.d/.local/straight/build-30.0.50/org/org-compat hides /usr/local/share/emacs/30.0.50/lisp/org/org-compat
/home/denin/.emacs.d/.local/straight/build-30.0.50/org/ol-info hides /usr/local/share/emacs/30.0.50/lisp/org/ol-info
/home/denin/.emacs.d/.local/straight/build-30.0.50/org/org-protocol hides /usr/local/share/emacs/30.0.50/lisp/org/org-protocol
/home/denin/.emacs.d/.local/straight/build-30.0.50/org/org-footnote hides /usr/local/share/emacs/30.0.50/lisp/org/org-footnote
/home/denin/.emacs.d/.local/straight/build-30.0.50/org/org-id hides /usr/local/share/emacs/30.0.50/lisp/org/org-id
/home/denin/.emacs.d/.local/straight/build-30.0.50/org/oc-biblatex hides /usr/local/share/emacs/30.0.50/lisp/org/oc-biblatex
/home/denin/.emacs.d/.local/straight/build-30.0.50/org/ob-C hides /usr/local/share/emacs/30.0.50/lisp/org/ob-C
/home/denin/.emacs.d/.local/straight/build-30.0.50/org/org-colview hides /usr/local/share/emacs/30.0.50/lisp/org/org-colview
/home/denin/.emacs.d/.local/straight/build-30.0.50/org/ob-calc hides /usr/local/share/emacs/30.0.50/lisp/org/ob-calc
/home/denin/.emacs.d/.local/straight/build-30.0.50/org/ob-octave hides /usr/local/share/emacs/30.0.50/lisp/org/ob-octave
/home/denin/.emacs.d/.local/straight/build-30.0.50/org/ob-java hides /usr/local/share/emacs/30.0.50/lisp/org/ob-java
/home/denin/.emacs.d/.local/straight/build-30.0.50/org/ob-js hides /usr/local/share/emacs/30.0.50/lisp/org/ob-js
/home/denin/.emacs.d/.local/straight/build-30.0.50/org/ob-R hides /usr/local/share/emacs/30.0.50/lisp/org/ob-R
/home/denin/.emacs.d/.local/straight/build-30.0.50/org/ob-ruby hides /usr/local/share/emacs/30.0.50/lisp/org/ob-ruby
/home/denin/.emacs.d/.local/straight/build-30.0.50/org/ob-css hides /usr/local/share/emacs/30.0.50/lisp/org/ob-css
/home/denin/.emacs.d/.local/straight/build-30.0.50/org/ox-odt hides /usr/local/share/emacs/30.0.50/lisp/org/ox-odt
/home/denin/.emacs.d/.local/straight/build-30.0.50/org/ol-man hides /usr/local/share/emacs/30.0.50/lisp/org/ol-man
/home/denin/.emacs.d/.local/straight/build-30.0.50/org/ob-perl hides /usr/local/share/emacs/30.0.50/lisp/org/ob-perl
/home/denin/.emacs.d/.local/straight/build-30.0.50/org/ox-org hides /usr/local/share/emacs/30.0.50/lisp/org/ox-org
/home/denin/.emacs.d/.local/straight/build-30.0.50/org/ox-html hides /usr/local/share/emacs/30.0.50/lisp/org/ox-html
/home/denin/.emacs.d/.local/straight/build-30.0.50/org/ob-gnuplot hides /usr/local/share/emacs/30.0.50/lisp/org/ob-gnuplot
/home/denin/.emacs.d/.local/straight/build-30.0.50/org/org-entities hides /usr/local/share/emacs/30.0.50/lisp/org/org-entities
/home/denin/.emacs.d/.local/straight/build-30.0.50/org/ol-bibtex hides /usr/local/share/emacs/30.0.50/lisp/org/ol-bibtex
/home/denin/.emacs.d/.local/straight/build-30.0.50/org/org-goto hides /usr/local/share/emacs/30.0.50/lisp/org/org-goto
/home/denin/.emacs.d/.local/straight/build-30.0.50/org/ob hides /usr/local/share/emacs/30.0.50/lisp/org/ob
/home/denin/.emacs.d/.local/straight/build-30.0.50/org/org-inlinetask hides /usr/local/share/emacs/30.0.50/lisp/org/org-inlinetask
/home/denin/.emacs.d/.local/straight/build-30.0.50/org/ob-comint hides /usr/local/share/emacs/30.0.50/lisp/org/ob-comint
/home/denin/.emacs.d/.local/straight/build-30.0.50/org/ol-gnus hides /usr/local/share/emacs/30.0.50/lisp/org/ol-gnus
/home/denin/.emacs.d/.local/straight/build-30.0.50/org/ox-latex hides /usr/local/share/emacs/30.0.50/lisp/org/ox-latex
/home/denin/.emacs.d/.local/straight/build-30.0.50/org/org-version hides /usr/local/share/emacs/30.0.50/lisp/org/org-version
/home/denin/.emacs.d/.local/straight/build-30.0.50/org/org-agenda hides /usr/local/share/emacs/30.0.50/lisp/org/org-agenda
/home/denin/.emacs.d/.local/straight/build-30.0.50/org/ob-lisp hides /usr/local/share/emacs/30.0.50/lisp/org/ob-lisp
/home/denin/.emacs.d/.local/straight/build-30.0.50/org/ob-matlab hides /usr/local/share/emacs/30.0.50/lisp/org/ob-matlab
/home/denin/.emacs.d/.local/straight/build-30.0.50/org/org hides /usr/local/share/emacs/30.0.50/lisp/org/org
/home/denin/.emacs.d/.local/straight/build-30.0.50/org/ob-maxima hides /usr/local/share/emacs/30.0.50/lisp/org/ob-maxima
/home/denin/.emacs.d/.local/straight/build-30.0.50/org/ob-lua hides /usr/local/share/emacs/30.0.50/lisp/org/ob-lua
/home/denin/.emacs.d/.local/straight/build-30.0.50/org/org-refile hides /usr/local/share/emacs/30.0.50/lisp/org/org-refile
/home/denin/.emacs.d/.local/straight/build-30.0.50/org/org-faces hides /usr/local/share/emacs/30.0.50/lisp/org/org-faces
/home/denin/.emacs.d/.local/straight/build-30.0.50/org/ob-python hides /usr/local/share/emacs/30.0.50/lisp/org/ob-python
/home/denin/.emacs.d/.local/straight/build-30.0.50/org/org-loaddefs hides /usr/local/share/emacs/30.0.50/lisp/org/org-loaddefs
/home/denin/.emacs.d/.local/straight/build-30.0.50/org/org-lint hides /usr/local/share/emacs/30.0.50/lisp/org/org-lint
/home/denin/.emacs.d/.local/straight/build-30.0.50/org/ol-docview hides /usr/local/share/emacs/30.0.50/lisp/org/ol-docview
/home/denin/.emacs.d/.local/straight/build-30.0.50/org/ox-md hides /usr/local/share/emacs/30.0.50/lisp/org/ox-md
/home/denin/.emacs.d/.local/straight/build-30.0.50/org/ox-man hides /usr/local/share/emacs/30.0.50/lisp/org/ox-man
/home/denin/.emacs.d/.local/straight/build-30.0.50/org/org-indent hides /usr/local/share/emacs/30.0.50/lisp/org/org-indent
/home/denin/.emacs.d/.local/straight/build-30.0.50/org/org-mobile hides /usr/local/share/emacs/30.0.50/lisp/org/org-mobile
/home/denin/.emacs.d/.local/straight/build-30.0.50/org/ob-scheme hides /usr/local/share/emacs/30.0.50/lisp/org/ob-scheme
/home/denin/.emacs.d/.local/straight/build-30.0.50/org/ox hides /usr/local/share/emacs/30.0.50/lisp/org/ox
/home/denin/.emacs.d/.local/straight/build-30.0.50/org/ob-tangle hides /usr/local/share/emacs/30.0.50/lisp/org/ob-tangle
/home/denin/.emacs.d/.local/straight/build-30.0.50/org/oc-csl hides /usr/local/share/emacs/30.0.50/lisp/org/oc-csl
/home/denin/.emacs.d/.local/straight/build-30.0.50/org/ob-shell hides /usr/local/share/emacs/30.0.50/lisp/org/ob-shell
/home/denin/.emacs.d/.local/straight/build-30.0.50/org/ox-beamer hides /usr/local/share/emacs/30.0.50/lisp/org/ox-beamer
/home/denin/.emacs.d/.local/straight/build-30.0.50/org/oc-natbib hides /usr/local/share/emacs/30.0.50/lisp/org/oc-natbib
/home/denin/.emacs.d/.local/straight/build-30.0.50/org/org-habit hides /usr/local/share/emacs/30.0.50/lisp/org/org-habit
/home/denin/.emacs.d/.local/straight/build-30.0.50/org/ob-emacs-lisp hides /usr/local/share/emacs/30.0.50/lisp/org/ob-emacs-lisp
/home/denin/.emacs.d/.local/straight/build-30.0.50/org/org-persist hides /usr/local/share/emacs/30.0.50/lisp/org/org-persist
/home/denin/.emacs.d/.local/straight/build-30.0.50/org/ob-core hides /usr/local/share/emacs/30.0.50/lisp/org/ob-core
/home/denin/.emacs.d/.local/straight/build-30.0.50/org/ox-icalendar hides /usr/local/share/emacs/30.0.50/lisp/org/ox-icalendar
/home/denin/.emacs.d/.local/straight/build-30.0.50/org/ob-haskell hides /usr/local/share/emacs/30.0.50/lisp/org/ob-haskell
/home/denin/.emacs.d/.local/straight/build-30.0.50/org/org-attach-git hides /usr/local/share/emacs/30.0.50/lisp/org/org-attach-git
/home/denin/.emacs.d/.local/straight/build-30.0.50/org/oc hides /usr/local/share/emacs/30.0.50/lisp/org/oc
/home/denin/.emacs.d/.local/straight/build-30.0.50/org/ob-sed hides /usr/local/share/emacs/30.0.50/lisp/org/ob-sed
/home/denin/.emacs.d/.local/straight/build-30.0.50/org/org-pcomplete hides /usr/local/share/emacs/30.0.50/lisp/org/org-pcomplete
/home/denin/.emacs.d/.local/straight/build-30.0.50/org/ox-koma-letter hides /usr/local/share/emacs/30.0.50/lisp/org/ox-koma-letter
/home/denin/.emacs.d/.local/straight/build-30.0.50/org/org-list hides /usr/local/share/emacs/30.0.50/lisp/org/org-list
/home/denin/.emacs.d/.local/straight/build-30.0.50/org/org-ctags hides /usr/local/share/emacs/30.0.50/lisp/org/org-ctags
/home/denin/.emacs.d/.local/straight/build-30.0.50/org/ob-dot hides /usr/local/share/emacs/30.0.50/lisp/org/ob-dot
/home/denin/.emacs.d/.local/straight/build-30.0.50/org/ol-rmail hides /usr/local/share/emacs/30.0.50/lisp/org/ol-rmail
/home/denin/.emacs.d/.local/straight/build-30.0.50/org/ob-forth hides /usr/local/share/emacs/30.0.50/lisp/org/ob-forth
/home/denin/.emacs.d/.local/straight/build-30.0.50/org/ob-sqlite hides /usr/local/share/emacs/30.0.50/lisp/org/ob-sqlite
/home/denin/.emacs.d/.local/straight/build-30.0.50/org/org-cycle hides /usr/local/share/emacs/30.0.50/lisp/org/org-cycle
/home/denin/.emacs.d/.local/straight/build-30.0.50/org/org-num hides /usr/local/share/emacs/30.0.50/lisp/org/org-num
/home/denin/.emacs.d/.local/straight/build-30.0.50/org/org-src hides /usr/local/share/emacs/30.0.50/lisp/org/org-src
/home/denin/.emacs.d/.local/straight/build-30.0.50/org/ob-sql hides /usr/local/share/emacs/30.0.50/lisp/org/ob-sql
/home/denin/.emacs.d/.local/straight/build-30.0.50/org/org-plot hides /usr/local/share/emacs/30.0.50/lisp/org/org-plot
/home/denin/.emacs.d/.local/straight/build-30.0.50/org/org-clock hides /usr/local/share/emacs/30.0.50/lisp/org/org-clock
/home/denin/.emacs.d/.local/straight/build-30.0.50/org/org-element hides /usr/local/share/emacs/30.0.50/lisp/org/org-element
/home/denin/.emacs.d/.local/straight/build-30.0.50/org/ox-ascii hides /usr/local/share/emacs/30.0.50/lisp/org/ox-ascii
/home/denin/.emacs.d/.local/straight/build-30.0.50/org/ol-mhe hides /usr/local/share/emacs/30.0.50/lisp/org/ol-mhe
/home/denin/.emacs.d/.local/straight/build-30.0.50/org/ob-table hides /usr/local/share/emacs/30.0.50/lisp/org/ob-table
/home/denin/.emacs.d/.local/straight/build-30.0.50/org/ob-plantuml hides /usr/local/share/emacs/30.0.50/lisp/org/ob-plantuml
/home/denin/.emacs.d/.local/straight/build-30.0.50/org/ox-texinfo hides /usr/local/share/emacs/30.0.50/lisp/org/ox-texinfo
/home/denin/.emacs.d/.local/straight/build-30.0.50/org/ob-ocaml hides /usr/local/share/emacs/30.0.50/lisp/org/ob-ocaml
/home/denin/.emacs.d/.local/straight/build-30.0.50/org/org-datetree hides /usr/local/share/emacs/30.0.50/lisp/org/org-datetree
/home/denin/.emacs.d/.local/straight/build-30.0.50/org/ol-doi hides /usr/local/share/emacs/30.0.50/lisp/org/ol-doi
/home/denin/.emacs.d/.local/straight/build-30.0.50/org/org-macs hides /usr/local/share/emacs/30.0.50/lisp/org/org-macs
/home/denin/.emacs.d/.local/straight/build-30.0.50/org/org-macro hides /usr/local/share/emacs/30.0.50/lisp/org/org-macro
/home/denin/.emacs.d/.local/straight/build-30.0.50/org/oc-basic hides /usr/local/share/emacs/30.0.50/lisp/org/oc-basic
/home/denin/.emacs.d/.local/straight/build-30.0.50/org/org-fold hides /usr/local/share/emacs/30.0.50/lisp/org/org-fold
/home/denin/.emacs.d/.local/straight/build-30.0.50/org/ob-exp hides /usr/local/share/emacs/30.0.50/lisp/org/ob-exp
/home/denin/.emacs.d/.local/straight/build-30.0.50/org/org-capture hides /usr/local/share/emacs/30.0.50/lisp/org/org-capture
/home/denin/.emacs.d/.local/straight/build-30.0.50/org/ob-fortran hides /usr/local/share/emacs/30.0.50/lisp/org/ob-fortran
/home/denin/.emacs.d/.local/straight/build-30.0.50/org/ob-lob hides /usr/local/share/emacs/30.0.50/lisp/org/ob-lob
/home/denin/.emacs.d/.local/straight/build-30.0.50/org/ob-awk hides /usr/local/share/emacs/30.0.50/lisp/org/ob-awk
/home/denin/.emacs.d/.local/straight/build-30.0.50/org/ol hides /usr/local/share/emacs/30.0.50/lisp/org/ol
/home/denin/.emacs.d/.local/straight/build-30.0.50/org/ol-w3m hides /usr/local/share/emacs/30.0.50/lisp/org/ol-w3m
/home/denin/.emacs.d/.local/straight/build-30.0.50/org/ob-makefile hides /usr/local/share/emacs/30.0.50/lisp/org/ob-makefile
/home/denin/.emacs.d/.local/straight/build-30.0.50/org/ob-lilypond hides /usr/local/share/emacs/30.0.50/lisp/org/ob-lilypond
/home/denin/.emacs.d/.local/straight/build-30.0.50/org/org-archive hides /usr/local/share/emacs/30.0.50/lisp/org/org-archive
/home/denin/.emacs.d/.local/straight/build-30.0.50/org/ob-processing hides /usr/local/share/emacs/30.0.50/lisp/org/ob-processing
/home/denin/.emacs.d/.local/straight/build-30.0.50/org/ob-eshell hides /usr/local/share/emacs/30.0.50/lisp/org/ob-eshell
/home/denin/.emacs.d/.local/straight/build-30.0.50/org/ob-julia hides /usr/local/share/emacs/30.0.50/lisp/org/ob-julia
/home/denin/.emacs.d/.local/straight/build-30.0.50/org/ob-sass hides /usr/local/share/emacs/30.0.50/lisp/org/ob-sass
/home/denin/.emacs.d/.local/straight/build-30.0.50/org/ob-screen hides /usr/local/share/emacs/30.0.50/lisp/org/ob-screen
/home/denin/.emacs.d/.local/straight/build-30.0.50/org/oc-bibtex hides /usr/local/share/emacs/30.0.50/lisp/org/oc-bibtex
/home/denin/.emacs.d/.local/straight/build-30.0.50/org/org-duration hides /usr/local/share/emacs/30.0.50/lisp/org/org-duration
/home/denin/.emacs.d/.local/straight/build-30.0.50/org/ob-org hides /usr/local/share/emacs/30.0.50/lisp/org/ob-org
/home/denin/.emacs.d/.local/straight/build-30.0.50/org/org-tempo hides /usr/local/share/emacs/30.0.50/lisp/org/org-tempo
/home/denin/.emacs.d/.local/straight/build-30.0.50/org/ol-bbdb hides /usr/local/share/emacs/30.0.50/lisp/org/ol-bbdb
/home/denin/.emacs.d/.local/straight/build-30.0.50/org/org-fold-core hides /usr/local/share/emacs/30.0.50/lisp/org/org-fold-core
/home/denin/.emacs.d/.local/straight/build-30.0.50/org/ob-clojure hides /usr/local/share/emacs/30.0.50/lisp/org/ob-clojure
/home/denin/.emacs.d/.local/straight/build-30.0.50/org/org-timer hides /usr/local/share/emacs/30.0.50/lisp/org/org-timer
/home/denin/.emacs.d/.local/straight/build-30.0.50/org/org-keys hides /usr/local/share/emacs/30.0.50/lisp/org/org-keys
/home/denin/.emacs.d/.local/straight/build-30.0.50/org/ob-eval hides /usr/local/share/emacs/30.0.50/lisp/org/ob-eval
/home/denin/.emacs.d/.local/straight/build-30.0.50/org/org-table hides /usr/local/share/emacs/30.0.50/lisp/org/org-table
/home/denin/.emacs.d/.local/straight/build-30.0.50/org/ol-eshell hides /usr/local/share/emacs/30.0.50/lisp/org/ol-eshell
/home/denin/.emacs.d/.local/straight/build-30.0.50/org/ox-publish hides /usr/local/share/emacs/30.0.50/lisp/org/ox-publish
/home/denin/.emacs.d/.local/straight/build-30.0.50/org/org-feed hides /usr/local/share/emacs/30.0.50/lisp/org/org-feed
/home/denin/.emacs.d/.local/straight/build-30.0.50/soap-client/soap-inspect hides /usr/local/share/emacs/30.0.50/lisp/net/soap-inspect
/home/denin/.emacs.d/.local/straight/build-30.0.50/soap-client/soap-client hides /usr/local/share/emacs/30.0.50/lisp/net/soap-client
/home/denin/.emacs.d/.local/straight/build-30.0.50/eldoc/eldoc hides /usr/local/share/emacs/30.0.50/lisp/emacs-lisp/eldoc
/home/denin/.emacs.d/.local/straight/build-30.0.50/map/map hides /usr/local/share/emacs/30.0.50/lisp/emacs-lisp/map
Features:
(vertico-quick smtpmail epa-file company-yasnippet git-gutter-fringe
fringe-helper git-gutter flycheck-cask elisp-demos
evil-collection-indent mm-archive evil-collection-tabulated-list
debbugs-gnu debbugs-compat evil-collection-debbugs debbugs soap-client
rng-xsd rng-dt rng-util xsd-regexp evil-collection-vc-git vc-git
vc-dispatcher mailalias mailclient textsec uni-scripts idna-mapping
ucs-normalize uni-confusable textsec-check char-fold lsp-pyright
dap-gdb-lldb dap-utils dap-lldb ccls ccls-member-hierarchy
ccls-inheritance-hierarchy ccls-call-hierarchy ccls-tree ccls-code-lens
ccls-semantic-highlight ccls-common smartparens-c cc-mode-expansions
cc-mode cc-fonts cc-guess cc-menus cc-cmds cc-styles cc-align cc-engine
dap-mouse dap-ui lsp-treemacs lsp-treemacs-generic lsp-treemacs-themes
treemacs-treelib treemacs-magit treemacs-persp treemacs-projectile
treemacs-evil treemacs-nerd-icons treemacs treemacs-header-line
treemacs-compatibility treemacs-mode treemacs-bookmarks treemacs-tags
treemacs-interface treemacs-persistence treemacs-filewatch-mode
treemacs-follow-mode treemacs-rendering treemacs-annotations
treemacs-async treemacs-workspaces treemacs-dom treemacs-visuals
treemacs-fringe-indicator treemacs-faces treemacs-icons treemacs-scope
treemacs-themes treemacs-core-utils pfuture treemacs-logging
treemacs-customization treemacs-macros gdb-mi gdb-module bui bui-list
bui-info bui-entry bui-core bui-history bui-button bui-utils lsp-lens
dap-python dap-mode dap-tasks dap-launch lsp-docker dap-overlays
lsp-mode lsp-protocol spinner ewoc smartparens-python
python-el-fgallina-expansions pyvenv evil-collection-python python
lispyville lispy lispy-inline etags fileloop evil-collection-xref xref
lispy-tags mode-local zoutline highlight-quoted rainbow-delimiters
jka-compr auto-minor-mode org-eldoc toc-org evil-org org-indent oc-basic
ol-bibtex bibtex saveplace evil-collection-so-long so-long tramp-sh
jupyter-tramp tramp-cache time-stamp jupyter-server
jupyter-server-kernel jupyter-repl jupyter-widget-client simple-httpd
jupyter-client jupyter-kernel jupyter-kernelspec jupyter-env
jupyter-monads thunk jupyter-messages hmac-def jupyter-mime
jupyter-rest-api websocket bindat jupyter-base eieio-base tramp trampver
tramp-integration tramp-message tramp-compat tramp-loaddefs winum hydra
lv evil-collection-evil-mc evil-mc evil-mc-command-execute
evil-mc-command-record evil-mc-cursor-make evil-mc-region
evil-mc-cursor-state evil-mc-undo evil-mc-vars evil-mc-known-commands
evil-mc-common evil-collection-help shadow sort projectile project
ibuffer-vc ibuf-ext evil-collection-ibuffer ibuffer ibuffer-loaddefs
whitespace flycheck-popup-tip evil-collection-popup popup
vi-tilde-fringe display-line-numbers mail-extr network-stream url-cache
hide-mode-line go-translate gts-engine-youdao gts-engine-stardict
gts-engine-deepl gts-engine-google-rpc gts-engine-google gts-engine-bing
gts-implements posframe gts-faces gts-core emacsbug org-capture
org-agenda the-org-mode-expansions evil-collection-org smartparens-org
org-yt org-element org-persist xdg org-id org-refile org-element-ast
inline avl-tree org ob-emacs-lisp org-table org-loaddefs ob ob-tangle ol
ob-ref ob-lob ob-table ob-exp org-macro org-src
evil-collection-sh-script sh-script smie executable org-keys oc
ob-comint org-pcomplete org-list org-footnote org-entities org-faces
evil-collection-calendar cal-menu calendar cal-loaddefs
evil-collection-magit-todos magit-todos hl-todo async
evil-collection-grep grep code-review code-review-actions
code-review-comment code-review-section code-review-bitbucket
code-review-faces shr pixel-fill kinsoku url-file svg xml emojify
evil-collection-apropos apropos code-review-gitlab code-review-utils
evil-collection-forge forge-list forge-commands forge-semi
forge-bitbucket buck forge-gogs gogs forge-gitea gtea forge-gitlab glab
forge-github forge-notify forge-revnote forge-pullreq forge-issue
forge-topic yaml parse-time iso8601 bug-reference forge-post
smartparens-markdown evil-collection-markdown-mode markdown-mode
edit-indirect noutline outline forge-repo forge forge-core forge-db
code-review-parse-hunk code-review-github code-review-db uuidgen
calc-misc calc-ext calc calc-loaddefs calc-macs a code-review-interfaces
deferred ghub-graphql treepy gsexp ghub url-http url-gw nsm url-auth
gnutls closql emacsql-sqlite emacsql-sqlite-common emacsql
emacsql-compiler magit-bookmark magit-autoloads evil-collection-magit
magit-submodule magit-blame magit-stash magit-reflog magit-bisect
magit-push magit-pull magit-fetch magit-clone magit-remote magit-commit
magit-sequence magit-notes magit-worktree magit-tag magit-merge
magit-branch magit-reset magit-files magit-refs magit-status magit
magit-repos magit-apply magit-wip magit-log which-func magit-diff
smerge-mode diff magit-core magit-autorevert magit-margin
magit-transient magit-process magit-mode git-commit magit-git magit-base
evil-collection-magit-section magit-section crm evil-collection-log-edit
log-edit message sendmail yank-media puny rfc822 mml mml-sec
evil-collection-epa epa epg rfc6068 epg-config gnus-util mm-decode
mm-bodies mm-encode mail-parse rfc2231 rfc2047 rfc2045 mm-util
ietf-drums mail-prsvr mailabbrev mail-utils gmm-utils mailheader
pcvs-util add-log with-editor doom-snippets doom-snippets-lib yasnippet
evil-collection-elisp-mode elisp-mode recentf vertico-directory
mule-util cursor-sensor delsel evil-collection-minibuffer vertico-repeat
evil-collection-helpful helpful cc-langs cc-vars cc-defs trace
evil-collection-edebug edebug evil-collection-debug debug backtrace
info-look evil-collection-info info help-fns radix-tree
evil-collection-elisp-refs elisp-refs tree-widget time-date
evil-collection-which-key which-key savehist better-jumper company-capf
company-fuzzy ht ffap company evil-collection-vertico vertico orderless
marginalia evil-goggles evil-easymotion evil-escape evil-snipe pcre2el
rxt re-builder quail ace-window avy evil-nerd-commenter
evil-nerd-commenter-operator evil-nerd-commenter-sdk smartparens-html
html-mode-expansions sgml-mode facemenu dom consult-flycheck
evil-collection-consult consult evil-collection-bookmark bookmark server
pulse color autorevert filenotify gcmh hl-line winner smartparens-config
smartparens-text smartparens loadhist ws-butler undo-fu-session undo-fu
flycheck-package package-lint evil-collection-imenu imenu
evil-collection-finder finder finder-inf lisp-mnt
evil-collection-package-menu doom-packages package browse-url
url-handlers evil-collection-flycheck flycheck persp-mode jinx
doom-modeline doom-modeline-segments doom-modeline-env
doom-modeline-core shrink-path f f-shortdoc nerd-icons nerd-icons-faces
nerd-icons-data nerd-icons-data-mdicon nerd-icons-data-flicon
nerd-icons-data-codicon nerd-icons-data-devicon nerd-icons-data-sucicon
nerd-icons-data-wicon nerd-icons-data-faicon nerd-icons-data-powerline
nerd-icons-data-octicon nerd-icons-data-pomicon nerd-icons-data-ipsicon
doom-themes-ext-org solaire-mode face-remap spacemacs-light-theme
spacemacs-theme chatgpt-shell shell-maker evil-collection-view view
shell goto-addr highlight-numbers parent-mode ielm find-func
evil-collection-eshell em-prompt eshell esh-mode esh-var esh-cmd
generator esh-ext esh-opt esh-proc esh-io esh-arg pcomplete esh-module
esh-groups esh-util files-x nhexl-mode disp-table hexl ascii-table
evil-embrace embrace expand-region text-mode-expansions
er-basic-expansions expand-region-core expand-region-custom
evil-surround let-alist ob-core org-cycle org-fold org-fold-core
org-compat ob-eval org-version org-macs turbo-log s
evil-textobj-tree-sitter evil-textobj-tree-sitter-thing-at-point
evil-textobj-tree-sitter-core treesit-langs treesit-faces
treesit-langs-build dtrt-indent evil-collection-tar-mode tar-mode
evil-collection-arc-mode arc-mode archive-mode url url-proxy url-privacy
url-expand url-methods url-history url-cookie generate-lisp-file
url-domsuf url-util url-parse auth-source password-cache url-vars
mailcap treesit delight tree-sitter tree-sitter-load tree-sitter-cli tsc
tsc-dyn tsc-dyn-get evil-collection-compile compile text-property-search
evil-collection-comint comint ansi-osc ansi-color dired-aux
dired-rainbow dired-hacks-utils dirvish transient format-spec eieio
eieio-core compat evil-collection-dired dired dired-loaddefs
tsc-obsolete direnv json map evil-collection-diff-mode
evil-collection-custom cus-edit cus-load wid-edit evil-collection
annalist diff-mode dash use-package-delight ibuf-macs targets evil
evil-integration evil-maps evil-commands reveal evil-jumps
evil-command-window evil-types evil-search evil-macros evil-repeat
evil-states evil-core advice evil-common thingatpt rect evil-vars ring
derived edmacro kmacro byte-opt use-package-bind-key bind-key comp
comp-cstr warnings icons rx doom-editor doom-projects doom-ui easy-mmode
doom-keybinds pp cl-extra help-mode use-package-core bytecomp
byte-compile general tex-site doom-start doom-modules cl-seq doom
doom-lib cl-macs cl-loaddefs cl-lib pcase gv harfbuzz jansson
dynamic-modules subr-x rmc iso-transl tooltip cconv eldoc paren electric
uniquify ediff-hook vc-hooks lisp-float-type mwheel term/x-win x-win
term/common-win x-dnd touch-screen tool-bar dnd fontset image regexp-opt
fringe tabulated-list replace newcomment text-mode lisp-mode prog-mode
register page tab-bar menu-bar rfn-eshadow isearch easymenu timer select
scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colors
frame minibuffer nadvice seq simple cl-generic indonesian philippine
cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech
european ethiopic indian cyrillic chinese composite emoji-zwj charscript
charprop case-table epa-hook jka-cmpr-hook help abbrev obarray oclosure
cl-preloaded button loaddefs theme-loaddefs faces cus-face macroexp
files window text-properties overlay sha1 md5 base64 format env
code-pages mule custom widget keymap hashtable-print-readable backquote
threads dbusbind inotify lcms2 dynamic-setting system-font-setting
font-render-setting cairo gtk x-toolkit xinput2 x multi-tty move-toolbar
make-network-process native-compile emacs)
Memory information:
((conses 16 1636739 456871) (symbols 48 101258 239) (strings 32 373071 186944)
(string-bytes 1 11965486) (vectors 16 187590) (vector-slots 8 4292959 194670)
(floats 8 4131 14649) (intervals 56 10845 3508) (buffers 992 27))
^ permalink raw reply [flat|nested] 8+ messages in thread
* bug#66989: 30.0.50; tree-sitter: treesit-defun-at-point wrong behavior in python-ts-mode
2023-11-07 16:16 bug#66989: 30.0.50; tree-sitter: treesit-defun-at-point wrong behavior in python-ts-mode Denis Zubarev
@ 2023-11-08 7:08 ` Yuan Fu
2023-11-08 20:37 ` Zubarev Dv
0 siblings, 1 reply; 8+ messages in thread
From: Yuan Fu @ 2023-11-08 7:08 UTC (permalink / raw)
To: Denis Zubarev; +Cc: 66989
> On Nov 7, 2023, at 8:16 AM, Denis Zubarev <dvzubarev@yandex.ru> wrote:
>
>
> Steps to reproduce:
> 1. emacs -Q
> 2. M-x find-file /tmp/t.py
> 3. paste to the buffer
>
> def premain():
> pa|ss
> def main():
> pass
>
> where | is cursor position for further steps
>
> 4. M-x python-ts-mode
> 5. M-x eval-expression (treesit-defun-at-point)
> treesit-defun-at-point returns nil, but I expect that it will return
> a node for `premain`.
> If you move the cursor to the beginning of the word `pass` and try again
> it will return node for `premain` function.
>
> If you eval `(treesit--things-around (point) treesit-defun-type-regexp)`,
> it returns `(nil #<treesit-node function_definition ...> nil)`
> It seems that when cursor is not on the beginning of the node, treesit
> erroneously finds next sibling.
> It prevents finding parent node correctly (premain function in this case).
> I managed to fix the problem by replacing
> `(cursor (or (nth 0 result) (nth 1 result) node)` with ~(cursor node)~ - here
> https://github.com/emacs-mirror/emacs/blob/12d1f33ceb37a2d0399af7e4054024c60a465ab8/lisp/treesit.el#L2383
> But I'm sure it is not the proper fix.
Thank you very much, Denis, your fix is actually the proper fix! But the problem is more complicated. I didn’t clearly define the (prev next parent) returned by treesit--things-around—maybe parent must enclose the prev and next node, and if there are prev and next node beyond the smallest parent node at point, they are not returned; maybe parent doesn’t have to enclose prev and next node, and we will include prev and next nodes in the return value as long as they exist.
It’s not clear which definition is more correct. I’m leaning towards the first. Maybe both are correct and useful and we should support both, hmm...
Yuan
^ permalink raw reply [flat|nested] 8+ messages in thread
* bug#66989: 30.0.50; tree-sitter: treesit-defun-at-point wrong behavior in python-ts-mode
2023-11-08 7:08 ` Yuan Fu
@ 2023-11-08 20:37 ` Zubarev Dv
2023-11-09 8:13 ` Yuan Fu
0 siblings, 1 reply; 8+ messages in thread
From: Zubarev Dv @ 2023-11-08 20:37 UTC (permalink / raw)
To: Yuan Fu; +Cc: 66989
Initially I thought that it is the second definition. It seems to be more intuitive. But after reading code, I was sure its the first case.
But I actually don't sure that all three "things" are needed at once.
For example, I think for `thing-at-point` only enclosing parent is needed.
If parent is nil, it may optionally fallback to the next sibling thing.
`treesit--navigate-thing` uses only `parent` and `next` or `prev`.
I was playing with creating evil text objects, based on your awesome
work with "things".
I ended up extracting the second part (;; 2. Find the parent) from `treesit--things-around`.
Since I only need to find enclosing parent and I don't want to pay for
what I don't use.
So it seems no function uses all results from `treesit--things-around`.
Maybe it makes sense to decompose `treesit--things-around` into two
functions:
1. (treesit--enclosing-thing (pos thing)) - returns node or nil if no
enclosing parent
2. (treesit--find-sibling (pos thing dir)) - return sibling node in
specified direction.
BTW, I've found another unexpected behavior on the same code:
1. python-ts-mode
def premain():
pa|ss
def main():
pass
2. after
(goto-char (treesit--navigate-thing (point) 1 'end treesit-defun-type-regexp))
def premain():
pass
def main():
pass|
cursor in the end of the second function
3. but if you move cursor to the beginning of pass
def premain():
|pass
def main():
pass
4. after
(goto-char (treesit--navigate-thing (point) 1 'end treesit-defun-type-regexp))
def premain():
pass|
def main():
pass
This behavior does not affected by the fix proposed in the first message.
^ permalink raw reply [flat|nested] 8+ messages in thread
* bug#66989: 30.0.50; tree-sitter: treesit-defun-at-point wrong behavior in python-ts-mode
2023-11-08 20:37 ` Zubarev Dv
@ 2023-11-09 8:13 ` Yuan Fu
2023-11-10 5:46 ` Yuan Fu
0 siblings, 1 reply; 8+ messages in thread
From: Yuan Fu @ 2023-11-09 8:13 UTC (permalink / raw)
To: Zubarev Dv; +Cc: 66989
> On Nov 8, 2023, at 12:37 PM, Zubarev Dv <dvzubarev@yandex.ru> wrote:
>
> Initially I thought that it is the second definition. It seems to be more intuitive. But after reading code, I was sure its the first case.
>
> But I actually don't sure that all three "things" are needed at once.
> For example, I think for `thing-at-point` only enclosing parent is needed.
> If parent is nil, it may optionally fallback to the next sibling thing.
> `treesit--navigate-thing` uses only `parent` and `next` or `prev`.
> I was playing with creating evil text objects, based on your awesome
> work with "things".
> I ended up extracting the second part (;; 2. Find the parent) from `treesit--things-around`.
> Since I only need to find enclosing parent and I don't want to pay for
> what I don't use.
> So it seems no function uses all results from `treesit--things-around`.
>
> Maybe it makes sense to decompose `treesit--things-around` into two
> functions:
> 1. (treesit--enclosing-thing (pos thing)) - returns node or nil if no
> enclosing parent
> 2. (treesit--find-sibling (pos thing dir)) - return sibling node in
> specified direction.
Makes sense. I think separating into two functions is ok. For treesit--enclosing-thing, we might as well call it treesit--thing-at-point ;-) Tentative plan: retire treesit—things-around, add treesit--enclosing-thing (as --thing-at-point), add treesit--find-sibling (as --sibling-thing), add treesit-node-enclose-p which tests whether a node encloses another node.
>
> BTW, I've found another unexpected behavior on the same code:
>
>
> 1. python-ts-mode
>
> def premain():
> pa|ss
> def main():
> pass
> 2. after
> (goto-char (treesit--navigate-thing (point) 1 'end treesit-defun-type-regexp))
>
> def premain():
> pass
> def main():
> pass|
>
> cursor in the end of the second function
>
> 3. but if you move cursor to the beginning of pass
>
> def premain():
> |pass
> def main():
> pass
>
> 4. after
> (goto-char (treesit--navigate-thing (point) 1 'end treesit-defun-type-regexp))
>
> def premain():
> pass|
> def main():
> pass
>
> This behavior does not affected by the fix proposed in the first message.
In the first case, treesit--navigate-thing returns a non-nil NEXT node. And treesit—navigate will prioritize NEXT node over PARENT node (because it assumes PARENT node always encloses NEXT node). Fixing the original problem should fix this too.
Yuan
^ permalink raw reply [flat|nested] 8+ messages in thread
* bug#66989: 30.0.50; tree-sitter: treesit-defun-at-point wrong behavior in python-ts-mode
2023-11-09 8:13 ` Yuan Fu
@ 2023-11-10 5:46 ` Yuan Fu
2023-11-10 7:40 ` Eli Zaretskii
2023-11-10 22:58 ` Zubarev Dv
0 siblings, 2 replies; 8+ messages in thread
From: Yuan Fu @ 2023-11-10 5:46 UTC (permalink / raw)
To: Zubarev Dv; +Cc: 66989
> On Nov 9, 2023, at 12:13 AM, Yuan Fu <casouri@gmail.com> wrote:
>
>
>
>> On Nov 8, 2023, at 12:37 PM, Zubarev Dv <dvzubarev@yandex.ru> wrote:
>>
>> Initially I thought that it is the second definition. It seems to be more intuitive. But after reading code, I was sure its the first case.
>>
>> But I actually don't sure that all three "things" are needed at once.
>> For example, I think for `thing-at-point` only enclosing parent is needed.
>> If parent is nil, it may optionally fallback to the next sibling thing.
>> `treesit--navigate-thing` uses only `parent` and `next` or `prev`.
>> I was playing with creating evil text objects, based on your awesome
>> work with "things".
>> I ended up extracting the second part (;; 2. Find the parent) from `treesit--things-around`.
>> Since I only need to find enclosing parent and I don't want to pay for
>> what I don't use.
>> So it seems no function uses all results from `treesit--things-around`.
>>
>> Maybe it makes sense to decompose `treesit--things-around` into two
>> functions:
>> 1. (treesit--enclosing-thing (pos thing)) - returns node or nil if no
>> enclosing parent
>> 2. (treesit--find-sibling (pos thing dir)) - return sibling node in
>> specified direction.
>
> Makes sense. I think separating into two functions is ok. For treesit--enclosing-thing, we might as well call it treesit--thing-at-point ;-) Tentative plan: retire treesit—things-around, add treesit--enclosing-thing (as --thing-at-point), add treesit--find-sibling (as --sibling-thing), add treesit-node-enclose-p which tests whether a node encloses another node.
>
>>
>> BTW, I've found another unexpected behavior on the same code:
>>
>>
>> 1. python-ts-mode
>>
>> def premain():
>> pa|ss
>> def main():
>> pass
>> 2. after
>> (goto-char (treesit--navigate-thing (point) 1 'end treesit-defun-type-regexp))
>>
>> def premain():
>> pass
>> def main():
>> pass|
>>
>> cursor in the end of the second function
>>
>> 3. but if you move cursor to the beginning of pass
>>
>> def premain():
>> |pass
>> def main():
>> pass
>>
>> 4. after
>> (goto-char (treesit--navigate-thing (point) 1 'end treesit-defun-type-regexp))
>>
>> def premain():
>> pass|
>> def main():
>> pass
>>
>> This behavior does not affected by the fix proposed in the first message.
>
> In the first case, treesit--navigate-thing returns a non-nil NEXT node. And treesit—navigate will prioritize NEXT node over PARENT node (because it assumes PARENT node always encloses NEXT node). Fixing the original problem should fix this too.
>
> Yuan
I’ve pushed to master four new functions: treesit--thing-prev, treesit--thing-next, treesit--thing-at, treesit-node-enclosed-p. And I updated other functions to use the new functions. Now your original example and the later ones should all work right.
Yuan
^ permalink raw reply [flat|nested] 8+ messages in thread
* bug#66989: 30.0.50; tree-sitter: treesit-defun-at-point wrong behavior in python-ts-mode
2023-11-10 5:46 ` Yuan Fu
@ 2023-11-10 7:40 ` Eli Zaretskii
2023-11-10 22:58 ` Zubarev Dv
1 sibling, 0 replies; 8+ messages in thread
From: Eli Zaretskii @ 2023-11-10 7:40 UTC (permalink / raw)
To: Yuan Fu; +Cc: 66989, dvzubarev
> Cc: 66989@debbugs.gnu.org
> From: Yuan Fu <casouri@gmail.com>
> Date: Thu, 9 Nov 2023 21:46:01 -0800
>
> I’ve pushed to master four new functions: treesit--thing-prev, treesit--thing-next, treesit--thing-at, treesit-node-enclosed-p. And I updated other functions to use the new functions. Now your original example and the later ones should all work right.
Thanks.
Should this bug be closed now?
^ permalink raw reply [flat|nested] 8+ messages in thread
* bug#66989: 30.0.50; tree-sitter: treesit-defun-at-point wrong behavior in python-ts-mode
2023-11-10 5:46 ` Yuan Fu
2023-11-10 7:40 ` Eli Zaretskii
@ 2023-11-10 22:58 ` Zubarev Dv
2023-11-11 2:31 ` Yuan Fu
1 sibling, 1 reply; 8+ messages in thread
From: Zubarev Dv @ 2023-11-10 22:58 UTC (permalink / raw)
To: Yuan Fu; +Cc: 66989
Thank you, It fixed the issues!
^ permalink raw reply [flat|nested] 8+ messages in thread
* bug#66989: 30.0.50; tree-sitter: treesit-defun-at-point wrong behavior in python-ts-mode
2023-11-10 22:58 ` Zubarev Dv
@ 2023-11-11 2:31 ` Yuan Fu
0 siblings, 0 replies; 8+ messages in thread
From: Yuan Fu @ 2023-11-11 2:31 UTC (permalink / raw)
To: Zubarev Dv; +Cc: 66989-done
> On Nov 10, 2023, at 2:58 PM, Zubarev Dv <dvzubarev@yandex.ru> wrote:
>
> Thank you, It fixed the issues!
I’ll close the report, but please feel free to follow up with any comments and suggestions.
Yuan
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2023-11-11 2:31 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-07 16:16 bug#66989: 30.0.50; tree-sitter: treesit-defun-at-point wrong behavior in python-ts-mode Denis Zubarev
2023-11-08 7:08 ` Yuan Fu
2023-11-08 20:37 ` Zubarev Dv
2023-11-09 8:13 ` Yuan Fu
2023-11-10 5:46 ` Yuan Fu
2023-11-10 7:40 ` Eli Zaretskii
2023-11-10 22:58 ` Zubarev Dv
2023-11-11 2:31 ` Yuan Fu
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.