Subject: bug#13411: 24.2.91; Sorting in Buffer Menu Mode

From: Lars Ingebrigtsen <[email-masked]>
Date: Thu, 15 Jul 2021 17:37:43 +0200

"Aaron S. Hawley" <[email-masked]> writes:

> I can live with these changes except for one:  How do I disable
> sorting so that it goes back to the default order of buffer-list?

This is a general issue with tabulated-list-mode -- there's no way to
get back to the original order after sorting.

That is, the caller will put the data in `tabulated-list-entries', and
it'll be displayed in that order.  When sorting, tabulated-list-mode
will then sort on the data in a column, and that destructively modifies
`tabulated-list-entries'.

So to get back to the original order, we can't rely on re-sorting -- we
really have to know what the original order was, which means that we
have to store that somewhere.  I've now done so in Emacs 28 (stashing it
in a hash table instead of making a copy of the list itself, in case
that has had elements removed in the meantime).

It takes up some extra memory, but it's not done until the user issues a
sorting command, so I think it should be OK.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no