Function: sqlind-indent-line

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

Signature

(sqlind-indent-line)

Documentation

Indent the current line according to SQL conventions.

sqlind-basic-offset defined the number of spaces in the basic indentation unit and sqlind-indentation-offsets-alist is used to determine how to indent each type of syntactic element.

Source Code

;; Defined in /nix/store/jxjf2h9nnkdqnn1w1mr0ag8bqng2rlrs-emacs-packages-deps/share/emacs/site-lisp/elpa/sql-indent-1.7/sql-indent.el
;;;;; sqlind-indent-line

(defun sqlind-indent-line ()
  "Indent the current line according to SQL conventions.
`sqlind-basic-offset' defined the number of spaces in the basic
indentation unit and `sqlind-indentation-offsets-alist' is used to
determine how to indent each type of syntactic element."
  (let* ((syntax (sqlind-syntax-of-line))
	 (base-column (current-column))
	 (indent-column (sqlind-calculate-indentation syntax)))
    (when indent-column
      (back-to-indentation)
      (let ((offset (- base-column (current-column))))
	;; avoid modifying the buffer when the indentation does not
	;; have to change
	(unless (eq (current-column) indent-column)
	  (indent-line-to indent-column))
	(when (> offset 0)
	  (forward-char offset))))))