From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Arash Esbati Newsgroups: gmane.emacs.bugs Subject: bug#53749: 29.0.50; [PATCH] Xref backend for TeX buffers Date: Thu, 16 May 2024 09:53:59 +0200 Message-ID: References: <1de34060-e93b-0a42-fff5-20e283abe0dc@yandex.ru> <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> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="37838"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 53749@debbugs.gnu.org, Ikumi Keita , Dmitry Gutov , Stefan Monnier , Tassilo Horn , Eli Zaretskii , stefankangas@gmail.com To: David Fussner Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu May 16 09:57:31 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 1s7VzV-0009Wt-ON for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 16 May 2024 09:57:29 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s7VzJ-0005Ew-D2; Thu, 16 May 2024 03:57:17 -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 1s7VzH-0005D2-5p for bug-gnu-emacs@gnu.org; Thu, 16 May 2024 03:57:15 -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 1s7Vz1-0000S8-TY for bug-gnu-emacs@gnu.org; Thu, 16 May 2024 03:57:13 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1s7Vz3-0007hF-Mh for bug-gnu-emacs@gnu.org; Thu, 16 May 2024 03:57:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Arash Esbati Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 16 May 2024 07:57:01 +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.171584619129574 (code B ref 53749); Thu, 16 May 2024 07:57:01 +0000 Original-Received: (at 53749) by debbugs.gnu.org; 16 May 2024 07:56:31 +0000 Original-Received: from localhost ([127.0.0.1]:47270 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s7VyZ-0007gw-6i for submit@debbugs.gnu.org; Thu, 16 May 2024 03:56:31 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:40342) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s7VyX-0007gq-LB for 53749@debbugs.gnu.org; Thu, 16 May 2024 03:56:30 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s7VwG-0006dN-CO; Thu, 16 May 2024 03:54:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To: From; bh=10MNOxlh0bACDO/SMICNgQIN4kU5DBR9acpu1mW1ZpI=; b=PHyIXq4VKlrmjXPTRmif k0e3b6f0i+9b2lTQfkzNZbxWzGjZJCQiGT8C00msODWwJRu9COQpwM8pGoun+z2XBHlRBzNcaK92B T278JnTDCNLE8fzrcKPYBhGVTPCryx25H28GVMtQIjbVxEY/P02eFbOJS33bUPF3PPL9b60kymztZ FMI/NHdIO/Tznyf1nozOGKbVDwWEOnhJA2Xym/phBrIYzoD08/8KvBXsmw+0fx2lNJp5GSXRKqepx 1Zug6WPkR0jSA7IvcnmdQmwolP748aRWV72kcdqteVnL9PY2yDAbdUvWhNvjQq1aGjmKHurJl07Fo m4TYhINviuBLSA==; In-Reply-To: (David Fussner's message of "Wed, 15 May 2024 16:47:46 +0100") 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:285132 Archived-At: David Fussner writes: > +(defun tex-expl-buffer-parse () > + "Identify buffers where expl3 syntax is always active." > + (save-excursion > + (goto-char (point-min)) > + (when (tex-search-noncomment > + (re-search-forward > + "\\(?:\\\\\\(?:ExplFile\\|ProvidesExpl\\|__xparse_file\\)\\)" Is the outer grouping necessary? Why not just: "\\\\\\(?:ExplFile\\|ProvidesExpl\\|__xparse_file\\)" > + nil t)) > + (setq tex-expl-buffer-p t)))) > + > +(defun tex-expl-region-set (_beg _end) > + "Create a list of regions where expl3 syntax is active. > +This function updates the list whenever `syntax-propertize' runs, and > +stores it in the buffer-local variable `tex-expl-region-list'. The > +list will always be nil when the buffer visits an expl3 file, e.g., an > +expl3 class or package, where expl3 syntax is always active." > + (unless syntax-ppss--updated-cache;; Stop forward search running twice. > + (setq tex-expl-region-list nil) > + ;; Leaving this test here allows users to set `tex-expl-buffer-p' > + ;; independently of the mode's automatic detection of an expl3 file. > + (unless tex-expl-buffer-p > + (goto-char (point-min)) > + (while (tex-search-noncomment > + (re-search-forward "\\ExplSyntaxOn" nil t)) This looks wrong, I think you want `search-forward'. > + (let ((new-beg (point)) > + (new-end (or (tex-search-noncomment > + (re-search-forward "\\ExplSyntaxOff" nil t)) Same here. > + (point-max)))) > + (push (cons new-beg new-end) tex-expl-region-list)))))) Best, Arash