Function: cider-stacktrace-initialize

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

Signature

(cider-stacktrace-initialize CAUSES)

Documentation

Set and apply CAUSES initial visibility, filters, and cursor position.

Source Code

;; Defined in ~/.emacs.d/elpa/cider-20260414.1619/cider-stacktrace.el
(defun cider-stacktrace-initialize (causes)
  "Set and apply CAUSES initial visibility, filters, and cursor position."
  (nrepl-dbind-response (car causes) (class)
    (let ((compile-error-p (equal class "clojure.lang.Compiler$CompilerException")))
      ;; Fully display innermost cause. This also applies visibility/filters.
      (cider-stacktrace-cycle-cause 1 cider-stacktrace-detail-max)
      ;; Move point (DWIM) to the compile error location if present, or to the
      ;; first stacktrace frame in displayed cause otherwise. If the error
      ;; buffer is visible in a window, ensure that window is selected while moving
      ;; point, so as to move both the buffer's and the window's point.
      (with-selected-window (or (get-buffer-window cider-error-buffer)
                                (selected-window))
        (with-current-buffer cider-error-buffer
          (goto-char (point-min))
          (if compile-error-p
              (goto-char (next-single-property-change (point) 'compile-error))
            (progn
              (while (cider-stacktrace-next-cause))
              (when-let (position (next-single-property-change (point) 'flags))
                (goto-char position)))))))))