unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#65098: 29.1.50; treesit-query-capture in an interactive function has no effect?
@ 2023-08-05 13:43 赵 纪阳
  2023-08-05 15:31 ` Eli Zaretskii
  0 siblings, 1 reply; 4+ messages in thread
From: 赵 纪阳 @ 2023-08-05 13:43 UTC (permalink / raw)
  To: 65098

[-- Attachment #1: Type: text/plain, Size: 4673 bytes --]

--text follows this line--

I have a test function as following:

(defun treesit-context-test-query ()
  (interactive)
  (treesit-query-capture (treesit-buffer-root-node) '((if_statement consequence: (_) @context.end) @context)))


I expected this function would return all =if statement= in a java buffer.

But if I invoke it from M-x, it doesn't print anything in *Message* buffer.

If I call it from M-:(aka. eval-expression), it does print something.


Is there a bug here? If not, how should I use it correctly? Thanks.


How to reproduce:

0. install java tree-sitter parser

1. emacs -Q

2. open a java file

3. enable java-ts-mode

4. call the function interactively from M-x




In GNU Emacs 29.1.50 (build 1, x86_64-pc-linux-gnu, X toolkit, Xaw3d
 scroll bars) of 2023-08-04 built on tux
Repository revision: 8cbd4a02a2b9823a6aa7e722af6e3d204f881aed
Repository branch: makepkg
Windowing system distributor 'The X.Org Foundation', version 11.0.12101008
System Description: Manjaro Linux

Configured using:
 'configure --prefix=/usr --sysconfdir=/etc --libexecdir=/usr/lib
 --localstatedir=/var --mandir=/usr/share/man --with-gameuser=:games
 --with-modules --without-libotf --without-m17n-flt --without-gconf
 --with-native-compilation=no --with-xinput2 --with-x-toolkit=lucid
 --with-xft --with-xaw3d --without-cairo --with-sound=no
 --with-tree-sitter --without-gpm --without-compress-install
 '--program-transform-name=s/\([ec]tags\)/\1.emacs/'
 'CFLAGS=-march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions
 -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security
 -fstack-clash-protection -fcf-protection'
 LDFLAGS=-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now'

Configured features:
ACL DBUS FREETYPE GIF GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG JSON LCMS2
LIBSYSTEMD LIBXML2 MODULES NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP
SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS TREE_SITTER WEBP X11 XAW3D XDBE
XFT XIM XINPUT2 XPM LUCID ZLIB

Important settings:
  value of $LC_MONETARY: zh_CN.UTF-8
  value of $LC_NUMERIC: zh_CN.UTF-8
  value of $LC_TIME: zh_CN.UTF-8
  value of $LANG: zh_CN.UTF-8
  value of $XMODIFIERS: @im=fcitx
  locale-coding-system: utf-8-unix

Major mode: Java

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  line-number-mode: t
  indent-tabs-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message mailcap yank-media puny dired
dired-loaddefs rfc822 mml mml-sec password-cache epa derived epg rfc6068
epg-config gnus-util text-property-search time-date subr-x mm-decode
mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader
sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils
java-ts-mode c-ts-common treesit cl-seq vc-git diff-mode easy-mmode
vc-dispatcher cc-mode cc-fonts cc-guess cc-menus cc-cmds cc-styles
cc-align cc-engine cc-vars cc-defs cl-loaddefs cl-lib china-util rmc
iso-transl tooltip cconv eldoc paren electric uniquify ediff-hook
vc-hooks lisp-float-type elisp-mode mwheel term/x-win x-win
term/common-win x-dnd 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 x-toolkit xinput2 x multi-tty make-network-process
emacs)

Memory information:
((conses 16 70348 9640)
 (symbols 48 7693 0)
 (strings 32 23042 2533)
 (string-bytes 1 809783)
 (vectors 16 14358)
 (vector-slots 8 248208 8162)
 (floats 8 28 23)
 (intervals 56 1870 0)
 (buffers 984 14))



[-- Attachment #2: Type: text/html, Size: 8629 bytes --]

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

* bug#65098: 29.1.50; treesit-query-capture in an interactive function has no effect?
  2023-08-05 13:43 bug#65098: 29.1.50; treesit-query-capture in an interactive function has no effect? 赵 纪阳
@ 2023-08-05 15:31 ` Eli Zaretskii
  2023-08-06  1:20   ` bug#65098: 回复: " 赵 纪阳
  0 siblings, 1 reply; 4+ messages in thread
From: Eli Zaretskii @ 2023-08-05 15:31 UTC (permalink / raw)
  To: 赵 =?UTF-8?Q?=E7=BA=AA=E9=98=B3; +Cc: 65098

tags 65098 notabug
thanks

> From: 赵 纪阳
>  <zjyzhaojiyang@hotmail.com>
> Date: Sat, 5 Aug 2023 13:43:31 +0000
> 
> I have a test function as following:
> 
> (defun treesit-context-test-query ()
>   (interactive)
>   (treesit-query-capture (treesit-buffer-root-node) '((if_statement consequence: (_) @context.end)
> @context)))
> 
> I expected this function would return all =if statement= in a java buffer. 
> 
> But if I invoke it from M-x, it doesn't print anything in *Message* buffer.
> 
> If I call it from M-:(aka. eval-expression), it does print something. 
> 
> Is there a bug here? If not, how should I use it correctly? Thanks.

You need to display the value the function returns, e.g., with
'message'.

There's no bug here.





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

* bug#65098: 回复: bug#65098: 29.1.50; treesit-query-capture in an interactive function has no effect?
  2023-08-05 15:31 ` Eli Zaretskii
