From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 7811 invoked from network); 5 Jan 2022 19:47:41 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 5 Jan 2022 19:47:41 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1641412061; b=oegp/ZrAu1hT62i+BL5kkHUG1j6aZfch+qQQzCZii49fQcdzYxCxtR1faRQECyBqPRjpnwPBZj 1oQV/XD2VJxAZlYn1B/gFVh8vCNEoih/B6Fo/KR3xpdFpfKmfgOjfVTjgeY5rrzBjppucoNEE5 krwiX+HZlkm3RRULsdu3n5yHrmzPyOcziSEeFNxIHo4NhQzMqk3+wdvALkVC0ClDn+mqq8dTRI pyklS4XBSM19WKgZMxsgnp/YYdlFpT42kNqE/aih3P/qcIvTMz2aC3YTG3mnFD5JxhLcyH7zJf VayIkaSVL4eM0UG1nBf3pZ3+hgO7EZkS7AvHiCrrSyMOrQ==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (pepin.polanet.pl) smtp.remote-ip=193.34.52.2; dmarc=none header.from=polanet.pl; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1641412061; bh=MNFCGvK46tmLLHWrX6icdF8BetnLNPLPt/CcQycoN2c=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:In-Reply-To:Content-Type:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:DKIM-Signature; b=TJxFrmC3DzEvUWUZt3XgoxsStcCONKC0hHu+6LQpNELtq/Zg2WyDRFKUYugNWAtfgmlxwJ4ha0 l5YflDHauQaQ+rsIN/9eGS0A0vEc2lWzjlWNfFjcYjXn1Gh2QWaVCM+3WMXRUcJBNfRTo13/Y4 hbeNTgoAL36D5t6PAiLV5g2XlXgWZJAOS8IvEIJBCCZQk1eCdkYfNx6Lp9Z542ys9Oc8J2P39F qBKT5XJbm6tUX/ztV9B/rCAM6IOGw19xBT1lXhkGKDMyMDSf/+zNh+BVBClacosyaUkeIPai1k GUG6Bc3JdGU8QhmKqVTpVztZDWt9IVEL28u+X81WzknYeg==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20210803; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=fenRPWuespYfCt2cAm9A/KdmLqWNruZ8cDPyeOjhpAo=; b=SWzOAMyLAIwwk9R7Mcr8E26HH4 EOy1GZ9KdifSN96Z2AU2hwXTQw1jZcGRw9wPf6MIGk4/CwSJwA/DKzwnZ8j/a49Ymv7vbQZsecbXR pczxJ89KruVs4DGE6f25+HvMydGjBrvCUmmefBDAN6/IkIkIsy0SlY3GyjfMPcch0X1umPfLdI7we GV2hs4xsiMYOqbxAVQScaPebxh0EgiJ+1A8jnGS+Bxukhj3hBo4Ypq5dAobaLXVKPleLtwrEWrfR2 D/Xk0JZr1Un+0Ae2kY859jwJW1xl8cb/4EOpWA0Mfyrftwb8uoNSCr32bSiUj3dOWkaAEOjjueWtq +9h54k8w==; Received: from authenticated user by zero.zsh.org with local id 1n5CG2-000A7e-EJ; Wed, 05 Jan 2022 19:47:38 +0000 Authentication-Results: zsh.org; iprev=pass (pepin.polanet.pl) smtp.remote-ip=193.34.52.2; dmarc=none header.from=polanet.pl; arc=none Received: from pepin.polanet.pl ([193.34.52.2]:50601) by zero.zsh.org with esmtps (TLS1:DHE-RSA-AES256-SHA:256) id 1n5CFB-0009On-6O; Wed, 05 Jan 2022 19:46:45 +0000 Date: Wed, 5 Jan 2022 20:46:43 +0100 From: Tomasz Pala To: Bart Schaefer Cc: Zsh Users Subject: Re: _complete: insert unambiguous when globbing Message-ID: <20220105194643.GA13958@polanet.pl> References: <20220103123903.GA20434@polanet.pl> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-2 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.20 (2009-06-14) X-Seq: 27450 Archived-At: X-Loop: zsh-users@zsh.org Errors-To: zsh-users-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-users-request@zsh.org X-no-archive: yes List-Id: List-Help: List-Subscribe: List-Unsubscribe: List-Post: List-Owner: List-Archive: On Mon, Jan 03, 2022 at 16:25:18 -0800, Bart Schaefer wrote: > The basic problem here is that the set of common prefixes always > includes the string originally on the command line when deciding > whether to insert a partial result, Can I get rid of this "original" string from the set? When backing of from completion I always use ctrl-g anyway. > completion process; the prefix from the command line is determined > very early in both cases. This suggests that some fiddling with the > value of compstate[insert] could produce the "show prefix on first > tab, enter menu on second tab" effect that I think you're asking for, Yes, something like this - this might happen on one or two tabs or even on some separate keybinding. I did some digging and I think I've found a solution for my usecase: --- /usr/share/zsh/5.8/functions/_main_complete.orig 2020-02-19 00:50:21.000000000 +0100 +++ /usr/share/zsh/5.8/functions/_main_complete 2022-01-05 18:34:57.828262149 +0100 @@ -389,6 +389,12 @@ unset ZLS_COLORS fi } + +if [[ $PREFIX = *'*'* ]]; then + compstate[pattern_insert]=not_menu +else + compstate[old_list]=keep +fi # Now call the post-functions. === However since it sacrifices ZLE-provided pattern it's not perfect. $ cd empty $ touch 2021.12.29-14:41:02.xz 2021.12.29-19:41:02.xz 2021.12.30-03:41:03.xz 2021.12.30-14:41:04.xz 2021.12.30-19:41:02.xz 2021.12.31-03:41:02.xz 2021.12.31-14:41:04.xz 2021.12.31-19:41:03.xz $ ls 2*04[tab] => 2021.12.3 files 2021.12.30-14:41:04.xz 2021.12.31-14:41:04.xz so the compstate[old_list]=keep was required for the second [tab] not to follow the updated ZLE contents. It works like a charm, but I wonder - what cases would be broken by compstate[old_list]=keep with such a weak condition? It would be much safer to have something like: if [[ $PREFIX = *'*'* ]]; then compstate[pattern_insert]=not_menu compstate[eat_globbing]=yes elif [ "$compstate[eat_globbing]" = 'true' ]; then compstate[old_list]=keep fi but I can't find a way to pass this down. -- Tomasz Pala