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 10483 invoked from network); 30 Apr 2021 20:25:55 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 30 Apr 2021 20:25:55 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20200801; t=1619814355; b=b/vrkNuD0FtW6CnLqJnZonvdo8EdxFaxqpM/Q6BUaPqRYyZPYIe51F4KMDKyWhBXrHtpMNVBXW 29rOfUb5w2lJdgH9zQg5mZwyi57lWL6Iinz7ZhTzCHFoS6Hgn1MlC/28IFUqh10Jrahwx1auTM +jWHXJARHDgfzfbGbYe6V8uJfwMstvsiwDnYkr9rPe3tlsWFaOM5B3e1cchLlOYmCu9KpuUjVw nqq7rwdrvU1LwT+T/xKLzeIVZqEYybSGHqlFRGkX8ZPq09hZPxG1R4jZeoQltLvNHXg/svcyHZ qgC+wpDx8jOp5+YQDiPTOPjxzHVbfpDeNHgn0JRs71ktag==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-oi1-f177.google.com) smtp.remote-ip=209.85.167.177; dkim=pass header.d=brasslantern-com.20150623.gappssmtp.com header.s=20150623 header.a=rsa-sha256; dmarc=none header.from=brasslantern.com; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20200801; t=1619814355; bh=1fX2hO1iWzy8EQqibbo0JajBbqMt6giG6tK5d2sx62Y=; 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=HxwFJpQ7Z5Cf5jA4W2v1vEGgdFTeKH8VHopq1MmUYjxIWgEzQIj5IM6Zcy+T1hrTe2pmxNnciJ Q0oLTPjqQdN1HQtCMkDmqvYPHBvQZleUT/qSg7/V4Ncglt1F2a4p1BRRfShqNb47MqAZbSI3oF kuRn/nVnc/JkPDRYXFyZgh/WpKHHSyOHkdZZ8NUdJ7DHFJGqxlq67H1Bp3pH7Q8UuwBLGeGGJG 2a45tBrOq02Qonl8cEh2yIM9UkJ53yMM2ExlW/q6+RoQ18qOHcTSSXkCWTjX02iuKp0bMKZW7g VCmogcMpi3qPpYlSvfGMGOGcsjjj79U0E4NAd9LWeizerQ==; 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=ZYXV7rWk4s4xMqF3FNF1FPOTQtZ1TKoCC6Yeq0l2cLE=; b=YK7Z538tA0FmtCEJ3M4J4E1W/t GB5jCcUKW3AQmG901irIIYjrQ282PIHF0nLq/k1BIY6HKpfT275/y9xaY1fvgTl1qcQ5VLm3/dOcL 4ypcQ8wXCmzSyCrXRbN210eQc3D52VcKaFHAV/8SsHf0GuJI/rnBiGBj39kmwKmGlKhKCBWEXsjjf B9ZoEdEu/8eIgFrSWy6BIZjTGSYSINKfuQUmlBCyOfgJ3hl0Ch39k/lOgSbC3DeLJSHWslrrLNKUv uNFCCKDikLBOKjTmUOPKJxbfx4yCBAi2kdizo5YvnpeP9GRJQFP+CBH2RBosaHdbmNomdiFXjd4bW mgJF/lJg==; Received: from authenticated user by zero.zsh.org with local id 1lcZhy-0008EG-Ph; Fri, 30 Apr 2021 20:25:54 +0000 Authentication-Results: zsh.org; iprev=pass (mail-oi1-f177.google.com) smtp.remote-ip=209.85.167.177; dkim=pass header.d=brasslantern-com.20150623.gappssmtp.com header.s=20150623 header.a=rsa-sha256; dmarc=none header.from=brasslantern.com; arc=none Received: from mail-oi1-f177.google.com ([209.85.167.177]:45981) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1lcZhn-0007yD-7M; Fri, 30 Apr 2021 20:25:43 +0000 Received: by mail-oi1-f177.google.com with SMTP id n184so45200644oia.12 for ; Fri, 30 Apr 2021 13:25:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ZYXV7rWk4s4xMqF3FNF1FPOTQtZ1TKoCC6Yeq0l2cLE=; b=SeIu02UlQ1v6q3M3JpRJXuF7Ey2HH3h+am9Xy36uPW367PSiyDBvAcuRH79/agIczk RedcpDgxx2aM8NEZVyO5Vf2a+/PCeNxmCqN8hQ17cd1AKCbLpUpOcbmHpx3GzaVQqomO 2Xr+IaVL9D7KPk3VQpuBw+WdUD6Prxklt++lnrVWk+6T4yZpwuppLL9SJXvwX3t7E8OE 46iCkzlc0Gd9qRc31l7/uGWmVezdzx/TpR1OayRdeFjdGVT0H9A0kjKzmJqOSVYMMhms WA0JIjfpRmprtNWE/AkQO2uloNcHh0vFfJlDnZ0QHD9a1H33I2Obj59HjR4ESOFVRkIf nkWw== 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=ZYXV7rWk4s4xMqF3FNF1FPOTQtZ1TKoCC6Yeq0l2cLE=; b=SjYjXPMJ3qCCp+iJsqyazmspnm0DH9KTqpTmIZvjeO1PT6MkHh77bRufgmczx/AEdd t7BWgBzk36lVnErGU4Kd5BqqAMReIe3HrT46huA78+I6ptK85SWboWU+S8CVj9YZzqVG D6rdnN+Eez8/xkMbkGTDMi8Fy2rEaLZUhTZbJx4eMivGFRnyF3mmtQUOjpfC7ea5dO1f zJf44YOlAonlMdemdyqUHGkRczhRGIKNBBCpfaJd2SfGRU3tGaLCwMGtHIHrN14Co6an qMSGsQFBTfGswYskIt8KCuM8oT0Q/SsJ/42M2W9FcNTdbNdyfI5Q33o20bHYW87wm8y6 IQnQ== X-Gm-Message-State: AOAM533+p1cKKL7gNDfy8TEySb07d+POrxXhK6V1lPslqrmBPhXf6pwc vlZFMPJrpz1/91hUCbtZc1C+YAJGuOu8u64ywjVwCIM3UUY= X-Google-Smtp-Source: ABdhPJxnZhe08G34+TNsBWhJKN/fu/CfpSZAQuTGHnyxSZ1VC1RJxPm+2ogqOFvSI4LAcVUi9LXkYzHInBy9i/HwEcE= X-Received: by 2002:a05:6808:51:: with SMTP id v17mr12137702oic.132.1619814342076; Fri, 30 Apr 2021 13:25:42 -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: Bart Schaefer Date: Fri, 30 Apr 2021 13:25:30 -0700 Message-ID: Subject: Re: [PATCH] Add execute-command() widget function (was Re: [RFC][PATCH] Add change-directory() widget function) To: Marlon Richert Cc: Zsh hackers list Content-Type: text/plain; charset="UTF-8" X-Seq: 48757 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: 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.