Function: sqlind-indent-select-column

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

Signature

(sqlind-indent-select-column SYNTAX BASE-INDENTATION)

Documentation

Return the indentation for a column of a SELECT clause.

SYNTAX is the syntax of the current line, BASE-INDENTATION is the current indentation, which we need to update.

We try to align to the previous column start, but if we are the first column after the SELECT clause we simply add sqlind-basic-offset.

Source Code

;; Defined in /nix/store/jxjf2h9nnkdqnn1w1mr0ag8bqng2rlrs-emacs-packages-deps/share/emacs/site-lisp/elpa/sql-indent-1.7/sql-indent.el
(defun sqlind-indent-select-column (syntax base-indentation)
  "Return the indentation for a column of a SELECT clause.

SYNTAX is the syntax of the current line, BASE-INDENTATION is the
current indentation, which we need to update.

We try to align to the previous column start, but if we are the
first column after the SELECT clause we simply add
`sqlind-basic-offset'."
  (save-excursion
    (goto-char (sqlind-anchor-point syntax))
    (when (or (looking-at "select\\s *\\(top\\s +[0-9]+\\|distinct\\|unique\\)?")
              (and (eq sql-product 'postgres) (looking-at "perform\\_>")))
      (goto-char (match-end 0)))
    (skip-syntax-forward " ")
    (if (or (looking-at sqlind-comment-start-skip)
            (eolp))
        (+ base-indentation sqlind-basic-offset)
      (current-column))))