Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

### Bugs fixed

- [#3533](https://github.com/clojure-emacs/cider/issues/3533): Refine Sesman session linking to accurately work on `*cider-test-report*` buffers.
- [#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)
Expand Down
23 changes: 18 additions & 5 deletions cider-repl.el
Original file line number Diff line number Diff line change
Expand Up @@ -1761,16 +1761,29 @@ constructs."

The checking is done as follows:

* Consider if the buffer belongs to `cider-ancillary-buffers`
* If the current buffer's name equals to the value of `cider-test-report-buffer',
only accept the given session's repl if it equals `cider-test--current-repl'
* Consider if the buffer belongs to `cider-ancillary-buffers'
* Consider the buffer's filename, strip any Docker/TRAMP details from it
* Check if that filename belongs to the classpath,
or to the classpath roots (e.g. the project root dir)
* As a fallback, check if the buffer's ns form
matches any of the loaded namespaces."
(setcdr session (seq-filter #'buffer-live-p (cdr session)))
(or (member (buffer-name) cider-ancillary-buffers)
(when-let* ((repl (cadr session))
(proc (get-buffer-process repl))
(when-let ((repl (cadr session)))
(cond
((equal (buffer-name)
cider-test-report-buffer)
(or (not cider-test--current-repl)
(not (buffer-live-p cider-test--current-repl))
(equal repl
cider-test--current-repl)))

((member (buffer-name) cider-ancillary-buffers)
t)

(t
(when-let* ((proc (get-buffer-process repl))
(file (file-truename (or (buffer-file-name) default-directory))))
;; With avfs paths look like /path/to/.avfs/path/to/some.jar#uzip/path/to/file.clj
(when (string-match-p "#uzip" file)
Expand Down Expand Up @@ -1825,7 +1838,7 @@ The checking is done as follows:
(member ns (nrepl-dict-keys cider-repl-ns-cache)))
(member ns ns-list))))
(when debug
(list file "was not determined to belong to classpath:" classpath "or classpath-roots:" classpath-roots))))))))
(list file "was not determined to belong to classpath:" classpath "or classpath-roots:" classpath-roots))))))))))

(defun cider-debug-sesman-friendly-session-p ()
"`message's debugging information relative to friendly sessions.
Expand Down
30 changes: 20 additions & 10 deletions cider-test.el
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@

(make-obsolete 'cider-test-defining-forms nil "1.8.0")

(defvar cider-test--current-repl nil
"Contains the reference to the REPL where the tests were last invoked from.
This is needed for *cider-test-report* navigation
to work against the correct REPL session.")

(defvar cider-test-last-summary nil
"The summary of the last run test.")

Expand Down Expand Up @@ -289,7 +294,8 @@ prompt and whether to use a new window. Similar to `cider-find-var'."
cider-auto-select-error-buffer
#'cider-stacktrace-mode
'ancillary)
(reverse causes))))))))))
(reverse causes)))))))
cider-test--current-repl)))

(defun cider-test-stacktrace ()
"Display stacktrace for the erring test at point."
Expand Down Expand Up @@ -710,6 +716,7 @@ running them."
;; we generate a different message when running individual tests
(cider-test-echo-running ns (car tests))
(cider-test-echo-running ns)))
(setq cider-test--current-repl conn)
(let* ((retest? (eq :non-passing ns))
(request `("op" ,(cond ((stringp ns) "test")
((eq :project ns) "test-all")
Expand Down Expand Up @@ -746,15 +753,18 @@ running them."
(cider-test-echo-summary summary results elapsed-time)
(if (or (not (zerop (+ error fail)))
cider-test-show-report-on-success)
(cider-test-render-report
(cider-popup-buffer
cider-test-report-buffer
cider-auto-select-test-report-buffer)
summary
results
elapsed-time
ns-elapsed-time
var-elapsed-time)
(let ((b (cider-popup-buffer
cider-test-report-buffer
cider-auto-select-test-report-buffer)))
(with-current-buffer b
(setq-local default-directory nil))
(cider-test-render-report
b
summary
results
elapsed-time
ns-elapsed-time
var-elapsed-time))
(when (get-buffer cider-test-report-buffer)
(with-current-buffer cider-test-report-buffer
(let ((inhibit-read-only t))
Expand Down