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.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 21320 invoked from network); 13 Nov 2020 10:42:47 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 13 Nov 2020 10:42:47 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20200801; t=1605264167; b=c3onyDLPV875pChb/hxisKsBZb5q3Ve+m1DgwzdhbHMGq9WYHTL4GLwPoYxkvTPJz5dgbPWpRy +0sMSrbmdm0zjKTX5kS3M+2B/ENJBKMwxyd2Xz/fIystvUitAc61/aPImU/WF0Xa91exPy/z66 WeENZXzMKHcS+kfbmSYXNWDjPub90VD18AOg1X7CTr+Emre3p1khuQIcWzrvO4xxv9Z7cfZYX8 434rZlkh9cIk6tK7iNvZONSqrV3oBhSH3Z8odRzLiVjS4iB48NFApLa+3+cIm+W3Q0mPZXlvD+ E8rmmn20OSgYa/353/AgGikgtw+cccY5ksG6DLF01sbAAw==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-io1-f53.google.com) smtp.remote-ip=209.85.166.53; dkim=pass header.d=gmail.com header.s=20161025 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20200801; t=1605264167; bh=qS/EQgE10GV5clZinOlHhUNfFqhFMCytuC/YD01if98=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Type:Cc:To:Subject:Message-ID:Date:From:In-Reply-To: References:MIME-Version:DKIM-Signature:DKIM-Signature; b=o0qxHFUD+9XrW29pRdroPWv8azIEv8XaHhph84MRbVGbs1irRDiVRKvs6jWlqjLYh0IXGFI3n4 Zf1F1u6/f2K2iRH2lj+C1W8Vqdf4C5uN24VUdPVX8l64VlrrpWrn6qEZVGzA50OPUInxvFavO1 LjjMlhTALP1wOyESAjAX/GmdHMyxRtrwl+sTSN8nJFyTfCDCWrD7+asM9oiHs9pUe/6bYO0qBb 3qsLJ0Ka1yxBw27+IqluRYxC0etYjYZzhcsYJVFFTytgLjDjSCOmHvPrVdZVXIQ/5S5zf57DXC RB7ym/vQ+FmQtu3hImYYHXuj/VQkNz+NyaDDifYoYHBhHw==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20200801; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:Content-Type:Cc:To:Subject:Message-ID :Date:From:In-Reply-To:References:MIME-Version:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=/Z7PeGC1C05paDBEl8+hNhkpIGzm2ykJNS9DdsVD1uw=; b=E7NmwKErKH2a0O9N4CNJmCB5Rx sf45UzGqG6UYIwXF6E0nc85bU4NZKHg8FC7OFb5EupFRoid9rz1MRWHHCSa5igXhREr+I3P07Zbh2 Rq0u2DgMRRHAmmGE07YFJ6ZRnCMADZrXTbEig95VlXb4BK2K6avuzol05lQM6FZDtV9+tE+/m55P8 n121Yj+gfmF6b6NoLk07lxbLnPFyYSrIWSPp/fVzY/XMgnO7cT8fkUSugaFRQjypXM9aYod6L6E2W KuthJTMlLNodP3DvHqGcAyctHOdq7vY7+kDqnYc8zdm8mOZTe3TkJ6zHE3Lpv9yS17ZlIzqfWhF2/ 098UM2CA==; Received: from authenticated user by zero.zsh.org with local id 1kdWXV-00014u-Iq; Fri, 13 Nov 2020 10:42:45 +0000 Authentication-Results: zsh.org; iprev=pass (mail-io1-f53.google.com) smtp.remote-ip=209.85.166.53; dkim=pass header.d=gmail.com header.s=20161025 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none Received: from mail-io1-f53.google.com ([209.85.166.53]:44886) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1kdWX3-0000hv-W7; Fri, 13 Nov 2020 10:42:18 +0000 Received: by mail-io1-f53.google.com with SMTP id o11so9263386ioo.11 for ; Fri, 13 Nov 2020 02:42:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=/Z7PeGC1C05paDBEl8+hNhkpIGzm2ykJNS9DdsVD1uw=; b=rsSQA/94mOvAx4rDkfjiGqWN7pAmfqk+bVmVH7qAzQJs7b3Ma6wSCoWsa/75ZTUQ6/ llhVFJkZ9X9wxA38uKpSCGKKrS6XaYu/uFOEIO/0SSWKUyNGS6bRBZ/nBOGqmkin+vnm JgXB7PCLJv7VBX0Rgf8A6MjoHqeQk+dUQjPSFqhnRM22uUrmY44m3p/ZaZUxc3DQyohF eRT7ev7B7qw5ZBaaE3Oaq7ycq3KXFFdNfA4f+upKdT5c8x1xtWcGZ9OTV6K1o+oPQBB2 YttkCr5RViQkkTszPl7cWrZ6G5HC4xolA/hGZ+7dmkiQUVnRBtzMpaNjnlxfNdxBCNbw KjqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=/Z7PeGC1C05paDBEl8+hNhkpIGzm2ykJNS9DdsVD1uw=; b=gTCvfY2CuFvKS5IYzBeTwhg/B4lAn49yhY1ZJMsO54x9/cAgi+MXtofEsp48oNvB4X YDA6iJUZ0bObM2wflm2u5wMf+uroR5KQX1IUTmmfP2t0evPuzVr9M/5oLFVyDPcNJQnb luBLaKc6UyjSJotxPwH3dafNwtB3RXBXknk+6UzEOnkhLlCdmQSd+uvHa3oxxUIJDP6v jA4PIy5Q7t3xacO55ZFbv63PcbkSLlKiuhShp6ZWpPduHx5/IVl+H99iuJ/udDskEFf1 saRqmCr5PJpcjoifcTdbCx/clmmauQ7hAcYf8znXKOZw09Ym0DdObH7UTRBN3/UDB3lH l9PQ== X-Gm-Message-State: AOAM533faKPgR+6mNZerJQPiRGB4wvQ3om/B3rdCMC5l3Hic8l21A2LH O2NQVWrh561P+ktyZs9OlOE0EwjvbbAARQW2JDk= X-Google-Smtp-Source: ABdhPJy0j6T9cyV4ZDoGhFmgCJZ/mvtwhlvLVySUOWYrB0YttxoQU5DZ0IuvjJE7I6x7t1SGklpzR+s9hllN94hzLj0= X-Received: by 2002:a6b:5f05:: with SMTP id t5mr1346930iob.67.1605264136596; Fri, 13 Nov 2020 02:42:16 -0800 (PST) MIME-Version: 1.0 References: <20201113174124.cb440e381388179852e48c62@virgin.net> <20201113093443.afd8d11e641eedb409c2ee37@virgin.net> In-Reply-To: <20201113093443.afd8d11e641eedb409c2ee37@virgin.net> From: Roman Perepelitsa Date: Fri, 13 Nov 2020 11:42:07 +0100 Message-ID: Subject: Re: _pick_variant To: Thomas Lauer Cc: Bart Schaefer , Zsh Users Content-Type: text/plain; charset="UTF-8" X-Seq: 26161 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: Archived-At: On Fri, Nov 13, 2020 at 10:35 AM Thomas Lauer wrote: > > There's no md5 command anywhere on my system. I have md5{sum,pass} and that's it. The clash isn't with an existing command but rather with a completion function that's included in zsh. Zsh will use the completion function _cksum whenever you are completing arguments of the command md5. It doesn't matter (to Zsh) where the md5 command came from. My latest similar clash was with the open command. This is a macOS command but I'm using Linux, so I cannot even have the open command that _open expects. > Well, the quick solution is to change the name, as I did. However, when you say my "function doesn't handle that" this seems to imply that there's a way it could handle that situation. How? If you want to complete only files when invoking md5, add this to ~/.zshrc (make sure it's after compinit): compdef _default md5 Alternatively, replace $1 with "$@" in the definition of your md5 and tell zsh to complete md5 as md5sum: compdef md5=md5sum The first solution can be generalized: () { local k v for k v in "${(kv)_comps[@]}"; do if [[ ${functions_source[$k]:-$commands[$k]} == ~/* && $functions_source[$v] != ~/* ]]; then _comps[$k]=_default fi done } This will disable programmable completions for all commands and functions defined under $HOME that don't have their own completions. If you have compdef calls in your dotfiles, you'll need to move them below this stanza. Roman.