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 31256 invoked from network); 1 May 2021 13:31:39 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 1 May 2021 13:31:39 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20200801; t=1619875899; b=huLf9LLod5QJemkUyS5kYS6XU9+uM1Ef6sZLXdt52twrAw7fC1mFvHD6y6M6NzHa22m16sO5cJ rvkkKwA6jv7+bdG5+sF7SNw3s6NUyRhq9dE90IyCctXx6do5qBeXWXUY+nxjDkX2lk2POtaL2P 6Y0GnjOn7RBnhOTZeijhU2v0v+83ECBUv/vlVPAbZz2d3/FEt9tGzrApJ1JShWVGGuzVE/Uyj7 G1en7EfVvhhxvl4lqbxg2KGWxIylmV+mqYFPxtCCUysXW2yAo86k7sgdOX5s+UFDZgvVPmSPcT ltg9P6XixNP98vcIGuWlO9Qu0KSrvGZDwqu0s/rOUhwWpQ==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-ot1-f51.google.com) smtp.remote-ip=209.85.210.51; 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=1619875899; bh=g8YNUe7dR7zKsO65UFFPE/POn9CcnoaSuhHfN5cANqM=; 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=Mnsu6MCjboz42rFEEB6Fx91RrbOx9Yk+FAcZF53mD+2tmaQ4Aqqe9hFzm1vhjt2kp0SZA/MEdd CGm49HeZX9l0CkP/v0h9UrEm8gXdNxek0lkYO+9NxyLbgCB3qR4UugiIksaaQOUArID5As3ykP XzGsubUucqqsUkrPmxDbEnknPBycyS/0EeFqH+Me3kiQQG+MqyTVERmymLGt/BS+eU33SG6hzP 5AmjNgXYTe98WtrnnlC8B7B46blW+pWcPBsy2lk0vCnPxA2XE7ahqdX9pBf9qAyfQAIibAQR7Q kEPbv6N52f+K6NXQ+cA+L4BNxhOMuSsOo8iAMJQFnQOv0Q==; 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=dPrzJdAtrpviGZxL264NwC+qq/IEN1bspPz8AwKa/ac=; b=xUb629NhmnsveftcNFphfOCKCH MLnKOCcry5twldGWlrGG7m6egdnmkNy+csqMNPYASYB1wx1CNCd0M+w1uHOqrMIMQ6xOkPDdTsQ+V WHUca0keztKqxLzMoO3DYspVmFGBc2mIF4l2hyeB/4T0j86FhYgszB7POximyIl/2/04L48EzKIWr aGftTlirqyuzOU9CGQbkMyY9gOTO/BWupow3S1kfWCI4pkiA1oKyZc1M7SzbauRPAWQCGocAhVtsv k3nRogWqBoKPr+l9eb1BqaFHeoUrydcKYfsiDYVADo/KUUXt+aAH2mjJ+sCYctCJ0TvB9MpxKkFh0 51opJlkw==; Received: from authenticated user by zero.zsh.org with local id 1lcpic-000Bdv-ES; Sat, 01 May 2021 13:31:38 +0000 Authentication-Results: zsh.org; iprev=pass (mail-ot1-f51.google.com) smtp.remote-ip=209.85.210.51; dkim=pass header.d=gmail.com header.s=20161025 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none Received: from mail-ot1-f51.google.com ([209.85.210.51]:37557) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1lcpiK-000BOD-1K; Sat, 01 May 2021 13:31:21 +0000 Received: by mail-ot1-f51.google.com with SMTP id c8-20020a9d78480000b0290289e9d1b7bcso1047007otm.4 for ; Sat, 01 May 2021 06:31:19 -0700 (PDT) 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=dPrzJdAtrpviGZxL264NwC+qq/IEN1bspPz8AwKa/ac=; b=A/H5hO4QQaYf8M4cqyAUIaLOKcxbB/pHkx6mX714lOvOPgyj2wMwR58hxI47kQDZOF oTUtqJMJDrNIYw2yrf0YYETqSfQQ7vtBQsxAk04OF1QpjLu1RgZyASiwjy+AgOaGGagR EcBrLCmsBvvo+wgk6DLhJ9EhPMWWWB/YuHG6YYiMP0jfBl2LJyi7+bfdrS6iu/xNklYg sX6ubykdw7jVQLrlQDAt+OuiwFn7tyFRSsmtMyv+JJoMOhm2xbP9G+8syDxq+9bhETSs K+cjrh4Qj9BwtEZD785C76n6sY6M9SUnbWT6Yd+tk4njwxWmSE1lBJi0OOqzjLUHFCqv E1dA== 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=dPrzJdAtrpviGZxL264NwC+qq/IEN1bspPz8AwKa/ac=; b=uMihJw2t17xdtgDhK1qMtzMShfGWY1Ypw5PtZlTNHM7g9cxUZmvaYqQ6wQj8IhlQpv Jet/hIIH5x9le0wURdQMTkpXCQKnuWp7AU0ebj1/BqMdyRZx6EdfWE3MYEVQW852j7d/ zmv8ApunnLjoy74W7bG3N0fDyLpf8DtnL95qd5Flk+HrOdqY8MSRcaJP1BzEp+szoiBo 3IIwg+AtLtdhpKCxol7PLG6M93UFIvFPN5hRsHCF5z/unjEvBFejJc5eRGH4JEdj/yf/ yfmzBmChs5+nLLi+RlZoDee0rDfn/ldWtWAfrGmeCxnyKfW7bI93+uUAeZ1zhznpjid9 y/2A== X-Gm-Message-State: AOAM5317g7CUqq6ia1HN/b3pRW/2RG0AZDPc/SO82C1ZFZQPb5lmYXzv pnK6DOeNKN6xa5clRk9iUeDCQ/zvXyI9wdPD8ruyiAgNGNY/Lg== X-Google-Smtp-Source: ABdhPJxG9kXR9NUIyP7kIokdzpCO9J7+ug0ti45cbcNxBA9tCOLpUTkJp15tFZgSnNaLDbzBL6iHhQNbE/XOpPaPE7U= X-Received: by 2002:a05:6830:1d98:: with SMTP id y24mr7838101oti.164.1619875878673; Sat, 01 May 2021 06:31:18 -0700 (PDT) MIME-Version: 1.0 References: <95CDA630-4EE5-4003-8D9C-CCCB9A47F109@gmail.com> <4D587C0C-EB5F-4A58-A0AE-D45E43F432CD@gmail.com> <20210421212717.GE21343@tarpaulin.shahaf.local2> <214AC3E9-FFA5-4F39-A918-562682FE3A3B@gmail.com> In-Reply-To: From: Marlon Richert Date: Sat, 1 May 2021 16:30:40 +0300 Message-ID: Subject: Re: [PATCH] Add execute-command() widget function (was Re: [RFC][PATCH] Add change-directory() widget function) To: Bart Schaefer Cc: Zsh hackers list Content-Type: text/plain; charset="UTF-8" X-Seq: 48764 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: OK, I give up. Someone else can finish this. On Fri, Apr 30, 2021 at 11:25 PM Bart Schaefer wrote: > > I'm trying not to be a wet blanket here, but: > > You've accidentally included the doc for zrestart in the .yo patch. > > The -e option is never going to do anything useful, because send-break > will kill the buffer to which the command has just been written. (I > feel as though I've said this before about a different proposed > widget. Hm.) If you wrote to the buffer before calling print -z that > might make some sense, but more so at PS1 than PS2. > > Attempting to pass multiple commands, one per positional argument, and > then eval them all at once with newlines between, strikes me as > inviting all kinds of quoting problems, plus obscures the return > status if some command in the middle of the list fails. > > It's not safe to use eval that way to assign to $ops[-v], the argument > passed to -v might not be a simple variable name. E.g. if the user > forgets the variable name, the first command they intended to execute > will be stored there instead. Using a single well-known (documented) > name instead of passing an argument would avoid this, and it's not as > though you can have two execute-commands simultaneously that would > introduce a conflict. > > Other things that occurred to me not directly related to this patch: > > There's nothing preventing the user from passing more "zle" commands > to execute-commands which could arbitrarily mess up your print -z ... > heck, execute-commands could even be caused to call itself > recursively. This is not something you need to try to code around, > but it could be documented as a misuse. > > Instead of throwing an error when there are no commands provided, > execute-commands could invoke read-from-minibuffer to input a command > to run, much like the builtin execute-named-cmd does for widget names. > That could make execute-commands into a widget rather than just > something callable from widgets.