alezost / bui.el

Buffer interface library for Emacs
GNU General Public License v3.0
114 stars 10 forks source link

Are Times Able to be Sorted? #6

Open WammKD opened 4 years ago

WammKD commented 4 years ago

I have a list interface with the following :format:

'((name           nil               52 t)
  (version        nil               24 t)
  (size           nil               10 bui-list-sort-numerically-2 :right-align t)
  (lastUnpacked   bui-list-get-time 32 bui-list-sort-numerically-3 :right-align t)
  (lastUnpackedBy nil               21 t)
  (status         nil                7 t))

The lastUnpacked date is given as seconds.

Rendering the data, via bui-list-get-time works like a charm; no issues there. But sorting the column goes to Hell. The dates are in, seemingly, a random order or another column is being used to sort things when the third column is told to be sorted because similar names in the name column end up getting bunched together.

If I replace bui-list-get-time with nil, sorting works exactly as I'd expect and the dates are in proper order (though displayed as Epoch seconds instead of being formatted to date/times).

I thought maybe that the original numbers weren't being kept and so it was trying to sort Emacs time objects and tried removing bui-list-sort-numerically-3 but that just resulted in BUI saying it wasn't able to sort the column.

WammKD commented 4 years ago

Whoops; forgot to tag you – again –, @alezost.

alezost commented 4 years ago

Hello, and thank you for this report! Sorry, currently I don't have time to look at it. But I hope I will do it soon enough :-)

alezost commented 3 years ago

Hello, I am very sorry that I have not looked at this earlier, and it is probably too late :blush: But anyway, did you try to use t instead of bui-list-sort-numerically-3 ? I mean this: (lastUnpacked bui-list-get-time 32 t) or if you need the right align, then: (lastUnpacked bui-list-get-time 32 t :right-align t).