Function: cider-ns-edit--append

cider-ns-edit--append is a byte-compiled function defined in cider-ns.el.

Signature

(cider-ns-edit--append POS TEXT)

Documentation

Insert TEXT as the last element of the list at POS.

TEXT goes on a line of its own, unless the list holds nothing but its head, as in (:require).

Source Code

;; Defined in ~/.emacs.d/elpa/cider-20261106.1225/cider-ns.el
(defun cider-ns-edit--append (pos text)
  "Insert TEXT as the last element of the list at POS.
TEXT goes on a line of its own, unless the list holds nothing but its
head, as in (:require)."
  (let* ((elements (cider-ns-edit--elements pos))
         (close (1- (scan-sexps pos 1)))
         (end (scan-sexps (car (last elements)) 1)))
    (if (null (cdr elements))
        (progn
          (goto-char end)
          (insert " " text))
      ;; Past a comment trailing the last element, but never past the
      ;; closing delimiter.
      (goto-char (min (save-excursion (goto-char end) (line-end-position))
                      close))
      (skip-chars-backward " \t" end)
      (insert "\n" text)
      (indent-according-to-mode))))