@@ -244,13 +244,21 @@ The error types are represented as strings."
244
244
245
245
; ; Stacktrace filtering
246
246
247
+ (defvar cider-stacktrace--all-negative-filters
248
+ '(clj tooling dup java repl)
249
+ " Filters that remove stackframes" )
250
+
251
+ (defvar cider-stacktrace--all-positive-filters
252
+ '(project)
253
+ " Filters that ensure stackframes are shown" )
254
+
247
255
(defun cider-stacktrace--face-for-filter (filter neg-filters pos-filters )
248
256
" Return whether we should mark the filter is active or not."
249
- (cond ((member filter '(clj java repl tooling dup)) ; negative filter
257
+ (cond ((member filter cider-stacktrace--all- negative-filters)
250
258
(if (member filter neg-filters)
251
259
'cider-stacktrace-filter-active-face
252
260
'cider-stacktrace-filter-inactive-face ))
253
- ((member filter '(project)) ; positive filter
261
+ ((member filter cider-stacktrace--all- positive-filters)
254
262
(if (member filter pos-filters)
255
263
'cider-stacktrace-filter-active-face
256
264
'cider-stacktrace-filter-inactive-face ))
@@ -479,15 +487,15 @@ When it reaches 3, it wraps to 0."
479
487
(cons flag cider-stacktrace-filters)))
480
488
cider-stacktrace-positive-filters))
481
489
482
- (defun cider-stacktrace-show-only-project (&optional button )
490
+ (defun cider-stacktrace-show-only-project ()
483
491
" Display only the stackframes from the project.
484
492
BUTTON is the button at the top of the error buffer as the button calls
485
493
with the button."
486
494
(interactive )
487
495
(if (null cider-stacktrace-positive-filters)
488
496
(progn
489
497
(setq-local cider-stacktrace-prior-filters cider-stacktrace-filters)
490
- (setq-local cider-stacktrace-filters '(java clj repl tooling dup) )
498
+ (setq-local cider-stacktrace-filters cider-stacktrace-filters )
491
499
(setq-local cider-stacktrace-positive-filters '(project)))
492
500
(progn
493
501
(setq-local cider-stacktrace-filters cider-stacktrace-prior-filters)
@@ -526,9 +534,11 @@ with the button."
526
534
" Apply filter(s) indicated by the BUTTON."
527
535
(with-temp-message " Filters may also be toggled with the keyboard."
528
536
(let ((flag (button-get button 'filter )))
529
- (if flag
530
- (cider-stacktrace-toggle flag)
531
- (cider-stacktrace-toggle-all)))
537
+ (cond ((member flag cider-stacktrace--all-negative-filters)
538
+ (cider-stacktrace-toggle flag))
539
+ ((member flag cider-stacktrace--all-positive-filters)
540
+ (cider-stacktrace-show-only-project))
541
+ (t cider-stacktrace-toggle-all)))
532
542
(sit-for 5 )))
533
543
534
544
(defun cider-stacktrace-toggle-suppression (button )
@@ -603,7 +613,7 @@ prompt and whether to use a new window. Similar to `cider-find-var'."
603
613
(insert-text-button (car filter)
604
614
'filter (cadr filter)
605
615
'follow-link t
606
- 'action ( or ( nth 3 filter) 'cider-stacktrace-filter )
616
+ 'action 'cider-stacktrace-filter
607
617
'help-echo (format " Toggle %s stack frames "
608
618
(car filter)))
609
619
(insert " " ))
@@ -772,7 +782,7 @@ through the `cider-stacktrace-suppressed-errors' variable."
772
782
; ; Stacktrace filters
773
783
(cider-stacktrace-render-filters
774
784
buffer
775
- `((" Project-Only" project cider-stacktrace-show-only-project ) (" All" , nil ))
785
+ `((" Project-Only" project) (" All" , nil ))
776
786
`((" Clojure" clj) (" Java" java) (" REPL" repl)
777
787
(" Tooling" tooling) (" Duplicates" dup)))
778
788
(insert " \n " )
0 commit comments