Function: clojure--convert-collection

clojure--convert-collection is a byte-compiled function defined in clojure-mode.el.

Signature

(clojure--convert-collection COLL-OPEN COLL-CLOSE)

Documentation

Convert the collection at (point) by unwrapping it an wrapping it between COLL-OPEN and COLL-CLOSE.

Source Code

;; Defined in ~/.emacs.d/elpa/clojure-mode-20260325.811/clojure-mode.el
(defun clojure--convert-collection (coll-open coll-close)
  "Convert the collection at (point)
by unwrapping it an wrapping it between COLL-OPEN and COLL-CLOSE."
  (save-excursion
    (while (and
            (not (bobp))
            (not (looking-at "(\\|{\\|\\[")))
      (backward-char))
    (when (or (eq ?\# (char-before))
              (eq ?\' (char-before)))
      (delete-char -1))
    (when (and (bobp)
               (not (memq (char-after) '(?\{ ?\( ?\[))))
      (user-error "Beginning of file reached, collection is not found"))
    (insert coll-open (substring (clojure-delete-and-extract-sexp) 1 -1) coll-close)))