@@ -365,10 +365,16 @@ For others, pop up *cider-error* buffer."
365365 causes nil (member ex-phase (cider-clojure-compilation-error-phases)))
366366 ; ; If the error is a compilation error (which we normally don't show
367367 ; ; *cider-error* buffer for), or the error buffer is disabled, compensate for
368- ; ; the lack of info with a overlay error.
369- (when (or (member ex-phase (cider-clojure-compilation-error-phases))
370- (not (cider--show-error-buffer-p))
371- (not (cider-connection-has-capability-p 'jvm-compilation-errors )))
368+ ; ; the lack of info with a overlay error. Verify that the provided buffer is
369+ ; ; visiting a source file.
370+ (when (and code-buffer
371+ (with-current-buffer code-buffer
372+ (or (cider-clojure-major-mode-p)
373+ (cider-clojurec-major-mode-p)
374+ (cider-clojurescript-major-mode-p)))
375+ (or (member ex-phase (cider-clojure-compilation-error-phases))
376+ (not (cider--show-error-buffer-p))
377+ (not (cider-connection-has-capability-p 'jvm-compilation-errors ))))
372378 ; ; Search if any of the received causes contains a "triage" field. Append it
373379 ; ; to the inline error message if found.
374380 (let* ((triage (seq-some (lambda (cause ) (nrepl-dict-get cause " triage" )) causes))
@@ -379,7 +385,6 @@ For others, pop up *cider-error* buffer."
379385 err-message)))
380386 (cider--display-error-unobtrusively code-buffer err-message))))
381387
382-
383388(defun cider--analyze-last-stacktrace (callback )
384389 " Send `analyze-last-stacktrace' to server and invoke CALLBACK on the result.
385390Accumulates a list of causes and then calls CALLBACK on causes and phase."
@@ -402,7 +407,7 @@ Show error overlay in BUFFER if needed."
402407 (cider--analyze-last-stacktrace
403408 (lambda (causes phase ) (cider--handle-stacktrace-response causes phase buffer))))
404409
405- (defun cider-default-err-handler (buffer )
410+ (defun cider-default-err-handler (&optional buffer )
406411 " This function determines how the error buffer is shown.
407412It delegates the actual error content to the eval or op handler.
408413Show error overlay in BUFFER if needed."
0 commit comments