@@ -91,6 +91,7 @@ cyclical data structures."
91
91
(defvar-local cider-stacktrace-filters nil )
92
92
(defvar-local cider-stacktrace-prior-filters nil )
93
93
(defvar-local cider-stacktrace-cause-visibility nil )
94
+ (defvar-local cider-stacktrace-positive-filters nil )
94
95
95
96
(defconst cider-error-buffer " *cider-error*" )
96
97
(add-to-list 'cider-ancillary-buffers cider-error-buffer)
@@ -274,16 +275,31 @@ searching and update the hidden count text."
274
275
(number-to-string cider-stacktrace-hidden-frame-count)))))))
275
276
276
277
(defun cider-stacktrace-frame-p ()
278
+ " Indicate if the text at point is a stack frame."
277
279
(get-text-property (point ) 'cider-stacktrace-frame ))
278
280
279
281
(defun cider-stacktrace-collapsed-p ()
282
+ " Indicate if the stackframe was collapsed."
280
283
(get-text-property (point ) 'collapsed ))
281
284
282
- (defun cider-stacktrace-apply-filters (filters )
283
- " Set visibility on stack frames using FILTERS.
285
+ (defun cider-stacktrace--should-hide-p (neg-filters pos-filters flags )
286
+ " Decide whether a stackframe should be hidden or not.
287
+ NEG-FILTERS dictate which frames should be hidden while POS-FILTERS can
288
+ override this and ensure that those frames are shown.
289
+ Argument FLAGS are the flags set on the stackframe, ie: clj dup, etc."
290
+ (let ((neg (seq-intersection neg-filters flags))
291
+ (pos (seq-intersection pos-filters flags)))
292
+ (cond ((and pos neg) nil )
293
+ (pos nil )
294
+ (neg t )
295
+ (t nil ))))
296
+
297
+ (defun cider-stacktrace-apply-filters (neg-filters pos-filters )
298
+ " Set visibility on stack frames.
284
299
Update `cider-stacktrace-hidden-frame-count' and indicate filters applied.
285
300
Currently collapsed stacktraces are ignored, and do not contribute to the
286
- hidden count."
301
+ hidden count. NEG-FILTERS remove frames with the flag in that list and
302
+ POS-FILTERS ensure that frames with flag is shown."
287
303
(with-current-buffer cider-error-buffer
288
304
(save-excursion
289
305
(goto-char (point-min ))
@@ -293,13 +309,15 @@ hidden count."
293
309
(when (and (cider-stacktrace-frame-p)
294
310
(not (cider-stacktrace-collapsed-p)))
295
311
(let* ((flags (get-text-property (point ) 'flags ))
296
- (hide (if (seq-intersection filters flags) t nil )))
312
+ (hide (cider-stacktrace--should-hide-p neg-filters
313
+ pos-filters
314
+ flags)))
297
315
(when hide (cl-incf hidden))
298
316
(put-text-property (point ) (line-beginning-position 2 )
299
317
'invisible hide)))
300
318
(forward-line 1 ))
301
319
(setq cider-stacktrace-hidden-frame-count hidden)))
302
- (cider-stacktrace-indicate-filters filters)))
320
+ (cider-stacktrace-indicate-filters neg-filters pos- filters)))
303
321
304
322
305
323
(defun cider-stacktrace-apply-cause-visibility ()
@@ -325,8 +343,8 @@ hidden count."
325
343
(add-text-properties (point ) detail-end
326
344
(list 'invisible hide
327
345
'collapsed hide))))))))
328
- (cider-stacktrace-apply-filters
329
- cider-stacktrace-filters))))
346
+ (cider-stacktrace-apply-filters cider-stacktrace-filters
347
+ cider-stacktrace-positive -filters))))
330
348
331
349
; ;; Internal/Middleware error suppression
332
350
@@ -435,15 +453,18 @@ When it reaches 3, it wraps to 0."
435
453
(cider-stacktrace-apply-filters
436
454
(setq cider-stacktrace-filters
437
455
(unless cider-stacktrace-filters ; when current filters are nil,
438
- cider-stacktrace-prior-filters)))) ; reenable prior filter set
456
+ cider-stacktrace-prior-filters)) ; reenable prior filter set
457
+ cider-stacktrace-positive-filters))
439
458
440
459
(defun cider-stacktrace-toggle (flag )
441
460
" Update `cider-stacktrace-filters' to add or remove FLAG, and apply filters."
442
461
(cider-stacktrace-apply-filters
443
462
(setq cider-stacktrace-filters
444
463
(if (memq flag cider-stacktrace-filters)
445
464
(remq flag cider-stacktrace-filters)
446
- (cons flag cider-stacktrace-filters)))))
465
+ (cons flag cider-stacktrace-filters)))
466
+ cider-stacktrace-positive-filters))
467
+
447
468
448
469
(defun cider-stacktrace-toggle-java ()
449
470
" Toggle display of Java stack frames."
0 commit comments