emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/cider 7b2e892db7 2/2: `cider-jump-to-locref-at-point`: don


From: ELPA Syncer
Subject: [nongnu] elpa/cider 7b2e892db7 2/2: `cider-jump-to-locref-at-point`: don't jump to non-existing files (#3540)
Date: Wed, 18 Oct 2023 09:59:49 -0400 (EDT)

branch: elpa/cider
commit 7b2e892db7ca78e2ddebe3a0e2776b8e9a15524e
Author: vemv <vemv@users.noreply.github.com>
Commit: GitHub <noreply@github.com>

    `cider-jump-to-locref-at-point`: don't jump to non-existing files (#3540)
    
    Fixes https://github.com/clojure-emacs/cider/issues/3539
---
 CHANGELOG.md                                       |  4 ++++
 cider-repl.el                                      | 25 +++++++++++-----------
 .../ROOT/pages/usage/dealing_with_errors.adoc      |  2 +-
 3 files changed, 17 insertions(+), 14 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index d5c52d6da0..8974a27a3a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -14,6 +14,10 @@
 - [#2903](https://github.com/clojure-emacs/cider/issues/2903): Avoid `No 
comment syntax is defined` prompts.
 - 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)
 
+### Bugs fixed
+
+- [#3539](https://github.com/clojure-emacs/cider/issues/3539): 
`cider-jump-to-locref-at-point`: don't jump to non-existing files.
+
 ## 1.8.2 (2023-10-15)
 
 ### Changes
diff --git a/cider-repl.el b/cider-repl.el
index 85ef19c634..8d4b6fc3bf 100644
--- a/cider-repl.el
+++ b/cider-repl.el
@@ -1401,21 +1401,20 @@ regexes from `cider-locref-regexp-alist' to infer 
locations at point."
                           (nrepl-dict-get (cider-sync-request:info var) 
"file")))
                     (when-let* ((file (plist-get loc :file)))
                       ;; 2) file detected by the regexp
-                      (or
-                       (if (file-name-absolute-p file)
-                           file
-                         ;; when not absolute, expand within the current 
project
-                         (when-let* ((proj (clojure-project-dir)))
-                           (let ((path (expand-file-name file proj)))
-                             (when (file-exists-p path)
-                               path))))
-                       ;; 3) infer ns from the abbreviated path (common in
-                       ;; reflection warnings)
-                       (let ((ns (cider-path-to-ns file)))
-                         (cider-sync-request:ns-path ns)))))))
+                      (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" var)))
+          (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")))
 
 (defvar cider-locref-hoover-overlay
diff --git a/doc/modules/ROOT/pages/usage/dealing_with_errors.adoc 
b/doc/modules/ROOT/pages/usage/dealing_with_errors.adoc
index 82bfd72c86..c820e6ee0a 100644
--- a/doc/modules/ROOT/pages/usage/dealing_with_errors.adoc
+++ b/doc/modules/ROOT/pages/usage/dealing_with_errors.adoc
@@ -243,7 +243,7 @@ To open this stacktrace in the Cider stacktrace inspector, 
move point
 somewhere over the exception and run `M-x
 cider-stacktrace-analyze-at-point`.
 
-This also works to some extend for exceptions that are buried inside a
+This also works to some extent for exceptions that are buried inside a
 string like the following exception:
 
 [source,text]



reply via email to

[Prev in Thread] Current Thread [Next in Thread]