emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] Improve sorting in the bookmark list buffer.


From: Karl Fogel
Subject: [PATCH] Improve sorting in the bookmark list buffer.
Date: Wed, 20 Apr 2022 13:09:26 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

On 07 Mar 2022, Manuel Giraud wrote:
There is one minor thing left: the tabulated-list bar (I don't how it is called) keep the old information « sorted by bookmark name » when I have
revert to `bookmark-sort-flag' as nil.

I looked more closely at the situation and came up with the attached patch. The new behavior is a little complex, but I think it's the right thing for most users:

If `bookmark-sort-flag' is non-nil, which is the default, then the bookmark list [1] will be sorted lexically (case-insensitively, and in locale-dependent collation order).

If `bookmark-sort-flag' is nil, then the list starts out sorted by bookmark creation order, *but* clicking on the sort-control toggle for the Bookmark Name column will sort the list lexically (and toggling it changes the direction of that lexical sort each time). However, you can use "g" (`revert-buffer') to refresh and thus go right back to creation-order sort. Also, if you change the value of `bookmark-sort-flag' and regenerate the buffer, via `g' or otherwise, the sort will change accordingly, as one would expect.

Note that there is no option to reverse the direction of creation order sort: when sorting by creation order, it's always most recent bookmark on top to least recent at bottom. I didn't see any clear need for the reverse direction, and having the column sort toggle behave in a familiar (lexical) way seemed much more important.

Review / feedback welcome. This is based against current 'master' branch (commit 25308a95f8869c), but once it's been through review I'll ask Eli which branch it should go on (or Eli if you want to just say now that's fine too).

Best regards,
-Karl

[1] That is, the buffer generated by `bookmark-bmenu-list'.

Attachment: 0001-Improve-sorting-in-the-bookmark-list-buffer.patch
Description: Text document


reply via email to

[Prev in Thread] Current Thread [Next in Thread]