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,T_SCC_BODY_TEXT_LINE, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 23147 invoked from network); 4 Jul 2022 04:38:16 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 4 Jul 2022 04:38:16 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1656909496; b=iAIk9U6wsBb0RITxfaO6gPymz7uLz5qOXPhkLdhw1Kykl38TPs5IoqaDC3lCrXkuG9YiWofEFV 1/HPkDZyHT3xa1b2ce7YJYldGRSN2n6Kn+m9l1KtufhDqrbfQblXZHPD1xVUSkpW9ygI381NsH UB/9lu7vnoEz6RHY8MzQ1VMY023jgSiW1UzPxJ7VhcinEAKl7RLMmXoDGJjVSznuwDKj4Mi3g6 kS0rljQYK9ddIl+9onVL7Hp6DUDtew8M8D4xq97eQ1D6ZpXQbqeCtKlPGbavonGVpFBd2TmGZ/ sNbgu8pSa4SGwAfiDiqZUIqRoiYgERBf5CdxLnlQsnht6Q==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-ej1-f45.google.com) smtp.remote-ip=209.85.218.45; dkim=pass header.d=brasslantern-com.20210112.gappssmtp.com header.s=20210112 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=1656909496; bh=HmfUevoss/AepuIOsSn1qXKQFxLSQiislIXkXUrLFKg=; 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=AgApeaJXfBnhgG0BM5rk9JZ/OvhubSE9OKOIazXJmNMiPygWwe22i54emvhfIBoz4LsrBu4MKZ uKZagFc8j95LY8+LCY6LWZxyxFAwXdbZzpz9L/SVvXVNebk+kl/UvUBDY+9PC9cruigEDkKVkv QbbcoinfahIAEOATEOcgDfRa1Q/AyfwqVqUUoyFaNqdJafdpYAMixa5/jAD2pKLZaW3s/eGyyl rX4AZTdX1NxQHrA/ItfAihdBrB1Mpng5HJvjBrQDlE8zOTXWzAfB+sb6nFpQjWAP3Ao2nQpt8I 4cOpvz4kCrvrOkDbn1mMYC/k7vOW4ibKrKj+X5tFfxuSjg==; 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=ugiIA7hN+hzLYfTZ2ouXfLZ4T8aiLgyytsVehKHDR9w=; b=eIuPK9vFdpx0+BX7fBeRKxnMwl N3fWCEXDVfvIbXSeJh8LSRCLk1Ug9wwHIvBtYG0X1ZPomyV7bkwo+gnrpyrF2BlIpyJFddQlLWjjn wduCRyj+IaA2lNW30vnLIMZohq8HVUEkG3RcHxtsg5gQsNikAhMJSf3jPsF/Su7cViBJZ/62g2pKU 8yE2JdnvPdlkLnoDCMxr+JqVhj0mOrovg8aaY1WVQRf9V6nPJj36FfmhH9AuiHC9A0HnmmhB7MDAM LAWFk5fpwWu4vZ1lANnig8jypCqFAI8caxIHEynTL3k0cFefkz/IhcthuSvBcL5a/nSnRh0R/JcJn IhkR5Tcw==; Received: from authenticated user by zero.zsh.org with local id 1o8Dqg-000N2o-Gj; Mon, 04 Jul 2022 04:38:14 +0000 Authentication-Results: zsh.org; iprev=pass (mail-ej1-f45.google.com) smtp.remote-ip=209.85.218.45; dkim=pass header.d=brasslantern-com.20210112.gappssmtp.com header.s=20210112 header.a=rsa-sha256; dmarc=none header.from=brasslantern.com; arc=none Received: from mail-ej1-f45.google.com ([209.85.218.45]:43558) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1o8DlW-000MbV-37; Mon, 04 Jul 2022 04:32:55 +0000 Received: by mail-ej1-f45.google.com with SMTP id fw3so14570476ejc.10 for ; Sun, 03 Jul 2022 21:32:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20210112.gappssmtp.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ugiIA7hN+hzLYfTZ2ouXfLZ4T8aiLgyytsVehKHDR9w=; b=71Rv8LjiucnnPu8Ubn+ovuHHL/fujps9i+wzeYN78gw6LFMbd7Ld8cQUh4YNes8QLE iWoy16hhu9cH80cv9wm6SEbpY4GIZpEcVir9Rebk4Nd7uye0zDbb3UTFMPzrdA7GK0kn S70097oFIdaql2ew3MqVyAmI7BQvePjlv+oO1sQhkAzaTperA/EuxqBvhAiGeUwE2KTu Xx8595F211YnWRusHdW40yqwuxniOSdHb2uq+y7Bcwr1AGrM53vg67owm5rPR7JuUHQP hbu5aUuZznvePA1rvoFi8CEISuBlhP/2gRk+9dcNVWTGrwjK5G+CS+SwBD3rgrE0x+/H vU6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ugiIA7hN+hzLYfTZ2ouXfLZ4T8aiLgyytsVehKHDR9w=; b=1GtJnWd7RBNfV52+K4mMON4eZraf3vYMfVhUl2a45d/zQlCWRyBOe1B1yz4qIQLNd9 KTvYT+HCOM2Vr3Tioc48/3dadqybCHj0gTehlz/ypqlGxx2rrzxUjgk/MkJCmyxPa6Cw muW5HmOIBiU0aKpLX6IunvUpe9Ve1KvOm84yLGRxxCoRicUWn/3+dGuM3orpoOxpmvWZ 6QidT1dRo26HSKsJNdWzrz0nPuL6zuZbOoxckUMTt4mbres38r2IP9svif0ffb+em6+A WKOq+hNieW8Lu/jmrsPSvMzYYczj6FVNCR7tVfso1zK+L23is5HxD12/g5TNvBIb4X37 T5FA== X-Gm-Message-State: AJIora8x3NO7MTXKYydLSHdsbiJowB1MKzSEOmAkiVor9jaz/5LAtNNN Dax2dGFH0mCUUMVOVZfls9TZofDcQzt8nVWAoAReDw== X-Google-Smtp-Source: AGRyM1tZAiOCz2Vg8rBAKrTUwSE8SDD9grOzK60K+CpBTmVE+ZDt1SxZI1EWfyu4ZQtgzltUXVX9oule1z9GfnD1Qzg= X-Received: by 2002:a17:906:749b:b0:722:d9ce:fac3 with SMTP id e27-20020a170906749b00b00722d9cefac3mr25941420ejl.699.1656909173502; Sun, 03 Jul 2022 21:32:53 -0700 (PDT) MIME-Version: 1.0 References: <0404aac5-7212-2c10-7202-60400fc4222d@gmx.com> In-Reply-To: <0404aac5-7212-2c10-7202-60400fc4222d@gmx.com> From: Bart Schaefer Date: Sun, 3 Jul 2022 21:32:42 -0700 Message-ID: Subject: Re: [PATCH] _complete_debug: do not clobber PS4/PROMPT4 To: Eric Cook Cc: Zsh hackers list Content-Type: text/plain; charset="UTF-8" X-Seq: 50399 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 Sat, Jul 2, 2022 at 7:44 PM Eric Cook wrote: > > So unless there is a reason that I am missing, the following patch should stop _complete_debug from overwriting > PS4/PROMPT4 All of these paired variables -- PROMPT/PS1, PROMPT2/PS2, etc. -- are implemented the same way, by pointers to the same internal C string. Even if one is local and the other is not, they can't have different values (which can be its own strange effect). Due to the way local variables are implemented, this means that when the local scope ends the previous values of all the locals are restored in what amounts to random order ... so you may or may not see the behavior you described. > - local PROMPT4 PS4="${(j::)debug_indent}+%N:%i> " > + local PS4="${(j::)debug_indent}+%N:%i> " Although I can't imagine why a completion function would change PROMPT4, I still think it's odd for one of the pair to be local and the other not. I suggest instead: local PROMPT4="$PROMPT4" PS4="${(j::)debug_indent}+%N:%i> " This will force the up-scope value of both variables to be restored properly regardless of the order in which they're unwound, and correctly identifies PROMPT4 as local to called scopes.