@ 2023-08-06  1:20   ` 赵 纪阳
  2023-08-06  5:05     ` Eli Zaretskii
  0 siblings, 1 reply; 4+ messages in thread
From: 赵 纪阳 @ 2023-08-06  1:20 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 65098@debbugs.gnu.org

[-- Attachment #1: Type: text/plain, Size: 1146 bytes --]

Got it. Thanks.
Sorry for the noise, I should've tested more to make sure it's a real bug.
________________________________
发件人: Eli Zaretskii <eliz@gnu.org>
发送时间: 2023年8月5日 23:30
收件人: 赵 纪阳 <zjyzhaojiyang@hotmail.com>
抄送: 65098@debbugs.gnu.org <65098@debbugs.gnu.org>
主题: Re: bug#65098: 29.1.50; treesit-query-capture in an interactive function has no effect?

tags 65098 notabug
thanks

> From: 赵 纪阳
>  <zjyzhaojiyang@hotmail.com>
> Date: Sat, 5 Aug 2023 13:43:31 +0000
>
> I have a test function as following:
>
> (defun treesit-context-test-query ()
>   (interactive)
>   (treesit-query-capture (treesit-buffer-root-node) '((if_statement consequence: (_) @context.end)
> @context)))
>
> I expected this function would return all =if statement= in a java buffer.
>
> But if I invoke it from M-x, it doesn't print anything in *Message* buffer.
>
> If I call it from M-:(aka. eval-expression), it does print something.
>
> Is there a bug here? If not, how should I use it correctly? Thanks.

You need to display the value the function returns, e.g., with
'message'.

There's no bug here.

[-- Attachment #2: Type: text/html, Size: 2221 bytes --]

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

* bug#65098: 回复: bug#65098: 29.1.50; treesit-query-capture in an interactive function has no effect?
  2023-08-06  1:20   ` bug#65098: 回复: " 赵 纪阳
@ 2023-08-06  5:05     ` Eli Zaretskii
  0 siblings, 0 replies; 4+ messages in thread
From: Eli Zaretskii @ 2023-08-06  5:05 UTC (permalink / raw)
  To: 赵 纪阳; +Cc: 65098-done

> From: 赵 纪阳 <zjyzhaojiyang@hotmail.com>
> CC: "65098@debbugs.gnu.org" <65098@debbugs.gnu.org>
> Date: Sun, 6 Aug 2023 01:20:15 +0000
> 
> 
> Got it. Thanks. 
> Sorry for the noise, I should've tested more to make sure it's a real bug. 

Thanks, closing the bug.





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

end of thread, other threads:[~2023-08-06  5:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-05 13:43 bug#65098: 29.1.50; treesit-query-capture in an interactive function has no effect? 赵 纪阳
2023-08-05 15:31 ` Eli Zaretskii
2023-08-06  1:20   ` bug#65098: 回复: " 赵 纪阳
2023-08-06  5:05     ` Eli Zaretskii

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