Open gagbo opened 3 years ago
It would probably be better to follow the example of burly-frameset-filter-alist
and frameset-filter-alist
than to define a predicate that only tests a single thing (which would make it difficult for users to extend its behavior).
Also, FYI, the following forms are equivalent:
(unless (frame-parameter frame 'parent-frame)
t)
(not (frame-parameter frame 'parent-frame))
It would probably be better to follow the example of
burly-frameset-filter-alist
andframeset-filter-alist
than to define a predicate that only tests a single thing (which would make it difficult for users to extend its behavior).
I wast thinking about making the predicate a lambda so anyone can write and combine conditions. The issue with burly-frameset-filter-alist
is that it's used only to choose whether we should save a given frame-parameter, so we know that we only get a list of symbols and have to answer yes/no.
When choosing if we should save the whole frame there are others parameters that might be relevant:
And I couldn't find a way to express all those posibilities using anything else than a lambda. Using a filter-alist
would mean writing a complex tagging system to make for all the possible choices a enduser would like to make.
(unless (frame-parameter frame 'parent-frame) t)
I knew it was bad somehow, there were too many negations in my head to write it correctly. Thanks :)
Ok, if you think those examples might happen in actual use, then we can use a predicate instead. Specifically, we should probably use a list of "negatory" predicates, and each frame should be tested against those predicates, and if any predicate returns non-nil, the frame should be rejected. What do you think? Thanks.
The childframe part is pretty obvious since it happens with all posframe/childframe related packages (company-box, eldoc-box, ivy-posframe, its very likely helm variant, flycheck-posframe...)
Not saving if the frame has a single tab could happen if I only want to save "complex" frame configurations automatically on a hook, and I know single tab frames aren't worth it.
I'm planning to make yet another buffer grouping plugin (only difference with bufler would be to be able to assign multiple tags to a single buffer), and if I only have special buffers left in a "tag" I don't want to save the window configuration associated with this tag.
For these cases I thought that leaving the possibility of writing a custom predicate function would be better.
I can change the variable to be a list of "ignore" predicates for sure, and provide a small list of what I think would be common examples (i.e. childframes, and a "factory" that builds "ignore if placeholder
frame-parameter is set" predicates)
I'm planning to make yet another buffer grouping plugin (only difference with bufler would be to be able to assign multiple tags to a single buffer), and if I only have special buffers left in a "tag" I don't want to save the window configuration associated with this tag.
If that's really the only difference from Bufler, why not open an issue on Bufler's repo and we can talk about implementing that paradigm in Bufler? I guess it might be as "easy" as making a version of seq-group-by
that doesn't consume matches.
I can change the variable to be a list of "ignore" predicates for sure, and provide a small list of what I think would be common examples (i.e. childframes, and a "factory" that builds "ignore if
placeholder
frame-parameter is set" predicates)
That sounds good. Thanks.
Regarding that idea for Bufler, see https://github.com/alphapapa/bufler.el/commit/d623605be961316be378ffcd1e97a85069f2f7cc
If that's really the only difference from Bufler, why not open an issue on Bufler's repo and we can talk about implementing that paradigm in Bufler? I guess it might be as "easy" as making a version of
seq-group-by
that doesn't consume matches.
Sure, I was just afraid it would be too big of a change given the way defgroups was handled
This allows for example to not save childframes like the ones created by company-box and posframe
Draft implementation because