Skip to content

Composable condition DSL for projectile-kill-buffers-filter#2015

Merged
bbatsov merged 1 commit into
masterfrom
feature/kill-buffers-conditions
Jun 15, 2026
Merged

Composable condition DSL for projectile-kill-buffers-filter#2015
bbatsov merged 1 commit into
masterfrom
feature/kill-buffers-conditions

Conversation

@bbatsov

@bbatsov bbatsov commented Jun 15, 2026

Copy link
Copy Markdown
Owner

projectile-kill-buffers-filter was limited to kill-all, kill-only-files, or a bare predicate - coarse next to project.el's project-kill-buffer-conditions. This teaches the filter to also accept a list of composable conditions: buffer-name regexps, predicate functions, and (major-mode . M) / (derived-mode . M) / (not ...) / (and ...) / (or ...) forms. A buffer is killed when it matches any condition. The matcher mirrors project.el's project--buffer-check.

Fully backward compatible - the existing symbol and predicate values are untouched. The per-buffer decision now lives in a small projectile-buffer-killed-p predicate.

projectile-kill-buffers-filter could only be kill-all, kill-only-files,
or a bare predicate. That's coarse compared to project.el, where
project-kill-buffer-conditions lets you compose rules out of buffer-name
regexps, mode checks, and boolean combinators.

Teach the filter to also accept a list of such conditions: regexps,
predicate functions, and (major-mode . M) / (derived-mode . M) /
(not ...) / (and ...) / (or ...) forms, killing a buffer when it matches
any of them. The matcher mirrors project.el's project--buffer-check. The
existing symbol and predicate values keep working unchanged, so this is
purely additive.

The decision logic moves into a new projectile-buffer-killed-p
predicate, which keeps projectile-kill-buffers tidy and is easy to test.
@bbatsov bbatsov merged commit c1786a0 into master Jun 15, 2026
10 checks passed
@bbatsov bbatsov deleted the feature/kill-buffers-conditions branch June 15, 2026 14:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant