Function: web-mode-previous-line

web-mode-previous-line is a natively compiled function defined in web-mode.el.

Signature

(web-mode-previous-line POS LIMIT)

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-previous-line (pos limit)
  (save-excursion
    (let (beg end line (continue t))
      (goto-char pos)
      (while continue
        (forward-line -1)
        (setq end (line-end-position))
        (setq line (buffer-substring-no-properties (point) end))
        (when (or (not (string-match-p "^[ \t]*$" line))
                  (bobp)
                  (<= (point) limit))
          (setq continue nil))
        )
      (if (<= (point) limit)
          ;;todo : affiner (le + 3 n est pas générique cf. <?php <% <%- etc.)
          (setq beg (if (< (+ limit 3) end) (+ limit 3) end))
          (setq beg (line-beginning-position))
          ) ;if
      (setq line (buffer-substring-no-properties beg end))
      (cons line (current-indentation))
      )))