bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#53749: 29.0.50; [PATCH] Xref backend for TeX buffers


From: Arash Esbati
Subject: bug#53749: 29.0.50; [PATCH] Xref backend for TeX buffers
Date: Thu, 16 May 2024 09:53:59 +0200
User-agent: Gnus/5.13 (Gnus v5.13)

David Fussner <dfussner@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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]