ement.el icon indicating copy to clipboard operation
ement.el copied to clipboard

How to re-arrange the room list sections?

Open phil-s opened this issue 2 years ago • 1 comments

I would like to move "People" up so that it comes after "Favourite" (and then have all but the "Past 24h" sub-sections collapsed).

I'd hoped that customizing ement-room-list-default-keys would do this, but it didn't have any effect even after restarting Emacs -- and I now see that the default value of that variable doesn't actually match the sequence of what's displayed by default.

Am I missing something obvious?

phil-s avatar Jul 25 '23 12:07 phil-s

The grouping keys are based on my taxy library: https://github.com/alphapapa/taxy.el I haven't documented that part of it yet, and I'd welcome help in doing so (at least, to proofread whatever I write eventually, if not helping to draft it).

To learn about how it works, it might help to look at the history of that variable and how I've occasionally updated the default, e.g. https://github.com/alphapapa/ement.el/blame/60e9a50b8a230c00d92f639ba25040944bcda9ab/ement-room-list.el#L307-L340

Basically, if you move (people freshness) after (favourite) it should do that. Customizing the variable should work; when I modify my config from the default, I use (use-package ement :custom (ement-room-list-default-keys ...)).

and I now see that the default value of that variable doesn't actually match the sequence of what's displayed by default.

I'm not sure what you mean. It should. However, there is another step involved: sorting. This is not yet configurable, and it happens here: https://github.com/alphapapa/ement.el/blob/60e9a50b8a230c00d92f639ba25040944bcda9ab/ement-room-list.el#L640-L659 The interaction between the grouping and subsequent sorting of the rooms and groups of rooms has sometimes been challenging to make produce exactly the desired result. In the future I'd like to, probably, add features to taxy to make sorting more easily configurable, probably with a little sexp-based DSL similar to the grouping DSL. But that probably won't happen anytime soon.

Anyway, filling rooms into groups happens before sorting of rooms and sorting of groups. So if, e.g. two groups aren't affected by the subsequent sorting of groups, the group that receives a room first will be ordered first. (And note carefully that taxy-sort sorts items (rooms) in groups, while taxy-sort* sorts groups.)

I hope that this helps, but please let me know if you have more questions. You might also search the chat room for mentions of that variable, when I've helped other people customize it before. And I'm always open to suggestions for how to improve the default grouping.

alphapapa avatar Jul 29 '23 00:07 alphapapa