Function: cider-repl--history-doctor-walk

cider-repl--history-doctor-walk is a byte-compiled function defined in cider-repl.el.

Signature

(cider-repl--history-doctor-walk REPL MALFORMED)

Documentation

Walk MALFORMED entries and prompt the user to delete each.

MALFORMED is a list of (INDEX . ENTRY) cells against REPL's history. Returns the list of deleted indices.

Source Code

;; Defined in ~/.emacs.d/elpa/cider-20260822.1520/cider-repl.el
(defun cider-repl--history-doctor-walk (repl malformed)
  "Walk MALFORMED entries and prompt the user to delete each.
MALFORMED is a list of (INDEX . ENTRY) cells against REPL's history.
Returns the list of deleted indices."
  (let ((buf (cider-repl--history-doctor-buffer))
        (total (length malformed))
        (i 0)
        (deleted nil)
        (done nil))
    (save-window-excursion
      (display-buffer buf)
      (unwind-protect
          (dolist (pair malformed)
            (unless done
              (cl-incf i)
              (let ((idx (car pair))
                    (entry (cdr pair)))
                (cider-repl--history-doctor-show buf idx entry i total)
                (pcase (read-char-choice
                        (format "Entry %d/%d (index %d) -- delete? (y/n/q) "
                                i total idx)
                        '(?y ?n ?q))
                  (?y (push idx deleted))
                  (?n nil)
                  (?q (setq done t))))))
        (kill-buffer buf)))
    (when deleted
      (with-current-buffer repl
        (dolist (idx (sort deleted #'>))
          (setq cider-repl-input-history
                (append (seq-take cider-repl-input-history idx)
                        (seq-drop cider-repl-input-history (1+ idx)))))))
    deleted))