unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#66400: [PATCH] Fix 'treesit-query-validate'
@ 2023-10-08  2:55 nvp
  2023-10-08 22:59 ` Yuan Fu
  0 siblings, 1 reply; 6+ messages in thread
From: nvp @ 2023-10-08  2:55 UTC (permalink / raw)
  To: 66400


[-- Attachment #1.1: Type: text/plain, Size: 945 bytes --]

Tags: patch

Bug: when calling `treesit-query-validate` interactively,
the query is expanded with `treesit-query-expand`, despite being a
string. This produces unreadable output in the error message buffer.

* lisp/treesit.el (treesit-query-validate): Only expand sexp queries
before insertion into query error buffer.

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-10-05 built on noah-X580VD
Repository revision: 505c80623049d9e181918acdac8229c9a2041b1e
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12101004
System Description: Ubuntu 22.04.3 LTS

Configured using:
 'configure --prefix=/usr/local --with-modules --with-tree-sitter
--with-threads --with-x-toolkit=gtk3 --with-xwidgets --with-gnutls
--with-json --with-mailutils --with-jpeg --with-png --with-rsvg
--with-tiff --with-xml2 --with-xpm --with-imagemagick CC=gcc-12
CXX=gcc-12'

[-- Attachment #1.2: Type: text/html, Size: 1051 bytes --]

[-- Attachment #2: 0001-fix-dont-expand-string-query-in-treesit-query-valida.patch --]
[-- Type: text/x-patch, Size: 858 bytes --]

From 2583a37af1aa4b33649b74ce5f148cd8521de5b9 Mon Sep 17 00:00:00 2001
From: nverno <noah.v.peart@gmail.com>
Date: Sat, 7 Oct 2023 19:36:44 -0700
Subject: [PATCH] fix: dont expand string query in treesit-query-validate

---
 lisp/treesit.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/treesit.el b/lisp/treesit.el
index 402417c6ca9..048cdd4e594 100644
--- a/lisp/treesit.el
+++ b/lisp/treesit.el
@@ -2889,7 +2889,7 @@ treesit-query-validate
                   (start (nth 1 data))
                   (inhibit-read-only t))
              (erase-buffer)
-             (insert (treesit-query-expand query))
+             (insert (if (stringp query) query (treesit-query-expand query)))
              (goto-char start)
              (search-forward " " nil t)
              (put-text-property start (point) 'face 'error)
-- 
2.34.1


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

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

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-08  2:55 bug#66400: [PATCH] Fix 'treesit-query-validate' nvp
2023-10-08 22:59 ` Yuan Fu
     [not found]   ` <CAPVBTSe2RuoTiCibpBPu9koqVN0GaKCJJCEF1L25qT-R5_waQQ@mail.gmail.com>
2023-10-09  0:35     ` Yuan Fu
2023-10-09  2:35   ` Eli Zaretskii
2023-10-09  4:24     ` nvp
2023-10-09  5:05       ` Yuan Fu

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