unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: "Ryan C. Thompson" <rct@thompsonclan.org>
To: Lars Ingebrigtsen <larsi@gnus.org>
Cc: 47127@debbugs.gnu.org
Subject: bug#47127: 27.1; ido file completion sorting should respect ido-case-fold, maybe?
Date: Fri, 24 Jun 2022 09:58:17 -0400	[thread overview]
Message-ID: <0f37c4f6-4b6b-6829-91bb-46c13f9ef1e8@thompsonclan.org> (raw)
In-Reply-To: <878rpmp6dw.fsf@gnus.org>

On 6/24/22 8:56 AM, Lars Ingebrigtsen wrote:
> "Ryan C. Thompson" <rct@thompsonclan.org> writes:
>
>> ;; Returns nil, as expected
>> (let ((ido-case-fold nil))
>>    (ido-file-lessp "a" "B"))
>>
>> ;; Should return t, but currently returns nil
>> (let ((ido-case-fold t))
>>    (ido-file-lessp "a" "B"))
>>
>> ;; Should still return t because case is the only difference
>> (let ((ido-case-fold t))
>>    (ido-file-lessp "A" "a"))
>>
>> At least, this is what makes sense to me.
> I think this function should respect ido-case-fold, but special-casing
> equal strings here seems pretty unnatural to me -- if you want to ignore
> case, you want to ignore case.
>
> So I've now made this change in Emacs 29.

I don't understand why it's a problem to special-case strings that are 
equal after case folding. If I understand correctly, when case folding 
is enabled, then the sort order of such strings is arbitrary. If so, why 
not choose a consistent way to break the tie? For instance, if I know 
that "A.txt" will always sort before "a.txt" and both are present in the 
folder, if the order is consistent then I can always type "a.txt C-s 
RET" to select "a.txt", because I know it will be the 2nd matching 
choice. The result is a sort order that is correct when ignoring case 
while also being completely predictable even for strings differing only 
in case.

Regardless, I don't feel strongly about this, and I can always apply 
advice similar to the above for my own use, so if you're not convinced 
by the above argument, feel free to leave it as is. (Also, perhaps it 
already works this way incidentally, if the list of files is returned in 
lexical order and the sorting is stable.)







      reply	other threads:[~2022-06-24 13:58 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-13 21:57 bug#47127: 27.1; ido file completion sorting should respect ido-case-fold, maybe? Ryan C. Thompson
2022-06-24 12:56 ` Lars Ingebrigtsen
2022-06-24 13:58   ` Ryan C. Thompson [this message]

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=0f37c4f6-4b6b-6829-91bb-46c13f9ef1e8@thompsonclan.org \
    --to=rct@thompsonclan.org \
    --cc=47127@debbugs.gnu.org \
    --cc=larsi@gnus.org \
    /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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).