Function: web-mode-tag-end-position

web-mode-tag-end-position is a natively compiled function defined in web-mode.el.

Signature

(web-mode-tag-end-position &optional 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-end-position (&optional pos)
  (unless pos (setq pos (point)))
  (let (end depth)
    (setq depth (get-text-property pos 'jsx-depth))
    (when (and depth (get-text-property pos 'tag-attr-beg))
      (setq depth (get-text-property (1- pos) 'jsx-depth)))
    (cond
      ((null pos)
       (setq end nil))
      ((get-text-property pos 'tag-end)
       (setq end pos))
      ((get-text-property pos 'tag-type)
       (setq end (next-single-property-change pos 'tag-end))
       (cond
         ((not (get-text-property end 'tag-end))
          (setq end nil))
         ((and depth (not (eq depth (get-text-property end 'jsx-depth))))
          (let ((continue (< end (point-max))))
            (while continue
              (setq end (1+ end))
              (setq end (next-single-property-change end 'tag-end))
              (cond
                ((null end)
                 (setq continue nil))
                ((not (get-text-property end 'tag-end))
                 (setq continue nil
                       end nil))
                ((eq depth (get-text-property end 'jsx-depth))
                 (setq continue nil))
                ) ;cond
              ) ;while
            ) ;let
          )
         ) ;cond
       )
      (t
       (setq end nil))
      ) ;cond
    end))