GNU bug report logs - #53749
29.0.50; [PATCH] Xref backend for TeX buffers

Previous Next

Package: emacs;

Reported by: David Fussner <dfussner <at> googlemail.com>

Date: Thu, 3 Feb 2022 15:10:02 UTC

Severity: normal

Tags: patch

Found in version 29.0.50

Fixed in version 31.1

Done: Stefan Kangas <stefankangas <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


Message #215 received at 53749 <at> debbugs.gnu.org (full text, mbox):

From: Arash Esbati <arash <at> gnu.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 53749 <at> debbugs.gnu.org, Ikumi Keita <ikumi <at> ikumi.que.jp>,
 Dmitry Gutov <dgutov <at> yandex.ru>, David Fussner <dfussner <at> googlemail.com>,
 stefankangas <at> gmail.com, Tassilo Horn <tsdh <at> gnu.org>,
 Eli Zaretskii <eliz <at> gnu.org>
Subject: Re: bug#53749: 29.0.50; [PATCH] Xref backend for TeX buffers
Date: Sat, 04 May 2024 16:32:25 +0200
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:

>> diff --git a/lisp/textmodes/tex-mode.el b/lisp/textmodes/tex-mode.el
>> index 97c950267c6..d990a2dbfa9 100644
>> --- a/lisp/textmodes/tex-mode.el
>> +++ b/lisp/textmodes/tex-mode.el
>> @@ -695,7 +696,25 @@ tex-verbatim-environments
>>       ("\\\\\\(?:end\\|begin\\) *\\({[^\n{}]*}\\)"
>>        (1 (ignore
>>            (tex-env-mark (match-beginning 0)
>> -                        (match-beginning 1) (match-end 1))))))))
>> +                        (match-beginning 1) (match-end 1)))))
>> +     ;; The next two rules change the syntax of `:' and `_' in expl3
>> +     ;; constructs, so that `tex-font-lock-suscript' can fontify them
>> +     ;; more accurately.
>> +     ((concat "\\(\\(?:[\\\\[:space:]{]_\\|"
>> +              "[\\\\{[:space:]][^][_[:space:][:cntrl:][:digit:]\\\\{}()/=]+\\)"
>> +              "\\(?:_+\\(?:[^][[:space:][:cntrl:][:digit:]:\\\\{}()/#_=]+\\|"
>> +              "#+[1-9]\\)\\)+\\)\\([:_]?\\)")
>
> Can you add in the comment some URL pointing to some relevant expl3
> documentation which "explains" why the above regexp makes sense?
> Also I don't clearly see how the above regexp distinguishes expl3 code
> from "normal" LaTeX code, so the comment should say something about
> it.

FWIW, I'm not sure if there is an URL for that, but in interface3.pdf,
chap.1, you'll find:

    1.1 Naming functions and variables

    LATEX3 does not use @ as a "letter"" for defining internal macros.
    Instead, the symbols _ and : are used in internal macro names to provide
    structure. The name of each function is divided into logical units using
    _, while : separates the name of the function from the argument
    specifier ("arg-spec"). This describes the arguments expected by the
    function. In most cases, each argument is represented by a single
    letter. The complete list of arg-spec letters for a function is referred
    to as the signature of the function.

So expect things like this:

    \tl_set:Nn \l_mya_tl { A }
    \tl_set:Nn \l_myb_tl { B }
    \tl_set:Nf \l_mya_tl { \l_mya_tl \l_myb_tl }

>> +;; Setup AUCTeX modes (for testing purposes only).
>> +
>> +(add-hook 'TeX-mode-hook #'tex-set-auctex-xref-backend)
>> +
>> +(defun tex-set-auctex-xref-backend ()
>> +  (add-hook 'xref-backend-functions #'tex--xref-backend nil t))
>
> I assume this will be sent to AUCTeX and is not meant to be in
> `tex-mode.el`, right?

That would have been a question from my side, but I saw that "testing
purposes only" and skipped it for this round.

Best, Arash




This bug report was last modified 243 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.