Skip to content

Commit 7b2e892

Browse files
authored
cider-jump-to-locref-at-point: don't jump to non-existing files (#3540)
Fixes #3539
1 parent c06ed73 commit 7b2e892

File tree

3 files changed

+17
-14
lines changed

3 files changed

+17
-14
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@
1414
- [#2903](https://github.com/clojure-emacs/cider/issues/2903): Avoid `No comment syntax is defined` prompts.
1515
- Bump the `clojure-mode` required version to [5.18.0](https://github.com/clojure-emacs/clojure-mode/blob/v5.18.0/CHANGELOG.md#5180-2023-10-18)
1616

17+
### Bugs fixed
18+
19+
- [#3539](https://github.com/clojure-emacs/cider/issues/3539): `cider-jump-to-locref-at-point`: don't jump to non-existing files.
20+
1721
## 1.8.2 (2023-10-15)
1822

1923
### Changes

cider-repl.el

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1401,21 +1401,20 @@ regexes from `cider-locref-regexp-alist' to infer locations at point."
14011401
(nrepl-dict-get (cider-sync-request:info var) "file")))
14021402
(when-let* ((file (plist-get loc :file)))
14031403
;; 2) file detected by the regexp
1404-
(or
1405-
(if (file-name-absolute-p file)
1406-
file
1407-
;; when not absolute, expand within the current project
1408-
(when-let* ((proj (clojure-project-dir)))
1409-
(let ((path (expand-file-name file proj)))
1410-
(when (file-exists-p path)
1411-
path))))
1412-
;; 3) infer ns from the abbreviated path (common in
1413-
;; reflection warnings)
1414-
(let ((ns (cider-path-to-ns file)))
1415-
(cider-sync-request:ns-path ns)))))))
1404+
(let ((file-from-regexp (if (file-name-absolute-p file)
1405+
file
1406+
;; when not absolute, expand within the current project
1407+
(when-let* ((proj (clojure-project-dir)))
1408+
(expand-file-name file proj)))))
1409+
(or (when (file-readable-p file-from-regexp)
1410+
file-from-regexp)
1411+
;; 3) infer ns from the abbreviated path
1412+
;; (common in reflection warnings)
1413+
(let ((ns (cider-path-to-ns file)))
1414+
(cider-sync-request:ns-path ns))))))))
14161415
(if file
14171416
(cider--jump-to-loc-from-info (nrepl-dict "file" file "line" line) t)
1418-
(error "No source location for %s" var)))
1417+
(error "No source location for %s - you may need to adjust `cider-locref-regexp-alist' to match your logging format" var)))
14191418
(user-error "No location reference at point")))
14201419

14211420
(defvar cider-locref-hoover-overlay

doc/modules/ROOT/pages/usage/dealing_with_errors.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ To open this stacktrace in the Cider stacktrace inspector, move point
243243
somewhere over the exception and run `M-x
244244
cider-stacktrace-analyze-at-point`.
245245

246-
This also works to some extend for exceptions that are buried inside a
246+
This also works to some extent for exceptions that are buried inside a
247247
string like the following exception:
248248

249249
[source,text]

0 commit comments

Comments
 (0)