Skip to content

Commit 5261886

Browse files
committed
Handle cider-clojure-compilation-error-phases values that have been customized to t
Fixes #3582
1 parent 57d1dc1 commit 5261886

File tree

2 files changed

+22
-12
lines changed

2 files changed

+22
-12
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
- CIDER [Inspector](https://docs.cider.mx/cider/debugging/inspector.html): retain [`truncate-lines`](https://www.gnu.org/software/emacs/manual/html_node/emacs/Line-Truncation.html) values across screens.
99
- [#3580](https://github.com/clojure-emacs/cider/issues/3580): `cider-test`: make test vars in [test results reports](https://docs.cider.mx/cider/testing/test_reports.html) clickable.
1010
- As defined in the newly introduced `cider-test-var-keymap` var.
11+
- [#3582](https://github.com/clojure-emacs/cider/issues/3582): Handle `cider-clojure-compilation-error-phases` values that have been customized to `t`.
1112
- [#3581](https://github.com/clojure-emacs/cider/issues/3581): Bump the injected `enrich-classpath` to [1.18.5](https://github.com/clojure-emacs/enrich-classpath/compare/v1.18.4...v1.18.5).
1213
- Handles Clojure CLI `:paths` directly defined as `:aliases`.
1314

cider-eval.el

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -486,15 +486,18 @@ op/situation that originated this error."
486486
(let ((error-buffer (cider-new-error-buffer #'cider-stacktrace-mode error-types)))
487487
(cider-stacktrace-render error-buffer (reverse causes) error-types))))
488488

489-
(defcustom cider-clojure-compilation-error-phases '("read-source"
490-
"macro-syntax-check"
491-
"macroexpansion"
492-
"compile-syntax-check"
493-
"compilation"
494-
;; "execution" is certainly not to be included here.
495-
;; "read-eval-result" and "print-eval-result" are not to be included here,
496-
;; because they mean that the code has been successfully executed.
497-
)
489+
(defconst cider-clojure-compilation-error-phases-default-value
490+
'("read-source"
491+
"macro-syntax-check"
492+
"macroexpansion"
493+
"compile-syntax-check"
494+
"compilation"
495+
;; "execution" is certainly not to be included here.
496+
;; "read-eval-result" and "print-eval-result" are not to be included here,
497+
;; because they mean that the code has been successfully executed.
498+
))
499+
500+
(defcustom cider-clojure-compilation-error-phases cider-clojure-compilation-error-phases-default-value
498501
"Error phases which will not cause the `*cider-error*' buffer to pop up.
499502
500503
The default value results in no stacktrace being shown for compile-time errors.
@@ -511,6 +514,12 @@ https://clojure.org/reference/repl_and_main#_at_repl"
511514
:group 'cider
512515
:package-version '(cider . "0.18.0"))
513516

517+
(defun cider-clojure-compilation-error-phases ()
518+
"Get the normalized value of the `cider-clojure-compilation-error-phases' var."
519+
(if (equal t cider-clojure-compilation-error-phases)
520+
cider-clojure-compilation-error-phases-default-value
521+
cider-clojure-compilation-error-phases))
522+
514523
(defun cider--handle-stacktrace-response (response causes ex-phase)
515524
"Handle stacktrace RESPONSE, aggregate the result into CAUSES, honor EX-PHASE.
516525
If RESPONSE contains a cause, cons it onto CAUSES and return that. If
@@ -521,7 +530,7 @@ into a new error buffer."
521530
(nrepl-notify msg type))
522531
(class (cons response causes))
523532
(status
524-
(unless (member ex-phase cider-clojure-compilation-error-phases)
533+
(unless (member ex-phase (cider-clojure-compilation-error-phases))
525534
(cider--render-stacktrace-causes causes))))))
526535

527536
(defun cider-default-err-op-handler ()
@@ -832,7 +841,7 @@ REPL buffer. This is controlled via
832841

833842
(defun cider--error-phase-of-last-exception (buffer)
834843
"Returns the :phase of the latest exception associated to BUFFER, if any."
835-
(when cider-clojure-compilation-error-phases
844+
(when (cider-clojure-compilation-error-phases)
836845
(when-let ((conn (with-current-buffer buffer
837846
(cider-current-repl))))
838847
(when (cider-nrepl-op-supported-p "analyze-last-stacktrace" conn)
@@ -872,7 +881,7 @@ depending on the PHASE."
872881
(not (cider-connection-has-capability-p 'jvm-compilation-errors))
873882
;; if we won't show *cider-error*, because of an ignored phase, the overlay is adequate:
874883
(and cider-show-error-buffer
875-
(member phase cider-clojure-compilation-error-phases)))
884+
(member phase (cider-clojure-compilation-error-phases))))
876885
;; Display errors as temporary overlays
877886
(let ((cider-result-use-clojure-font-lock nil)
878887
(trimmed-err (funcall cider-inline-error-message-function err)))

0 commit comments

Comments
 (0)