GNU bug report logs -
#53749
29.0.50; [PATCH] Xref backend for TeX buffers
Previous Next
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
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
Thanks, Arash. Agreed, on all counts. Revised patch attached.
Best, David.
On Thu, 16 May 2024 at 08:54, Arash Esbati <arash <at> gnu.org> wrote:
>
> 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
[0003-Provide-a-modified-xref-backend-for-TeX-buffers.patch (text/x-patch, attachment)]
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.