Re: [PATCH] `compopt -o nosort` with duplicates intact
From:
Chet Ramey
Subject:
Re: [PATCH] `compopt -o nosort` with duplicates intact
Date:
Mon, 23 Feb 2026 09:50:08 -0500
User-agent:
Mozilla Thunderbird
On 2/22/26 9:18 AM, aqzkwaaq@tupai.anonaddy.me wrote:
Hello!
I have a completion function where I want the list of completions to
match COMPREPLY exactly. No sorting or deduplicating.
I thought compopt -o nosort would disable both.
Why?
Turned out that the
deduplication is only disabled for *non-adjacent* entries. Adjacent
duplicates are still folded into one.
Yes, that's what the readline variable your patch modifies controls.
It doesn't really have much to do with sorting, though -- sorting just
orders the duplicates together.
Duplicates in this context are not a sign of a mistake, they are all
a valid choice.
OK, so it sounds like you are requesting a new compopt option to manage
the value of the separate readline variable (something like `nodups' or
`nodedup'). I'll consider it for a future version.
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU chet@case.edu http://tiswww.cwru.edu/~chet/