Function: clojure--thread-last

clojure--thread-last is a byte-compiled function defined in clojure-mode.el.

Signature

(clojure--thread-last)

Documentation

Thread a nested sexp using ->>.

Source Code

;; Defined in ~/.emacs.d/elpa/clojure-mode-20260325.811/clojure-mode.el
(defun clojure--thread-last ()
  "Thread a nested sexp using ->>."
  (forward-sexp 2)
  (down-list -1)
  (backward-sexp)
  (unless (eq (char-before) ?\()
    (let ((contents (clojure-delete-and-extract-sexp)))
      (just-one-space 0)
      (backward-up-list)
      (insert contents "\n")
      (clojure--remove-superfluous-parens)
      ;; cljr #255 Fix dangling parens
      (forward-sexp)
      (when (and (looking-back "^\\s-*\\()+\\)\\s-*" (line-beginning-position))
                 ;; Don't join if previous line ends in a comment,
                 ;; as that would absorb the parens into the comment.
                 (not (save-excursion
                        (forward-line -1)
                        (end-of-line)
                        (nth 4 (syntax-ppss)))))
        (let ((pos (match-beginning 1)))
          (put-text-property pos (1+ pos) 'clojure-thread-line-joined t))
        (join-line))
      t)))