Function: cider-stacktrace-navigate

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

Signature

(cider-stacktrace-navigate BUTTON)

Documentation

Navigate to the stack frame source represented by the BUTTON.

Source Code

;; Defined in ~/.emacs.d/elpa/cider-20260822.1520/cider-stacktrace.el
(defun cider-stacktrace-navigate (button)
  "Navigate to the stack frame source represented by the BUTTON."
  (let ((file-url (button-get button 'file-url))
        (line (button-get button 'line)))
    (if (and file-url line)
        ;; The middleware resolves file-url to an absolute path with an
        ;; accurate line, even for top-level anonymous functions.  Trust it
        ;; directly rather than re-resolving the var: for an anonymous
        ;; `.../fn' frame `cider-var-info' would misresolve `fn' to
        ;; `clojure.core/fn' and jump there instead (#3157).
        (cider--jump-to-loc-from-info
         (nrepl-dict "file" file-url "line" line)
         cider-stacktrace-navigate-to-other-window)
      ;; No file-url (e.g. a REPL frame with NO_SOURCE_FILE): fall back to
      ;; resolving the var or class member.
      (let* ((var (button-get button 'var))
             (class (button-get button 'class))
             (method (button-get button 'method))
             (info (or (and var (cider-var-info var))
                       (and class method (cider-member-info class method))
                       (nrepl-dict)))
             ;; Stacktrace returns more accurate line numbers, but if the
             ;; function's line was unreliable, then so is the stacktrace by the
             ;; same amount.  Set `line-shift' to the number of lines from the
             ;; beginning of defn.
             (line-shift (- (or line 0)
                            (or (nrepl-dict-get info "line") 1)))
             (file (or (nrepl-dict-get info "file")
                       (button-get button 'file)))
             ;; give priority to `info` files as `info` returns full paths.
             (info (nrepl-dict-put info "file" file)))
        (cider--jump-to-loc-from-info info cider-stacktrace-navigate-to-other-window)
        (forward-line line-shift)
        (back-to-indentation)))))