Function: sqlind-lineup-joins-to-anchor

sqlind-lineup-joins-to-anchor is a natively compiled function defined in sql-indent.el.

Signature

(sqlind-lineup-joins-to-anchor SYNTAX BASE-INDENTATION)

Documentation

Align JOIN keywords with the anchor point of SYNTAX.

If the line starts with an INNER,OUTER or CROSS JOIN keyword, return the column of the anchor point, otherwise return BASE-INDENTATION.

If this rule is added to select-table-continuation indentation, it will indent lines starting with JOIN keywords to line up with the FROM keyword.

Source Code

;; Defined in /nix/store/jxjf2h9nnkdqnn1w1mr0ag8bqng2rlrs-emacs-packages-deps/share/emacs/site-lisp/elpa/sql-indent-1.7/sql-indent.el
(defun sqlind-lineup-joins-to-anchor (syntax base-indentation)
  "Align JOIN keywords with the anchor point of SYNTAX.
If the line starts with an INNER,OUTER or CROSS JOIN keyword,
return the column of the anchor point, otherwise return
BASE-INDENTATION.

If this rule is added to `select-table-continuation' indentation,
it will indent lines starting with JOIN keywords to line up with
the FROM keyword."
  (save-excursion
    (back-to-indentation)
    ;; NOTE: we are a bit loose here as we only look for the first keyword
    ;; which might indicate a join regexp, e.g. we are happy to see "left"
    ;; even though, the correct statement is "left outer? join"
    (if (or (looking-at sqlind-select-join-regexp)
            (looking-at "\\bjoin\\b"))
        (sqlind-lineup-to-anchor syntax base-indentation)
      base-indentation)))