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 23940 invoked from network); 31 May 2021 17:56:27 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 31 May 2021 17:56:27 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20200801; t=1622483787; b=oR5gPayF5fRV0JSV+k142Ow829ROG27fPrdM3TovmHFLA/y0VsGivqXrM0jORX7bU93JbOgtwk 6SeKhBnZitIO0yCgGKAAXebBu2aA6155CeQSJD8+KnRFYqOMrcgcSpheS9B7JKEXNL5pd3jdYR fslKm7trSTmqWrfpqOmcLoSl/H29z16l+WHJZVhZk8GOtAHqjVKfG7CI6JZLPKhxIz1ydI9nJe JU0xV6RByZtGpquxGSlhtv6k4SVbplkdn86PjpsQizvJFjEpCDmjsv1MIgDA9vJrTd0O5qlMNO gNp/kbmx7SeO5hVd7pC/4tMNpB9EnKrBbuQXy3Risu2Zpw==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-lf1-f46.google.com) smtp.remote-ip=209.85.167.46; 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=1622483787; bh=yPXLU1+qicG0VcWIHJ1nzOUDtLC/8vNzXzlB3Gu1MSU=; 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=qQuuvM94RuO6r6eulYGJ6MRk52EFCizCu58e6+IuyCunPjHsxbsCAWFkCuRQYgpxbyT8oKL/cy rD39/cvVfp2mEWp4oY1pwUuH7T1wgX3CKNDdiE8eHk+sETjuCSpCLdZ0DHlOyJWmK4UdHaM3Kb l8+M5AYopcJL3f54Wsru4fpaRNMbSc9Rx7t2JMFjmcDlLZVY0znWurqQzSLoRM5l2Pywm6NYle 1EXrtkN0YyKzRUztBPMyxcU61gc1PE0qjYozEAKlHR3oxAEruoT4QXJ5cxxI1hvIGA93oyLCLj Jf9vs3TpF0D9bZrYTK27573wmNq0VseSNqwZ9LNG/czBLg==; 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=h9mF7V914J/NvyiATJKWvaRNCWru8VT/mIaFAhtvyyY=; b=C1vUANrMGjw0FOQ3U/bk2j7ZF3 wA11dVOilYZ/UKH741STubDISVku2yUYJG+NvuKOZ3emL/LyPU/j7QLb071pxIpJj2J9pb0j/csvM qnYZ/hJsSYjBJHl3/FHY7bZb1H62nx1Xh1xxfZFmjJiqnH+a3/UqNHKDcwAF4U9NTk1C3WcZzzoMV Oh4b9Kq0aOYq2lOwdFQ/CBDHi5zvHxqP/uMlQI1yZtQph0oJJXE/BktzQFOdCU6KZELkUQ8pEi69M sNFLx8Ty5XNol4BQSkriVQiwiKH84jpUlPjdQZpP9Z2ZuEMfIDQnvDXvK461MUvdM2EjwhWhyz54s SOyQ9rYg==; Received: from authenticated user by zero.zsh.org with local id 1lnm9J-000IqJ-Nj; Mon, 31 May 2021 17:56:25 +0000 Authentication-Results: zsh.org; iprev=pass (mail-lf1-f46.google.com) smtp.remote-ip=209.85.167.46; dkim=pass header.d=gmail.com header.s=20161025 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none Received: from mail-lf1-f46.google.com ([209.85.167.46]:39899) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1lnm93-000IX5-HQ; Mon, 31 May 2021 17:56:10 +0000 Received: by mail-lf1-f46.google.com with SMTP id q7so17887809lfr.6 for ; Mon, 31 May 2021 10:56:09 -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=h9mF7V914J/NvyiATJKWvaRNCWru8VT/mIaFAhtvyyY=; b=mRXgkBUv1Zb3ABy6H/lKq1qAQOwMr6rDKptdM1jvOitzJEpsGU4nQlIEpW84IZAfGU qzs0GEKABs0sMjexhbLDUABZgaqZ+MJMScvU8lHfzwray/k8XCqXXyjr7S8lTw0NSArZ szKpTv3TfFXx6lYsPzpUWGNH3ky1PX+gXbPUD+OSmMTIkMvBrRpS2ydsQQKfMnOCq8s1 D5TwLd7jaRvi5bw9HNmnqE29RDDPVr7t4x/piQ8Dwm4tCyxnQWDwqpUs/rL/iBIH1BSw 3sbegI1CzHKx5mKYzQ2IIOuiUWqRykS6D/i+/+MTVRpJOUCFCeT0Htfkr3soNbgWLeiI Tl/g== 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=h9mF7V914J/NvyiATJKWvaRNCWru8VT/mIaFAhtvyyY=; b=jSlQI1EJDQiqzo6lN1sElY6q2pLx/AHvCelhJVtLbg6ZMIAKPJoJyNf/YyDtGqzXI8 7aiMkwIzKIw6IpNw9/k9DC053rYoG12QDGW8UqHq1sSbfsdqy6KxtV5V8GXPL782H5nu QxNpVIZiVuaS43LfvdRmm/2sIzeaHaZOacmjEWtgsL0//Fp0zu6fKbzfOJZyo2HV12Wy pidldgey6/RAMHNXq9IfM/1UBpnD31ZDKL/oNsQthK0r2iHCHxK+bqozTQKK4BLr1K4u 9dlqxQ5zgdaZfNPokyyZl+S7ePAhKjzYF1++OIsU6ZOnS4P/kXVRa1PSZCXEPxJgoBQv 4bow== X-Gm-Message-State: AOAM530fwxcOHXAI7fOrKuA2qAKUs3cgPQlNSScZ8QUKDYBMLldkxvcN 6xQXLh8a2bRTt1NRJXdnOgrdii1NyRM3buo9g64suO4Q1pqiag== X-Google-Smtp-Source: ABdhPJy3CzTU3ICMjRr/391yDYCYRz/OiLy1pOP0RcxLF1txwmTf4hUwdiW+Thezds61jLb/iOt5JRMvYitfyBOMjcA= X-Received: by 2002:a05:6512:3d13:: with SMTP id d19mr15600366lfv.307.1622483768980; Mon, 31 May 2021 10:56:08 -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: Mon, 31 May 2021 20:55:32 +0300 Message-ID: Subject: Re: [PATCH] Add execute-command() widget function (was Re: [RFC][PATCH] Add change-directory() widget function) To: Paul Cc: Zsh hackers list Content-Type: text/plain; charset="UTF-8" X-Seq: 48970 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: Paul, you wrote in workers/48408: "I can write a proper widget." Any chance you might feel like continuing where I left off, below? :) On Sat, May 1, 2021 at 4:30 PM Marlon Richert wrote: > > 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.