Function: cider-jump-to-locref-at-point

cider-jump-to-locref-at-point is an interactive and byte-compiled function defined in cider-repl.el.

Signature

(cider-jump-to-locref-at-point &optional POS)

Documentation

Identify location reference at POS and navigate to it.

This function is used from help-echo property inside REPL buffers and uses regexes from cider-locref-regexp-alist to infer locations at point.

Key Bindings

Source Code

;; Defined in ~/.emacs.d/elpa/cider-20260414.1619/cider-repl.el
(defun cider-jump-to-locref-at-point (&optional pos)
  "Identify location reference at POS and navigate to it.
This function is used from help-echo property inside REPL buffers and uses
regexes from `cider-locref-regexp-alist' to infer locations at point."
  (interactive)
  (if-let* ((loc (cider-locref-at-point pos)))
      (let* ((var (plist-get loc :var))
             (line (plist-get loc :line))
             (file (or
                    ;; 1) retrieve from info middleware
                    (when var
                      (or (cider-sync-request:ns-path var)
                          (nrepl-dict-get (cider-sync-request:info var) "file")))
                    (when-let* ((file (plist-get loc :file)))
                      ;; 2) file detected by the regexp
                      (let ((file-from-regexp (if (file-name-absolute-p file)
                                                  file
                                                ;; when not absolute, expand within the current project
                                                (when-let* ((proj (clojure-project-dir)))
                                                  (expand-file-name file proj)))))
                        (or (when (file-readable-p file-from-regexp)
                              file-from-regexp)
                            ;; 3) infer ns from the abbreviated path
                            ;;    (common in reflection warnings)
                            (let ((ns (cider-path-to-ns file)))
                              (cider-sync-request:ns-path ns))))))))
        (if file
            (cider--jump-to-loc-from-info (nrepl-dict "file" file "line" line) t)
          (error "No source location for %s - you may need to adjust `cider-locref-regexp-alist' to match your logging format" var)))
    (user-error "No location reference at point")))