From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: David Fussner via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#53749: 29.0.50; [PATCH] Xref backend for TeX buffers Date: Thu, 2 May 2024 14:32:37 +0100 Message-ID: References: <87o7vq0zir.fsf@gnus.org> <8735d20yvd.fsf@gnus.org> <2c5c8afa-b57e-3156-d21c-5523cacb4d87@yandex.ru> <831qf1mgjl.fsf@gnu.org> <87cyyj9rpp.fsf@gnu.org> <65793.1694843596@localhost> Reply-To: David Fussner Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="00000000000084407a061778a27e" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="12463"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 53749@debbugs.gnu.org, Ikumi Keita , Arash Esbati , Stefan Monnier , Tassilo Horn , Eli Zaretskii , stefankangas@gmail.com To: Dmitry Gutov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu May 02 15:33:06 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1s2WYb-0002wU-F4 for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 02 May 2024 15:33:05 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s2WYE-0002iv-HW; Thu, 02 May 2024 09:32:42 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s2WYC-0002ig-Qf for bug-gnu-emacs@gnu.org; Thu, 02 May 2024 09:32:40 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s2WYC-0006hg-GK for bug-gnu-emacs@gnu.org; Thu, 02 May 2024 09:32:40 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1s2WYY-0003I2-7V for bug-gnu-emacs@gnu.org; Thu, 02 May 2024 09:33:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: David Fussner Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 02 May 2024 13:33:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 53749 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: pending patch Original-Received: via spool by 53749-submit@debbugs.gnu.org id=B53749.171465678112640 (code B ref 53749); Thu, 02 May 2024 13:33:02 +0000 Original-Received: (at 53749) by debbugs.gnu.org; 2 May 2024 13:33:01 +0000 Original-Received: from localhost ([127.0.0.1]:43832 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s2WYW-0003Ho-KF for submit@debbugs.gnu.org; Thu, 02 May 2024 09:33:01 -0400 Original-Received: from mail-pg1-x536.google.com ([2607:f8b0:4864:20::536]:44246) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s2WYU-0003Hi-AL for 53749@debbugs.gnu.org; Thu, 02 May 2024 09:32:59 -0400 Original-Received: by mail-pg1-x536.google.com with SMTP id 41be03b00d2f7-60c49bdbcd3so3170266a12.0 for <53749@debbugs.gnu.org>; Thu, 02 May 2024 06:32:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20230601; t=1714656750; x=1715261550; darn=debbugs.gnu.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=qbfkAEgVCtaFAoWF+BM65A4yLl8Bt1U72KGGUav95W4=; b=R5a1++6IEN9AZYk0TsMR5MsVzpZQmbfsn5Ph2/ad+466eDd1X1lin86HwnQhfoG2fZ Z4S+IGn8F1oRcP1ZHUHnGBtBSn+Hh33c4FQU34XMBcqfXZSAI0wvb8q/TlJl2aQmqQ0g Q2y3zPtqbEMLkx+1iGF1Rn0qnn3OBG2GCasj7gEhdZjiCJceRhjUDUvHv2uVNaGa4W+2 anouIa0FMdBR0Fz/vIJvYslXKTWDK6kBXEDs4GMo328goYi+2tuTK4MCBdZa2QGLOGHQ rGQ+qix77thckO4g172e5gYCokLng3oiHsNYgtTkDJykIImIMvpcWQC29YM30B/CqMn1 p9+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714656750; x=1715261550; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=qbfkAEgVCtaFAoWF+BM65A4yLl8Bt1U72KGGUav95W4=; b=RrO/JCAB2dfAer6CVotz4O//NTOBNsNYyI9r41pdl1PRFTrRWJPHfvfppzXaakNUPx AGrtYJyTc6KEon9T2UCmXS8QLhuDN1/H8uThFfpGQq0wvMMOtS8G392EP+RlLZOg/wjH EmmLJCn5on10EHtMGP6uFnSg8tGXyNPUtBgBmT2pbpKtSxzPb4Efjut37duTCjZsH9c8 XQ9GhTSZOy3sUxRA6lz0b6STnWfVWChA8QLxx+DPyRE232RqTMfttWkg3XP2fTQNXHG8 3dajS/euYuGImzrIy1eT7qILVNJ4v6IoetdYiFq2fM2iB1PNzwdxt6Vuvzl/4fSARySJ 7yLQ== X-Forwarded-Encrypted: i=1; AJvYcCUNyBtf33TllTCwIXk/lAQXjWVUZWcim+RxCgq0Tdr+WdyZqduG0wJJmtSK+zpgOlemykUEwkdHFSwQqwsgCo7sPfASiCw= X-Gm-Message-State: AOJu0Yyzl1BoqN+rMZeOBRZq24oUvoDsJVgguTvFgWo9Qq6qJSjhermz orPBiMVyQ4aYbonI1+8h8kFqOnjKjWGsFkT7n4WhPoDl3IoehnRJOoIYaU8Jp4lW70VqL/EP34Q 47dbgbhBR0HcJ5zMAPwAfkg3h8RU= X-Google-Smtp-Source: AGHT+IEtrE8TwQ7uKl4f/nvs8k1DeaMOXtVy13zWOwj9H68rD7jzBXTRk/8W9/kxRf34w6IeRTzuts2MvuCcU72JFKw= X-Received: by 2002:a17:90a:a012:b0:2b2:7e94:c5fa with SMTP id q18-20020a17090aa01200b002b27e94c5famr5713699pjp.5.1714656750346; Thu, 02 May 2024 06:32:30 -0700 (PDT) In-Reply-To: X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:284323 Archived-At: --00000000000084407a061778a27e Content-Type: text/plain; charset="UTF-8" Hi Dmitry, Thanks for looking over the patch. Here's the recipe for the purported bug in xref.el: 1. Please apply my patch to tex-mode.el (and xref.el). 2. I've attached xref-bug.zip, which contains a directory with 4 identical LaTeX files and one LaTeX file with a single additional character. Please extract it. 3. emacs -Q 4. C-x C-f xref-bug/mwea.ltx, and please don't visit the other 4 files. 5. Put point on \__hook_debug:n in line 6. 6. M-?, RTN, ... RTN, RTN. The xref buffer should offer 5 hits, one from each file in the directory. 7. Comment out the the line I added to xref--collect-matches, byte-compile and load the file. 8. With point in the same place, M-?, RTN, ... RTN, RTN. The xref buffer should offer 3 hits. The first is from the file-visiting buffer (where I also set syntax-propertize--done to 0, because in my testing there could be some issues here, too). The second hit is from the first file opened in *xref-temp. Here, syntax-propertize runs to line-end, and all is well. The next two files are missed, because syntax-propertize--done is set to line-end and they have exactly the same line length as file two, and therefore syntax-propertize thinks that's good enough and doesn't actually change anything. The fifth file has an additional character in line 6, so syntax-propertize decides it needs to work on this line because line-end > syntax-propertize--done. You can put point on, say, \documentclass, and you'll get all 5 hits, because this string doesn't begin or end with a non-word, non-symbol character, and syntax-propertize doesn't need to run. You can make the search string "\documentclass" and you'll get 2 hits, as line 1 has the same length in all 5 files. (It's worth trying "\usepackage" as the search string, too.) That's my diagnosis anyway. Does it make sense? Thanks, David. On Thu, 2 May 2024 at 01:43, Dmitry Gutov wrote: > > On 29/04/2024 17:15, David Fussner via Bug reports for GNU Emacs, the > Swiss army knife of text editors wrote: > > though I had to add a one-liner in xref.el to fix > > what I believe is a minor bug there preventing syntax-propertize from > > doing its work when the temp buffer holds text from a new file. (I can > > provide a recipe for this if you want.) > > Yes, could you please expand on it separately? > > The rest of the patch description just makes sense to me, and I'd be > happy to leave (or not) the detailed review to whoever reviews TeX > contributions around here, but this is something I'll need to pay > special attention to. --00000000000084407a061778a27e Content-Type: application/zip; name="xref-bug.zip" Content-Disposition: attachment; filename="xref-bug.zip" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_lvpa9gqw0 UEsDBBQAAAAIANFpolg38qovlwAAAOUAAAARABwAeHJlZi1idWcvbXdlYS5sdHhVVAkAA6qDM2bR gzNmdXgLAAEE6AMAAARkAAAAVY4xDoMwEAR7XsEXktJ9WlKkjCPLmMMgzPnCHQrIyt9jF5Gg3R3N ru6iW2dAccEyPy9Xkleyi4wuwLfSKwNZN1kPqY8oTODO6UZ24ULeNgqPHcVud6x0G2MwCB/V1Nob M8Q4mQ7a1ZvSVNpxaQ28VZOJI6CwLn6DEUHhydv3WQx+xPQ/nXdlGJnyE5Y9QIKZZM8pYHeAflBL AwQUAAAACADnaaJYN/KqL5cAAADlAAAAEQAcAHhyZWYtYnVnL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