Function: web-mode-tag-fetch-closing

web-mode-tag-fetch-closing is a natively compiled function defined in web-mode.el.

Signature

(web-mode-tag-fetch-closing REGEXP POS)

Source Code

;; Defined in /nix/store/2qgnz1rp30nzfz6w0apx4kdm14if1bbs-emacs-packages-deps/share/emacs/site-lisp/elpa/web-mode-20260831.219/web-mode.el
(defun web-mode-tag-fetch-closing (regexp pos)
  (let ((counter 1) (is-comment nil) (n 0))
    (when (eq (aref regexp 1) ?\!)
      (setq is-comment t))
    (goto-char pos)
    (web-mode-tag-end)
    (while (and (> counter 0) (re-search-forward regexp nil t))
      (when (get-text-property (match-beginning 0) 'tag-beg)
        (setq n (1+ n))
        (cond
          ((and is-comment
                (eq (aref (match-string-no-properties 0) 5) ?e))
           (setq counter (1- counter)))
          (is-comment
           (setq counter (1+ counter)))
          ((eq (get-text-property (point) 'tag-type) 'end)
           (setq counter (1- counter)))
          (t
           (setq counter (1+ counter)))
          )
        ) ;when
      ) ;while
    (if (> n 0)
        (web-mode-tag-beginning)
        (goto-char pos))
    ))