Function: tex-xref-syntax-function

tex-xref-syntax-function is a byte-compiled function defined in tex-mode.el.gz.

Signature

(tex-xref-syntax-function STR BEG END)

Documentation

Provide a bespoke syntax-propertize-function for M-? (xref-find-references).

Source Code

;; Defined in /usr/src/emacs/lisp/textmodes/tex-mode.el.gz
(defun tex-xref-syntax-function (str beg end)
  "Provide a bespoke `syntax-propertize-function' for \\[xref-find-references]."
  (let* (grpb tempstr
              (shrtstr (if end
                           (progn
                             (setq tempstr (seq-take str (1- (length str))))
                             (if beg
                                 (setq tempstr (seq-drop tempstr 1))
                               tempstr))
                         (seq-drop str 1)))
              (grpa (if (and beg end)
                        (prog1
                            (list 1 "_")
                          (setq grpb (list 2 "_")))
                      (list 1 "_")))
              (re (concat beg (regexp-quote shrtstr) end))
              (temp-rule (if grpb
                             (list re grpa grpb)
                           (list re grpa))))
    ;; Simple benchmarks suggested that the speed-up from compiling this
    ;; function was nearly nil, so `eval' and its non-byte-compiled
    ;; function remain.
    (setq tex--xref-syntax-fun (eval
                                `(syntax-propertize-rules ,temp-rule)))))