kubel icon indicating copy to clipboard operation
kubel copied to clipboard

Remove multiple setq calls to tabulated-list-sort-key

Open psibi opened this issue 2 years ago • 3 comments

We current set the variable tabulated-list-sort-key multiple times. This isn't really needed.

psibi avatar Sep 07 '21 13:09 psibi

Thank you for catching this! I can't remember why we do that. I feel like having a sort key is better than not having one. The risk though is that for some resource the first column isn't NAME. I did some local testing with pod/services/secrets/nodes/deployments and didn't see any issues though. Maybe the solution is to remove (setq tabulated-list-sort-key nil)? Or even better to dynamically pass a sort key?

abrochard avatar Sep 15 '21 19:09 abrochard

I feel like having a sort key is better than not having one. The risk though is that for some resource the first column isn't NAME.

Yeah, agree.

I did some local testing with pod/services/secrets/nodes/deployments and didn't see any issues though. Maybe the solution is to remove (setq tabulated-list-sort-key nil)?

The default behavior I would want is to have a non sorted thing. But I guess we can make optionally configurable with the default value of nil ?

Or even better to dynamically pass a sort key?

What do you mean by this ? You mean some interactive function to set the sort key ?

psibi avatar Sep 16 '21 05:09 psibi

I did some local testing with pod/services/secrets/nodes/deployments and didn't see any issues though. Maybe the solution is to remove (setq tabulated-list-sort-key nil)?

The default behavior I would want is to have a non sorted thing. But I guess we can make optionally configurable with the default value of nil ?

RIght now the default is to let kubectl output dictate the order (which I believe is always sorted alphabetically on the first column). The advantage to having a sort key is that it lets Emacs do some more work rather than pass arguments to kubectl. There are no disadvantages aside from potentially a bug if the first column returned from the kubectl command isn't call NAME.

Or even better to dynamically pass a sort key?

What do you mean by this ? You mean some interactive function to set the sort key ?

Yeah the column names are dynamically generated based on the output of the kubectl command for the given resource. And the output is always sorted based on first column. A nice feature would be to always make the first column name the sort key.

abrochard avatar Sep 19 '21 18:09 abrochard