From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Kangas Newsgroups: gmane.emacs.bugs Subject: bug#53749: 29.0.50; [PATCH] Xref backend for TeX buffers Date: Sun, 9 Jun 2024 07:36:50 -0400 Message-ID: References: <2c5c8afa-b57e-3156-d21c-5523cacb4d87@yandex.ru> <831qf1mgjl.fsf@gnu.org> <87cyyj9rpp.fsf@gnu.org> <65793.1694843596@localhost> <83ba27b7-4d28-4a3f-b803-4bc49f62986c@yandex.ru> <82993b86-0f34-4adb-a392-c74db5176d14@yandex.ru> <86v832z5lp.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="16161"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 53749@debbugs.gnu.org, ikumi@ikumi.que.jp, dgutov@yandex.ru, arash@gnu.org, Stefan Monnier , tsdh@gnu.org To: David Fussner , Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Jun 09 14:41: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 1sGHrW-00040f-Sn for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 09 Jun 2024 14:41:30 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sGHqr-0006u1-AL; Sun, 09 Jun 2024 08:40:49 -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 1sGHqp-0006tS-V0 for bug-gnu-emacs@gnu.org; Sun, 09 Jun 2024 08:40:47 -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 1sGHqp-0006EP-MK for bug-gnu-emacs@gnu.org; Sun, 09 Jun 2024 08:40:47 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sGHr6-0008BL-0N for bug-gnu-emacs@gnu.org; Sun, 09 Jun 2024 08:41:04 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Kangas Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 09 Jun 2024 12:41:03 +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.171793683531209 (code B ref 53749); Sun, 09 Jun 2024 12:41:03 +0000 Original-Received: (at 53749) by debbugs.gnu.org; 9 Jun 2024 12:40:35 +0000 Original-Received: from localhost ([127.0.0.1]:35327 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sGHqc-00087C-Ey for submit@debbugs.gnu.org; Sun, 09 Jun 2024 08:40:35 -0400 Original-Received: from mail-ed1-f48.google.com ([209.85.208.48]:43154) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sGGsH-0005Ob-Er for 53749@debbugs.gnu.org; Sun, 09 Jun 2024 07:38:14 -0400 Original-Received: by mail-ed1-f48.google.com with SMTP id 4fb4d7f45d1cf-57c6d3e6606so1408786a12.0 for <53749@debbugs.gnu.org>; Sun, 09 Jun 2024 04:37:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717933011; x=1718537811; darn=debbugs.gnu.org; h=cc:to:subject:message-id:date:mime-version:references:in-reply-to :from:from:to:cc:subject:date:message-id:reply-to; bh=lGEanGL/eI+IHlXaBTXXBQ8rgrD/tE6Ym/ePXGV0MoY=; b=AVMeHwX1w/eL8DyCVobcjyuOh+quC3n6Ea3WwRLo5J90t0WAtJcE+Uk2W4cTbCBd8V A1uzX0a/5U2vAJn/o/Hsqhh11LU3JG+m89SfROSbXzEjy9i/OsXZPUGYtRHaOWmlS7K2 2XIXeusrWRxQbW80s0NdYo/1rLFhuH0nDvrmfLeje/Lj4E/yIq/GzciDIOrd57jOA5in QEsBEIq2xPi0gJdEiRmjMso/LcrWoC5LsW+BYvMlG1HSSWcXK9WPXZHzTuc1lcTefVPJ lcgUtOX2QTpFvnbp4MALkFV4w5DmuAGDwGcnEyFSRR3oYxjS842LHXIrZl0ubYMUeECa 9rVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717933011; x=1718537811; h=cc:to:subject:message-id:date:mime-version:references:in-reply-to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=lGEanGL/eI+IHlXaBTXXBQ8rgrD/tE6Ym/ePXGV0MoY=; b=uch6vWq/BNpc9htQE65zGvITQE1sjpyE6MDrUWMUQWpmLd1aDhgXZPBGKny+AujTYP 3jjjE82OYlG74PbGF/1xNzD1sBBQ4NW67WCt+cbpBvFcIe3wdnej+br/eOyoxKxNRpuK G+3uCtqVQGGxUPtWc5rhZzEHMXAsYpxUZRNxNSd9qtQiTCs9ClwOGqzRKyx10eITiFGX u5Ha7S6vCPzYV0a2CC9kitLO23u8llYXyym0F2j1ItsjmApQtiHmynsX8LbkO9YPpJ7x GPGuOdZwiAV0YPLHUySnSfvKJpeDKYVcF3lBBB04VZYGzD4h72z7+nFNPf45q+IJr4W5 K7tg== X-Forwarded-Encrypted: i=1; AJvYcCWBemmNCZx9xLG7owMfHh+k7F76HJqWgTcWH3Kx9Tfkm95qdnbpX2knTcB47bwiYc93zDr1LogMktEXr4AbwgmV4isKLxc= X-Gm-Message-State: AOJu0YxMtxzIe3eRqLMOx47TkmT4cKE+ZLG4IQp9rlu41IXaek+LVA14 Zrr7VABcuJsdi9P25oNzYv6+UnTnFHDrrFY2+MEU/zMTezjE9ISJ0BTAPy9ULVYeDPUn+EwGuMG vVZuNZdQ2KzZVKgk7gJt3sH32PC8= X-Google-Smtp-Source: AGHT+IE1ErbOS8Vo+eVOncFmg/XUSUg07iJaCcuM4Kwl8NAaxfByglW8Y/t17TTjm8RjoeW4U/zMUyfEs3Tbn7QTZ8s= X-Received: by 2002:a17:907:94c3:b0:a6f:1c58:754a with SMTP id a640c23a62f3a-a6f1c587594mr57380866b.24.1717933011172; Sun, 09 Jun 2024 04:36:51 -0700 (PDT) Original-Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Sun, 9 Jun 2024 07:36:50 -0400 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:286935 Archived-At: David Fussner writes: > In case the changeset might prove acceptable for version 30, I attach > the latest patch, which clears out the code I was using to simplify > testing of the AUCTeX modes. I have some comments and questions: - Does this need a NEWS entry? - I see the brief text you added to tex-mode.el explaining more about expl3, but perhaps there should be a clear explanation in the commit message too. - [Optional: In most places you use spaces for indentation, but here and there, there is a single tab followed by one or more spaces. Consider using only spaces.] > From: David Fussner > Date: Wed, 5 Jun 2024 10:26:18 +0100 > Subject: [PATCH] Provide a modified xref backend for TeX buffers [Don't forget to add the bug number to the ChangeLog.] > diff --git a/doc/emacs/maintaining.texi b/doc/emacs/maintaining.texi > index 579098c81b1..a064103aa25 100644 > --- a/doc/emacs/maintaining.texi > +++ b/doc/emacs/maintaining.texi > @@ -2529,6 +2529,15 @@ Identifier Search > referenced. The XREF mode commands are available in this buffer, see > @ref{Xref Commands}. > > +When invoked in a buffer whose major mode uses the @code{etags} backend, > +@kbd{M-?} searches files and buffers whose major mode matches that of > +the original buffer. It guesses that mode from file extensions, so if > +@kbd{M-?} seems to be skipping relevant buffers or files, try > +customizing either the variable @code{semantic-symref-filepattern-alist} Why does this speak of Semantic? Does `xref-find-references` depend on it somehow? > diff --git a/lib-src/etags.c b/lib-src/etags.c > index 03bc55de03d..6bc734e7df0 100644 > --- a/lib-src/etags.c > +++ b/lib-src/etags.c > @@ -5740,11 +5756,25 @@ Scheme_functions (FILE *inf) > static linebuffer *TEX_toktab = NULL; /* Table with tag tokens */ > > /* Default set of control sequences to put into TEX_toktab. > - The value of environment var TEXTAGS is prepended to this. */ > + The value of environment var TEXTAGS is prepended to this. > + (2024) Add variants of '\def', some additional LaTeX (and > + former xparse) commands, common variants from the > + 'etoolbox' package, and the main expl3 commands. */ Do we really need this comment? Isn't the git log enough? > diff --git a/lisp/textmodes/tex-mode.el b/lisp/textmodes/tex-mode.el > index 97c950267c6..fbf08840699 100644 > --- a/lisp/textmodes/tex-mode.el > +++ b/lisp/textmodes/tex-mode.el > @@ -636,6 +636,14 @@ tex-font-lock-keywords-2 > 3 '(tex-font-lock-append-prop 'bold) 'append))))) > "Gaudy expressions to highlight in TeX modes.") > > +(defvar-local tex-expl-region-list nil > + "List of region boundaries where expl3 syntax is active. > +It will be nil in buffers where expl3 syntax is always active, e.g., Please prefer "for example" to "e.g.". > +(defvar-local tex-expl-buffer-p nil > + "Non-nil in buffers where expl3 syntax is always active.") What does "always active" mean as compared to just "active"? Does this need to be elaborated? > +;; Populate `semantic-symref-filepattern-alist' for the in-tree modes; > +;; AUCTeX is doing the same for its modes. > +(with-eval-after-load 'semantic/symref/grep > + (defvar semantic-symref-filepattern-alist) > + (push '(latex-mode "*.[tT]e[xX]" "*.ltx" "*.sty" "*.cl[so]" > + "*.bbl" "*.drv" "*.hva") > + semantic-symref-filepattern-alist) > + (push '(plain-tex-mode "*.[tT]e[xX]" "*.ins") > + semantic-symref-filepattern-alist) > + (push '(doctex-mode "*.dtx") semantic-symref-filepattern-alist)) Doesn't this stuff rather belong in semantic itself? > +(cl-defmethod xref-backend-references ((_backend (eql 'tex-etags)) identifier) > + "Find references of IDENTIFIER in TeX buffers and files." > + (require 'semantic/symref/grep) Are we sure that we want to make this depend on semantic? Is there any way around that?