Function: cider-ns-edit--edit

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

Signature

(cider-ns-edit--edit FN)

Documentation

Call FN with the start of the ns form, then follow up on its change.

FN returns a cons (CHANGED . TEXT), where CHANGED is non-nil when FN changed the ns form, which brings on cider-ns-edit-actions. The change and the follow-up undo as one step. Return FN's value.

Source Code

;; Defined in ~/.emacs.d/elpa/cider-20261106.1225/cider-ns.el
(defun cider-ns-edit--edit (fn)
  "Call FN with the start of the ns form, then follow up on its change.
FN returns a cons (CHANGED . TEXT), where CHANGED is non-nil when FN
changed the ns form, which brings on `cider-ns-edit-actions'.  The
change and the follow-up undo as one step.  Return FN's value."
  (let ((start (cider-ns-edit--check))
        (group (prepare-change-group))
        ;; As in `with-undo-amalgamate', which needs Emacs 29: don't let
        ;; undo truncation cut the step in half.
        (undo-outer-limit nil)
        (undo-limit most-positive-fixnum)
        (undo-strong-limit most-positive-fixnum))
    (activate-change-group group)
    (unwind-protect
        (save-excursion
          (save-restriction
            (widen)
            (let ((result (funcall fn start)))
              (when (car result)
                (cider-ns-edit--follow-up start))
              result)))
      (accept-change-group group)
      (undo-amalgamate-change-group group))))