all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Karl Fogel <kfogel@red-bean.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 59580@debbugs.gnu.org, Gabriel <gabriel376@hotmail.com>
Subject: bug#59580: 29.0.50; [PATCH] Add new choices to bookmark-sort-flag
Date: Mon, 18 Dec 2023 17:26:09 -0600	[thread overview]
Message-ID: <87jzpbm6su.fsf@red-bean.com> (raw)
In-Reply-To: <83bkonilbm.fsf@gnu.org> (Eli Zaretskii's message of "Thu, 01 Dec 2022 10:23:41 +0200")

On 01 Dec 2022, Eli Zaretskii wrote:
>> From: Gabriel <gabriel376@hotmail.com>
>> Date: Fri, 25 Nov 2022 15:26:49 -0300
>> 
>> Add new choices 'type and 'file to `bookmark-sort-flag'.  See 
>> [1].
>> 
>> Notes:
>> 
>> 1) It feels strange to have value t meaning 'name and value nil 
>> meaning
>> 'creation-time, but it's better to not change how things have 
>> been
>> working for many years.  A more flexible approach could offer a 
>> custom
>> function as a choice of `bookmark-sort-flag'.
>> 
>> 2) I took the liberty to update some comments and docstrings, 
>> please
>> review.
>> 
>> 3) I took the liberty to remove some code in 
>> `bookmark-bmenu-mode' that
>> seems to be unnecessary, please review.  Everything seems to be 
>> working
>> as expected according to my tests.  I can also write some 
>> tests.
>> 
>> 4) Used `string-collate-lessp' in `bookmark-maybe-sort-alist' 
>> to match
>> `bookmark-bmenu--*-predicate' functions.
>
>Is it really a good idea to use string-collate-lessp here?  Its 
>effect
>depends on the underlying OS and the user's locale, so it could 
>produce
>different and sometimes surprising results.  Why isn't 
>string-lessp
>sufficient?  IMO, at the very least, the fact that the sorting is
>locale-dependent should be prominently stated in the doc string. 
>Also, see
>the notes in the string-collate-lessp's doc string about 
>MS-Windows, and
>maybe do what it suggests (if we decide to keep 
>string-collate-lessp here).
>
>Karl, any comments?

I finally had a chance to look more closely at this.

First, overall very nice job on the patch, Gabriel.  You took care 
to strike a balance between, one the one hand, cleaning up things 
that directly touched your changes and, on the other hand, not 
causing unnecessary churn.

Regarding the use of `string-collate-lessp':

I think using `string-collate-lessp' makes sense here.  This is 
about sorted lists presented to the user, so the sorting should 
act according to locale (and when Emacs suspects that the locale 
wouldn't collate correctly, `string-collate-lessp' falls back to 
`string-lessp' anyway).

However, it would be good to:

  - Bind `w32-collate-ignore-punctuation' to non-nil

  - Pass optional arg IGNORE-CASE to `string-collate-lessp'

These two things would result in the behavior(s) that the user is 
most likely to expect, I believe.

If we later learn that people want more control over these 
behaviors, then we could make control variables -- something like, 
e.g., `bookmark-sort-w32-collate-ignore-punctuation' and 
`bookmark-sort-ignore-case'.  But it would be premature to offer 
those right now.  Let's start by choosing reasonable defaults and 
see if people are fine with that.

Thoughts?

The patch is a bit out-of-date now: The diff againt 'etc/NEWS' 
depends on context that has now moved to 'etc/NEWS.29'.  The diff 
against 'bookmark.el' applies cleanly, however, just with some new 
offsets due to things having shifted around.

Best regards,
-Karl





  parent reply	other threads:[~2023-12-18 23:26 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-25 18:26 bug#59580: 29.0.50; [PATCH] Add new choices to bookmark-sort-flag Gabriel
2022-12-01  8:23 ` Eli Zaretskii
2022-12-19 21:00   ` bug#59580: and bug#59581 Karl Fogel
2023-12-18 23:26   ` Karl Fogel [this message]
2023-12-19  0:44     ` bug#59580: 29.0.50; [PATCH] Add new choices to bookmark-sort-flag Drew Adams
2023-12-19 12:25     ` Eli Zaretskii
2023-12-19 18:59       ` Karl Fogel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87jzpbm6su.fsf@red-bean.com \
    --to=kfogel@red-bean.com \
    --cc=59580@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=gabriel376@hotmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.