diff options
author | Dan Sutton <danielsutton01@gmail.com> | 2017-06-25 08:38:50 -0500 |
---|---|---|
committer | Bozhidar Batsov <bozhidar.batsov@gmail.com> | 2017-07-15 10:33:18 +0300 |
commit | 644b37c919a72103bafa8a4c9383e6b746d1573d (patch) | |
tree | 7c07fbff03ea320ba3f2e9bc1a33984361499f5a /cider-stacktrace.el | |
parent | cb4ed93b144ad60937251cf6bffc5f1efe8fb4a9 (diff) |
Show only or hide when on stackframe lines
In order to add "positive" filters, we must only show or hide when we're
actually on a stackframe line. This method takes a very naive way of starting at
the top of the buffer and considering whether to hide all lines. The other lines
just don't have any 'flags properties so they never come up as needing to be
hidden in the `(seq-intersection filters flags)` part, so hide is always false
on them. But if we want to show _only_ those lines with a particular flag this
hides the cause line and any other lines that don't have flags at all.
Diffstat (limited to 'cider-stacktrace.el')
-rw-r--r-- | cider-stacktrace.el | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/cider-stacktrace.el b/cider-stacktrace.el index 4670dbc5..bac03658 100644 --- a/cider-stacktrace.el +++ b/cider-stacktrace.el @@ -273,6 +273,12 @@ searching and update the hidden count text." (replace-match (number-to-string cider-stacktrace-hidden-frame-count))))))) +(defun cider-stacktrace-frame-p () + (get-text-property (point) 'cider-stacktrace-frame)) + +(defun cider-stacktrace-collapsed-p () + (get-text-property (point) 'collapsed)) + (defun cider-stacktrace-apply-filters (filters) "Set visibility on stack frames using FILTERS. Update `cider-stacktrace-hidden-frame-count' and indicate filters applied. @@ -284,11 +290,13 @@ hidden count." (let ((inhibit-read-only t) (hidden 0)) (while (not (eobp)) - (unless (get-text-property (point) 'collapsed) + (when (and (cider-stacktrace-frame-p) + (not (cider-stacktrace-collapsed-p))) (let* ((flags (get-text-property (point) 'flags)) (hide (if (seq-intersection filters flags) t nil))) (when hide (cl-incf hidden)) - (put-text-property (point) (line-beginning-position 2) 'invisible hide))) + (put-text-property (point) (line-beginning-position 2) + 'invisible hide))) (forward-line 1)) (setq cider-stacktrace-hidden-frame-count hidden))) (cider-stacktrace-indicate-filters filters))) @@ -606,7 +614,9 @@ This associates text properties to enable filtering and source navigation." (p2 (search-forward "/")) (p3 (search-forward-regexp "[^/$]+"))) (put-text-property p1 p4 'font-lock-face 'cider-stacktrace-ns-face) - (put-text-property p2 p3 'font-lock-face 'cider-stacktrace-fn-face))) + (put-text-property p2 p3 'font-lock-face 'cider-stacktrace-fn-face) + (put-text-property (line-beginning-position) (line-end-position) + 'cider-stacktrace-frame t))) (insert "\n"))))) (declare-function cider-jump-to "cider-interaction") @@ -717,6 +727,7 @@ through the `cider-stacktrace-suppressed-errors' variable." (cider-stacktrace-initialize causes) (font-lock-refresh-defaults))) + (provide 'cider-stacktrace) ;;; cider-stacktrace.el ends here |