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 11975 invoked from network); 15 Aug 2021 21:11:43 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 15 Aug 2021 21:11:43 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1629061903; b=KXcz0euSORr1oyBLNHY69tkl917NF/Uvyh5HZLUxLZ9IPGL9kmIn+5XFWJSQPra3V329cMC3hw 6pYbCueCV11xuTgyM59rLdMJxUpBegJFc8FEYfXg7M36PVhIouIpr8P8nWzE7Kqo86iGhS+1Nq ia6Nbh4IoSAnWMaMKGAzFWuPkofdOsLV6FGdj9+9ABlm0pnHm63NWTnZtoTF2RpHFhuR/zV9uj 0O3kUAwMiGM0WPUfcrmnZkOIBGoumCcB04Tmd1VPfrWdqV14qHRvhjFIPGRPkKmAk3Kwmw00+D LqUQHEBbS1rrQEOXiOfxDhe+3DMXZkHHqwwPUoS3CiBlzA==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-yb1-f169.google.com) smtp.remote-ip=209.85.219.169; 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-20210803; t=1629061903; bh=cRjG0zDtD61pvwgj07T7l7d/GgfiacmodwLCxOQyx50=; 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=QH/I1L7164J0xMmUURu73wczTNOHrjfN1ZsSeLm7UTaz/LSHhIec1Ju5/yu+J7mDYKKUDhtz0T fygcw2g3zT0PEBvczguTYEnhnPZ1/HJ6IGab+Xa0l4No+ZBDBwHFf+3znvG4uP/h9OTNc56Heh yOWD7UD7EncR8jgku27hdiagPA8sVsISYYr9KLpmuIHWsNNXnDRYmKwGQiMBL6AahnI38T829f x+Y4vO1umL+CHoHhtUSK64KAmyvJoQGiI/Zkfx9JVqkdYQKJA+WnnFsI0CpA/QZVcCGkg7mXPi mlEQEfTST5qI4HwDy03kjqzoEGl0nydP7gh5mgU7cfIXIw==; 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: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=EtRNsgYcPBqDBSupjuoidVZV+zMxw2wvKJzKT4gF/UQ=; b=QcaG53TZgAWZnLdj5hkIe6JXaC JydAyR9M8nNj398y5N1B1AOQ++EmAw6n+tBlEhyKTGGWpITdnAdcsB2D6HH6iI07pM8o8yXhXLlVa wTLcZGfCMIXUx+Wv+XI6LwdpfNhlW64JkgM15gJT1Wbmno7aeLM6n8VdGcU2SYpbMbsZPDdTbhK3n vBcsK8eLdX8Tsm230kV6zGLs60fyLn7eF+Vd0WK97CBczS2C33JA4qQoVjqj8F9dwC/qORlnTnOLM xP9OUTA5Sf3jyTbQwkJcqklflHtgicUxoUgeOOT0a2q5YxV6M2kyb24y67u1LxKWwYAmvOQW7d+sQ SBkq0xaQ==; Received: from authenticated user by zero.zsh.org with local id 1mFNPy-0002Qg-GJ; Sun, 15 Aug 2021 21:11:42 +0000 Authentication-Results: zsh.org; iprev=pass (mail-yb1-f169.google.com) smtp.remote-ip=209.85.219.169; 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-yb1-f169.google.com ([209.85.219.169]:42691) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1mFNPC-0001jK-3u; Sun, 15 Aug 2021 21:10:54 +0000 Received: by mail-yb1-f169.google.com with SMTP id m193so29234870ybf.9 for ; Sun, 15 Aug 2021 14:10:53 -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=EtRNsgYcPBqDBSupjuoidVZV+zMxw2wvKJzKT4gF/UQ=; b=T5ry1JQgPKTN5RDjeLf4r82qFUYrrcN1P1Gvt/XuEMRvmFf7bTV2tNUGVisCxKZx8m MU5UKmpUzlhQiZw04WiOhIHf26cyh5ACWpnNAL5jRTwLUfCR/4UMixye18/eMpnu9zGP f63QsmXtkVEf7SjIouRz6eNwJ1lxh0c2FAPr6HM/5/Hz75dsGuoz5wcjf+oUksZQoMQG g/18Ym0qR3TTXLT1XKfCYLJC2p7XG3CyhMRmbYhDMKBzLggYg1d4toDd8Kq5ZACItpTz ScsNeEQ9zyzow5Q3U4HXsig82TEPf4f5fw8RlfX9C3PV5kYJ6jHtBmM3vI1MZMVSmkLq z+uA== 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=EtRNsgYcPBqDBSupjuoidVZV+zMxw2wvKJzKT4gF/UQ=; b=m8/dF1Rct6MQdWTlw8KJPccEMhNS8gmdDJoCiXY/GiojjeoPkav8xC3/Cys4JNAFZh vO4SZdNZ4PVR79V9toLBF3qSl3s4oij6qsD9hOFhi/LdNF9Z804SQhgjPDRFZnNcuZUN 9Car9D/G88nOrR56A7MiDmYj7GAo2sbECzh9hbcXJPri7WqKBHPfnRdR3kMcG6cCQmHB UgqG3s5rCe9p0zrY43RAPUtF9XsiubdMmEsO9dFf18rDXmTTWBuHffpWmVb/GkT5L4Tn djqYrZpLhIoWa01fTaem0DFPIibrlZEXbHlOD/Cmv0wfEuof0v3AJLugtHLKyEe21jim ax5Q== X-Gm-Message-State: AOAM5301g0pbVfb/1ccWH1tZsZ4b77ilWpa/K07Lublo17M3ftuqIChw 7Xm5OZsOOOcNuKb5KvgAhNiCP7cPFRUfSUAl7iuokqWCdy8A8g== X-Google-Smtp-Source: ABdhPJyD7sqCDjHD4e3FCHXZCct6qpTqTZW92mqvfA/SWXnhQ4nZZDt9kWwgxU9JQIIaa/yHWZUagnvBxT3K1WSikto= X-Received: by 2002:a25:e042:: with SMTP id x63mr17168551ybg.398.1629061852584; Sun, 15 Aug 2021 14:10:52 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Bart Schaefer Date: Sun, 15 Aug 2021 14:10:41 -0700 Message-ID: Subject: Re: chpwd, precmd hooks have "zsh" in $0 To: Roman Neuhauser Cc: Zsh Users Content-Type: text/plain; charset="UTF-8" X-Seq: 26932 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: On Wed, Aug 11, 2021 at 9:40 PM Roman Neuhauser wrote: > > [...] i want the > shell to be simpler, conceptually smaller by having one kind of > functions: those that have their name in $0 and which don't forget > redirections defined after their body. Just a couple of thoughts about the latter. First, it doesn't work with autoload. You end up having to do some equivalent of adding the extra set of braces, inside the source file. Second, just worth noting: % func() { print $SECONDS } > /tmp/funcout % setopt noclobber % func % func zsh: file exists: /tmp/funcout % Third, I'm not convinced that the semantics of memoized redirections in this way is actually simpler or easier for a user to understand. It's the only case where you can write a redirection in (what appears to be) a "simple command" (doc term) and NOT have it immediately take effect. Fourth, related, why is redirection different from pipelining in this particular case? Why not parse the entire pipeline as part of the function definition? (Which would have to be done by treating it as part of the function Eprog, see $0 patch discussion on zsh-workers.) The "workaround" for this one is to redirect to a command substitution. % function f2 { print $SECONDS } | cat -n % f2 zsh: command not found: f2 % function f2 { print $SECONDS } >>(cat -n) % f2 1 186 % I'll conclude by wondering if there are well-known semantics for execution of what appears inside the command substitution in that last example. DO NOT TRY THIS: % f3() { print $SECONDS } >>(f3)