unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: nvp <noah.v.peart@gmail.com>
To: 66400@debbugs.gnu.org
Subject: bug#66400: [PATCH] Fix 'treesit-query-validate'
Date: Sat, 7 Oct 2023 19:55:27 -0700	[thread overview]
Message-ID: <CAPVBTSdmi39+ZrPLEUKhJJQNOBiLPnQnWa4vhFR6Do-mqkWtbA@mail.gmail.com> (raw)


[-- 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


             reply	other threads:[~2023-10-08  2:55 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-08  2:55 nvp [this message]
2023-10-08 22:59 ` bug#66400: [PATCH] Fix 'treesit-query-validate' 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAPVBTSdmi39+ZrPLEUKhJJQNOBiLPnQnWa4vhFR6Do-mqkWtbA@mail.gmail.com \
    --to=noah.v.peart@gmail.com \
    --cc=66400@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).