bufler-groups explanation
Thank you for bufler.
I wanted to adjust something with my bufler config today and it took me a while and a bunch of experimenting to understand how bufler-groups work; so I wrote up my understanding -- for future reference, or perhaps it will suggest some ideas for expanding the docs.
Bufler groups:
-
Constructs a tree, buffers are the leaves.
-
Each buffer is assigned its path from the root to the leaf; so bufler-groups is ultimately a function like
(buf) -> [node], where eachnodeis a string. -
Each type function is
(buf) -> node; they assign one step along this path. eg.auto-*, *-match, dir, hidden -
A list of type functions will therefore return
[node]- the simple case. -
group*()functions define branching in this logic: if a buffer “matches” the group, it is then “captured” by this group and recurses into the type functions within that group for the remainder of its path. -
“Matching” a group can mean:
group(T1 T2...)-> if T1 returns non-nilgroup-and(T1 T2...)-> if all T* return non-nilgroup-or(T1 T2...)-> if any of T* return non-nilNote that T* above are returning steps in
[node].Any node == nil is dropped.
-
Since groups will capture, their order matters, because buffers will recurse into the first group they match.
-
bufler-filter-name-regexpsandbufler-filter-buffer-modescan specify rules to match buffers to the hidden entirely;bufler-filter-buffer-fnsimplement the above filters viabufler--buffer-{mode,name}-filtered-p
Question: Is it possible in this scheme to (a) reorder groups (b) mark groups as collapsed/expanded in the config?
Hi Venky,
Thanks for your thorough writeup. Describing the Bufler DSL is something I have been needing to do. However, I will be replacing Bufler's backend with one based on Taxy, which also needs documentation describing its "key"-based DSL. (Not to worry, Taxy's implementation is based on Bufler's, which served as the prototype, so it will be essentially the same.)
Question: Is it possible in this scheme to (a) reorder groups
Taxy allows groups to be sorted, as well as items within them. So when Bufler is updated to use it, it will support this.
(b) mark groups as collapsed/expanded in the config?
No, but that's a good idea. It would be fine to file an issue on Taxy's tracker suggesting it (or, more generally, a way to attach arbitrary data to Taxy structs, which could be used to record such data, which could later be used to set the initial visibility of sections).