de-vri-es / weechat-autosort

Automatically keep your buffers sorted.
GNU General Public License v3.0
76 stars 8 forks source link

Add rules to default rules for matrix buffers #18

Closed ryzokuken closed 5 years ago

ryzokuken commented 5 years ago

Copy over the IRC sorting rules for python modules for proper sorting of matrix (weechat-matrix.py) buffers.

/cc @de-vri-es as discussed on IRC 😄

de-vri-es commented 5 years ago

Thanks for the PR.

Somewhere in the past, the rules for grouping by server weren't conditional for IRC buffers. I added that condition because there were some problems with bitlbee or slack, I think. However, I can't really remember what the problem was.

If it turns out that the rules now work fine with bitlbee, slack and matrix, then I think it would be best to drop the condition and have one set of rules for everything.

Maybe it was a problem with commas in buffer names. In the past that would break the info hooks added by autosort. If so, that's been fixed with the addition of ${info:autosort_escape:...}.

Let me see if I can find out why I made the rules condition in the past. :)

de-vri-es commented 5 years ago

Thinking back a bit harder, I believe it was one of the scripts (bitlbee/slack/matrix) not setting the $server variable for server buffers, but only for the channels. Maybe I'll have to test all of them :]

de-vri-es commented 5 years ago

Right, it was for the slack script: https://github.com/de-vri-es/weechat-autosort/commit/8aecba8b37dccb1df35e369a6d89dab32f846abc

Sadly I didn't explain what the issue was in the commit message, but I'm reasonable sure it was because the server localvar wasn't set on server buffers.

Lets hope that the current version of the slack script does set it. I'll try to get round to testing soon.

de-vri-es commented 5 years ago

Sorry for the onslaught of comments, but it would appear the slack script now indeed sets the server localvar, meaning the rules should be fine without the condition. :tada:

Could you modify the PR to simply remove the condition checking for the IRC plugin from the rules?

Then there's another thing to consider for the default rules: where should we sort irc/bitlbee/slack/matrix buffers with respect to each-other? Currently they'll end up mixed with other non-IRC buffers, which isn't very nice.

What do you think? I'm leaning towards adding an ordering on $script_name along the lines of *,bitlbee,matrix,slack (alphabetical) right before $irc_last. That would put them after the IRC buffers in that order.

Or to make things more clear, we could add a helper variable $script_or_plugin that evaluates to $script_name if it's set, and to $plugin otherwise, then add an ordering on that with core,*,irc,bitlbee,matrix,slack. That could replace current rules 1 and 2.

de-vri-es commented 5 years ago

Merged, and added some additional sorting for IRC/bitlbee/matrix/slack with respect to each other.

PR to script repository can be found here: https://github.com/weechat/scripts/pull/378

ryzokuken commented 5 years ago

Thanks a lot.