emacs-devel
[Top][All Lists]
Advanced

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

RE: [External] : [emacs bookmark.el] Sorting by last set


From: Drew Adams
Subject: RE: [External] : [emacs bookmark.el] Sorting by last set
Date: Wed, 25 May 2022 20:17:30 +0000

> > Not mainly because it would be costly to re-sort
> > the list each time an existing bookmark is updated.
> > But in particular because `bookmark-alist' is used
> > in more ways than just display/access in `*Bookmark
> > List*'.
> 
> That, I was not aware of. So then sorting `bookmark-alist'
> (differently) might not be an option.

If what you want is to sort the displayed list,
buffer `*Bookmark List*', then that's what you
should sort.  There's no reason to sort
`bookmark-alist' in order to accomplish that.

What's displayed in `*Bookmark List*' need not
even be all of the bookmarks in `bookmark-alist';
some can be intentionally omitted (filtered out).

Beyond displaying its bookmarks in `*Bookmark
List*', there can be any number of other ways
to make use of `bookmark-alist', including
other interactive ways such as choosing a
bookmark with `bookmark-completing-read'.

And yes, sorting can be useful also for some
such uses. But even then it's generally wiser
to sort a copy of `bookmark-alist', rather than
modify that list.

> > IMO this is the wrong solution for the request you
> > made, which was to be able to make more recently
> > changed bookmarks more apparent.
> 
> FWIW, it works as I intended: each I set a bookmark (a new one or an
> existing one with the same default name) it ends up at the top of
> *Bookmark List* with `bookmark-sort-flag' set to nil.

Yes, of course.  If you sort `bookmark-alist',
modifying it, then you'll see it sorted. ;-)

> I'm not against adding a "time" field (as you proposed in your other
> mail) but, as it is, bookmark.el just have the `bookmark-sort-flag'
> toggle for which t is «sort by name» and nil is «use the default
> `bookmark-alist' order».
> 
> So I'd have to piggyback on `bookmark-sort-flag' to have the order I
> want by default. (… hum, why not after all … `bookmark-sort-flag' could
> be t, nil or 'time without disturbing current default or users'
> setting).

IMHO, it was a mistake for `bookmark.el' to have
moved its `*Bookmark List*' display to depend on
the straitjacket that is `tabulated-list-mode'.

That limits things quite a bit, including sorting.
Far better to have `bookmark-bmenu-list' display
the listing itself, as was the case in the past,
and as is still the case for Bookmark+.

In particular, without `tabulated-list-mode'
there are no limits on sorting or on users
defining their own sort functions.  It makes
little sense for sorting to be essentially
limited to sorting by columns.

Just because listings of things such as files
(Dired), buffers (Ibuffer), and bookmarks use
columns, and just because `tabulated-list-mode'
provides a rudimentary ability to list things
using columns, these alone are not reasons to
use `tabulated-list-mode'.

Thank goodness Dired and Ibuffer have so far
been left alone, remaining sane, flexible, and
powerful.  May their bountiful gardens be kept
free of indiscriminate lawn-mowing.  No army,
one-size-fits-all crew cuts for them, thank
you very much.
___

(Option `bookmark-sort-flag' is also limiting,
providing for only two sort orders.)


reply via email to

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