summaryrefslogtreecommitdiff
path: root/cider-stacktrace.el
diff options
context:
space:
mode:
authorJeff Valk <jv@jeffvalk.com>2014-06-09 19:15:13 -0400
committerJeff Valk <jv@jeffvalk.com>2014-06-10 08:26:38 -0400
commit428f36ebffc2ce2d3ca0a51370020b208f75ba6c (patch)
tree2def7e1863ff95ba8ad5526174f11962dbd573c1 /cider-stacktrace.el
parent11275356b2d4c6415e3f5a1a28388260da8e2b70 (diff)
Display compiler's error location in stacktrace.
`clojure.lang.Compiler$CompilerException`s carry the reader location of the error, but not much else. Display the compiler exception's location description (when present); then show the details from its original cause.
Diffstat (limited to 'cider-stacktrace.el')
-rw-r--r--cider-stacktrace.el24
1 files changed, 17 insertions, 7 deletions
diff --git a/cider-stacktrace.el b/cider-stacktrace.el
index 2094e9ed..dccfe6a8 100644
--- a/cider-stacktrace.el
+++ b/cider-stacktrace.el
@@ -25,6 +25,7 @@
;;; Code:
+(require 'cl-lib)
(require 'button)
(require 'dash)
(require 'easymenu)
@@ -496,6 +497,20 @@ This associates text properties to enable filtering and source navigation."
(cider-propertize-region '(detail 0)
(newline)))))))
+(defun cider-stacktrace-initialize (causes)
+ "Set and apply CAUSES initial visibility, filters, and cursor position."
+ ;; Partially display outermost cause if it's a compiler exception (the
+ ;; description reports reader location of the error).
+ (nrepl-dbind-response (first causes) (class)
+ (when (equal class "clojure.lang.Compiler$CompilerException")
+ (cider-stacktrace-cycle-cause (length causes) 1)))
+ ;; Fully display innermost cause. This also applies visibility/filters.
+ (cider-stacktrace-cycle-cause 1 cider-stacktrace-detail-max)
+ ;; Move point to first stacktrace frame in displayed cause.
+ (goto-char (point-min))
+ (while (cider-stacktrace-next-cause))
+ (goto-char (next-single-property-change (point) 'flags)))
+
(defun cider-stacktrace-render (buffer causes)
"Emit into BUFFER useful stacktrace information for the CAUSES."
(with-current-buffer buffer
@@ -514,13 +529,8 @@ This associates text properties to enable filtering and source navigation."
(let ((note (if (= num (length causes)) "Unhandled" "Caused by")))
(cider-stacktrace-render-cause buffer cause num note)
(setq num (1- num))))))
- ;; Fully display innermost cause, apply visibility/filters, and fontify.
- (cider-stacktrace-cycle-cause 1 cider-stacktrace-detail-max)
- (font-lock-refresh-defaults)
- ;; Move point to first stacktrace frame in displayed cause.
- (goto-char (point-min))
- (while (cider-stacktrace-next-cause))
- (goto-char (next-single-property-change (point) 'flags))))
+ (cider-stacktrace-initialize causes)
+ (font-lock-refresh-defaults)))
(provide 'cider-stacktrace)