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 #251 received at 53749 <at> debbugs.gnu.org (full text, mbox):

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




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.