Function: sqlind-use-previous-line-indentation

sqlind-use-previous-line-indentation is a natively compiled function defined in sql-indent.el.

Signature

(sqlind-use-previous-line-indentation SYNTAX BASE-INDENTATION)

Documentation

Return the indentation of the previous non-empty line.

If the start of the previous line is before the anchor of SYNTAX, use the column of the anchor + 1.

Source Code

;; Defined in /nix/store/jxjf2h9nnkdqnn1w1mr0ag8bqng2rlrs-emacs-packages-deps/share/emacs/site-lisp/elpa/sql-indent-1.7/sql-indent.el
(defun sqlind-use-previous-line-indentation (syntax _base-indentation)
  "Return the indentation of the previous non-empty line.
If the start of the previous line is before the anchor of SYNTAX,
use the column of the anchor + 1."
  (let ((anchor (sqlind-anchor-point syntax)))
    (save-excursion
      (forward-line -1)
      (beginning-of-line)
      (while (and (looking-at "^\\s-*$") (> (point) anchor)) ; empty line, skip it
        (forward-line -1)
        (beginning-of-line))
      (back-to-indentation)
      (if (< (point) anchor)
	  (progn
	    (goto-char anchor)
	    (1+ (current-column)))
	  (current-column)))))