Function: cider--initialize-debug-buffer

cider--initialize-debug-buffer is a byte-compiled function defined in cider-debug.el.

Signature

(cider--initialize-debug-buffer CODE NS ID &optional REASON)

Documentation

Create a new debugging buffer with CODE and namespace NS.

ID is the id of the message that instrumented CODE. REASON is a keyword describing why this buffer was necessary.

Source Code

;; Defined in ~/.emacs.d/elpa/cider-20260414.1619/cider-debug.el
(defun cider--initialize-debug-buffer (code ns id &optional reason)
  "Create a new debugging buffer with CODE and namespace NS.
ID is the id of the message that instrumented CODE.
REASON is a keyword describing why this buffer was necessary."
  (let ((buffer-name (format cider--debug-buffer-format id)))
    (if-let* ((buffer (get-buffer buffer-name)))
        (cider-popup-buffer-display buffer 'select)
      (with-current-buffer (cider-popup-buffer buffer-name 'select
                                               #'clojure-mode 'ancillary)
        (cider-set-buffer-ns ns)
        (setq buffer-undo-list nil)
        (let ((inhibit-read-only t)
              (buffer-undo-list t))
          (erase-buffer)
          (insert (format "%s" (cider--debug-trim-code code)))
          (when code
            (insert "\n\n\n;; We had to create this temporary buffer because we couldn't find the original definition. That probably happened because "
                    reason
                    ".")
            (fill-paragraph))
          (font-lock-ensure)
          (set-buffer-modified-p nil))))
    (switch-to-buffer buffer-name)
    (goto-char (point-min))))