Function: web-mode-markup-indentation-origin

web-mode-markup-indentation-origin is a natively compiled function defined in web-mode.el.

Signature

(web-mode-markup-indentation-origin POS JSX-DEPTH)

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-markup-indentation-origin (pos jsx-depth)
  (save-excursion
    (let* ((found (bobp))
           (jsx-beg nil)
           (types '(start end void))
           (type nil))
      (when jsx-depth
        (setq jsx-beg (web-mode-jsx-depth-beginning-position pos jsx-depth)))
      (while (not found)
        (forward-line -1)
        (if (bobp)
            (setq pos (point)
                  found t)
            (back-to-indentation)
            (when (and jsx-beg (< (point) jsx-beg))
              (goto-char jsx-beg))
            (setq pos (point))
            (setq type (get-text-property pos 'tag-type))
            (setq found (or (and (null jsx-depth)
                                 (null (get-text-property pos 'part-side))
                                 (get-text-property pos 'tag-beg)
                                 (member type types)
                                 (null (get-text-property (1- pos) 'invisible)))
                            (and (null jsx-depth)
                                 (null (get-text-property pos 'part-side))
                                 (eq (get-text-property pos 'tag-type) 'comment)
                                 (web-mode-looking-at-p "<!--#\\(endif\\|if\\)" pos)
                                 (null (get-text-property (1- pos) 'invisible)))
                            (and jsx-depth
                                 (get-text-property pos 'tag-beg)
                                 (member type types)
                                 (null (get-text-property (1- pos) 'invisible))
                                 (eq (get-text-property pos 'jsx-depth) jsx-depth))
                            (and (get-text-property pos 'block-beg)
                                 (not type)
                                 (web-mode-block-is-control pos)
                                 (not (looking-at-p "{% commen\\|@break")))))
            ) ;if
        ) ;while
      ;;(message "indent-origin=%S" pos)
      pos)))