Function: sqlind-right-justify-logical-operator
sqlind-right-justify-logical-operator is a natively compiled function
defined in sql-indent.el.
Signature
(sqlind-right-justify-logical-operator SYNTAX BASE-INDENTATION)
Documentation
Align an AND, OR or NOT operator with the end of the WHERE clause.
SYNTAX is the syntax of the current line, BASE-INDENTATION is the current indentation, which we need to update.
If this rule is added to the 'in-select-clause syntax after
the sqlind-lineup-to-clause-end rule, it will adjust lines
starting with AND, OR or NOT to be aligned so they sit under the
WHERE clause.
Source Code
;; Defined in /nix/store/jxjf2h9nnkdqnn1w1mr0ag8bqng2rlrs-emacs-packages-deps/share/emacs/site-lisp/elpa/sql-indent-1.7/sql-indent.el
(defun sqlind-right-justify-logical-operator (syntax base-indentation)
"Align an AND, OR or NOT operator with the end of the WHERE clause.
SYNTAX is the syntax of the current line, BASE-INDENTATION is the
current indentation, which we need to update.
If this rule is added to the \\='in-select-clause syntax after
the `sqlind-lineup-to-clause-end' rule, it will adjust lines
starting with AND, OR or NOT to be aligned so they sit under the
WHERE clause."
(save-excursion
(back-to-indentation)
(cl-destructuring-bind ((_sym clause) . anchor) (car syntax)
(if (and (equal clause "where")
(looking-at "and\\|or\\|not"))
(progn
(goto-char anchor)
(+ (current-column)
(- (length clause) (- (match-end 0) (match-beginning 0)))))
base-indentation))))