Function: tagref--directive-at-point

tagref--directive-at-point is a natively compiled function defined in tagref.el.

Signature

(tagref--directive-at-point)

Documentation

Return directive info if point is inside a tagref directive.

Returns (TYPE BEG END PREFIX) where:
- TYPE is "tag" or "ref"
- BEG is the start of the tag name (after colon)
- END is point
- PREFIX is the text between colon and point
Returns nil if not inside a directive.

Source Code

;; Defined in /nix/store/mnch55hf9yszlb4dvfqhbqf0840v41qh-emacs-packages-deps/share/emacs/site-lisp/tagref.el
(defun tagref--directive-at-point ()
  "Return directive info if point is inside a tagref directive.
Returns (TYPE BEG END PREFIX) where:
- TYPE is \"tag\" or \"ref\"
- BEG is the start of the tag name (after colon)
- END is point
- PREFIX is the text between colon and point
Returns nil if not inside a directive."
  (save-excursion
    (let ((pt (point))
          (line-beg (line-beginning-position)))
      (when (re-search-backward tagref--directive-start-regexp line-beg t)
        (let* ((type (match-string 1))
               (beg (match-end 0))
               (prefix (buffer-substring-no-properties beg pt)))
          ;; Only match if we haven't passed the closing bracket
          (unless (string-match-p "]" prefix)
            (list type beg pt prefix)))))))