Function: clojure--search-whitespace-after-next-sexp

clojure--search-whitespace-after-next-sexp is a byte-compiled function defined in clojure-mode.el.

Signature

(clojure--search-whitespace-after-next-sexp &optional BOUND NOERROR)

Documentation

Move point after all whitespace after the next sexp.

Additionally, move past a comment if one exists (this is only possible when the end of the sexp coincides with the end of a line).

Set the match data group 1 to be this region of whitespace and return point.

BOUND is bounds the whitespace search.

Source Code

;; Defined in ~/.emacs.d/elpa/clojure-mode-20260325.811/clojure-mode.el
(defun clojure--search-whitespace-after-next-sexp (&optional bound _noerror)
  "Move point after all whitespace after the next sexp.
Additionally, move past a comment if one exists (this is only
possible when the end of the sexp coincides with the end of a
line).

Set the match data group 1 to be this region of whitespace and
return point.

BOUND is bounds the whitespace search."
  (unwind-protect
      (ignore-errors
        (let ((result 'continue))
          (while (eq result 'continue)
            (clojure-forward-logical-sexp 1)
            ;; Move past any whitespace or comment.
            (search-forward-regexp "\\([,\s\t]*\\)\\(;+.*\\)?" bound)
            (setq result
                  (pcase (syntax-after (point))
                    ;; End-of-line, try again on next line.
                    (`(12) 'continue)
                    ;; Closing paren, stop here.
                    (`(5 . ,_) nil)
                    ;; Anything else is something to align.
                    (_ (point)))))
          result))
    (when (and bound (> (point) bound))
      (goto-char bound))))