Function: clojure--position-for-alignment
clojure--position-for-alignment is a byte-compiled function defined in
clojure-mode.el.
Signature
(clojure--position-for-alignment)
Documentation
Non-nil if the sexp around point should be automatically aligned.
This function expects to be called immediately after an open-brace or after the function symbol in a function call.
First check if the sexp around point is a map literal, or is a
call to one of the vars listed in clojure-align-cond-forms. If
it isn't, return nil. If it is, return non-nil and place point
immediately before the forms that should be aligned.
For instance, in a map literal point is left immediately before the first key; while, in a let-binding, point is left inside the binding vector and immediately before the first binding construct.
Source Code
;; Defined in ~/.emacs.d/elpa/clojure-mode-20260325.811/clojure-mode.el
(defun clojure--position-for-alignment ()
"Non-nil if the sexp around point should be automatically aligned.
This function expects to be called immediately after an
open-brace or after the function symbol in a function call.
First check if the sexp around point is a map literal, or is a
call to one of the vars listed in `clojure-align-cond-forms'. If
it isn't, return nil. If it is, return non-nil and place point
immediately before the forms that should be aligned.
For instance, in a map literal point is left immediately before
the first key; while, in a let-binding, point is left inside the
binding vector and immediately before the first binding
construct."
(let ((point (point)))
;; Are we in a map?
(or (and (eq (char-before) ?{)
(not (eq (char-before (1- point)) ?\#)))
;; Are we in a reader conditional?
(and clojure-align-reader-conditionals
(looking-back clojure--beginning-of-reader-conditional-regexp (- (point) 4)))
;; Check cond forms and let-like forms, computing the symbol once.
(let ((sym (thing-at-point 'symbol)))
(or
;; Are we in a cond form?
(let* ((fun (car (member sym clojure-align-cond-forms)))
(method (and fun (clojure--get-indent-method fun)))
;; The number of special arguments in the cond form is
;; the number of sexps we skip before aligning.
(skip (cond ((numberp method) method)
((null method) 0)
((sequencep method) (elt method 0)))))
(when (and fun (numberp skip))
(clojure-forward-logical-sexp skip)
(comment-forward (point-max))
fun)) ; Return non-nil (the var name).
;; Are we in a let-like form?
(when (member sym clojure-align-binding-forms)
;; Position inside the binding vector.
(clojure-forward-logical-sexp)
(backward-sexp)
(when (eq (char-after) ?\[)
(forward-char 1)
(comment-forward (point-max))
;; Return non-nil.
t)))))))