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=-1.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 28802 invoked from network); 1 Nov 2023 00:12:43 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 1 Nov 2023 00:12:43 -0000 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:Message-ID:Date:Content-ID: Content-Type:MIME-Version:Subject:To:References:From:In-reply-to:cc:Reply-To: Content-Transfer-Encoding:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=Fg675Q4rVFNj78OupAecPkfV6HfXE4s4rN3Mov5XzGg=; b=I8DwLAoBxkuhgnWZ6CpNuc8clm 0u8csGb4ehu4DaWPRwT8qbCqrCuQluQANuldg9Baoohybl2ujvg76Ov2j8EKzJ9R+3mGFw+qRYV3I GEpevFufKjLjVirLnv0fIxZ2bAQXKxtlLzDfoc+Z7caxPxyJisk7bBMa35UXx0i+h5M226nrALAdP 6HlS7FrlfrGGp20tynte2OtYjzEZHgnJ/gmeKM0zDoWEusbNpIU2ymR+2u7pgZxgIz2ZCQ+xGWMQW sbIEy189pmbfG0f33tweNUFEBdMweO6koxPfUYQLVpKtB1QxSWiLgaVLImR7JJe9cWS4JN2PTfSTX +Faoe18w==; Received: by zero.zsh.org with local id 1qxyqf-000JSO-Nt; Wed, 01 Nov 2023 00:12:41 +0000 Received: by zero.zsh.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1qxyq5-000JA0-CJ; Wed, 01 Nov 2023 00:12:06 +0000 Received: from [192.168.178.21] (helo=hydra) by mail.kiddle.eu with esmtp(Exim 4.95) (envelope-from ) id 1qxyq4-0006zF-R5; Wed, 01 Nov 2023 01:12:04 +0100 cc: zsh-workers@zsh.org In-reply-to: <4917B5AE-3449-49BC-94D3-F20FFEB16D3F@kba.biglobe.ne.jp> From: Oliver Kiddle References: <20230802062128.125238-1-syohex@gmail.com> <4917B5AE-3449-49BC-94D3-F20FFEB16D3F@kba.biglobe.ne.jp> To: "Jun. T" Subject: Re: [PATCH 0/6] Update coreutils command completions MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <26859.1698797524.1@hydra> Date: Wed, 01 Nov 2023 01:12:04 +0100 Message-ID: <26860-1698797524.836640@xoJh.GWYD.LK_D> X-Seq: 52262 Archived-At: X-Loop: zsh-workers@zsh.org Errors-To: zsh-workers-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-workers-request@zsh.org X-no-archive: yes List-Id: List-Help: , List-Subscribe: , List-Unsubscribe: , List-Post: List-Owner: List-Archive: On 9 Aug, "Jun. T" wrote: > The second hunks in the patches for _env and _watch below are (possible) > fix for a problem that existed before his patch. > _env and _watch call _normal to complete a command and args, but since > they are passed to execve() or 'sh -c', it would make no sense to complete > zsh bultins or functions etc. I replaced > _normal > by > _normal -p env/watch > so that only external commands are offered. Is this a correct use of the > option -p? This breaks env completion. It was relying on _normal to complete environment variables which is fairly fundamental to the use of env. This use of _normal is fairly new. There probably is a need for a simple way to get _normal without builtins, aliases, functions etc. This mechanism with -p seems to have resulted from quite a number of separate patches, each of which seemed very reasonable when taken alone but the end effect doesn't really seem ideal. Tracking precommands could be useful for things like noglob but isn't really for things like env and watch. So it is being used for things that aren't conventional precommands to get the effect of external commands only. Every use of -p is passed $service - if that will always be the case, why require it. I think I'd prefer a more explicit option to _normal - -e perhaps for external commands (as for _command_names) and perhaps -E to allow variable assignments. In many cases, we're actually relying on later fallbacks to _default for completing values. _default only does this for magicequalsubst so if you unset that option, variable value completion for commands like env is broken. _normal (or _command_names) should be doing this explicitly. Oliver