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 23637 invoked from network); 29 Nov 2021 17:43:17 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 29 Nov 2021 17:43:17 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1638207797; b=et8qPaeIDuZu7JP6tK9HbnunFK9ip2reU7n3ypXnfOcKeo6mlRaewMVhWoqpjeayNeUPWO/oAU quEalNChsLdNCE4q0Xev1W6Nyg6BCIZmr7sbgLWxdRchOCiVbS+C7fa16+JTQfjC3rZw/kJSZC CWUWKOg4FfmQvmQ5ENCuuoja2eVqAFLH1taxi5jJWwSulWWs4FV34rKQfY4JCdvXewhYLEiTXC l34unYa2H7tymN0cKI+r7kMuLsrhTVBX9IJECn4ouDkMvN1uRlfwqTKYY5M4PLaVV4KMOevjnV 1YhA+6sLNWQZ+W1ROTZLFadbqzc1W8/OdYgiWw3tBS3l1w==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-qv1-f54.google.com) smtp.remote-ip=209.85.219.54; dkim=pass header.d=gmail.com header.s=20210112 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-20210803; t=1638207797; bh=/WGU931CzUxcP81xSwkld+ZuDFpQuGYfLu2kLZnMFg8=; 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=ogSc+a18+i/e2BgVltRnIL/3oV/ICxu5mvz/G5lgXlhdwbuS1nnPA6WvkXok7QG21vVSkt38Nw 00vpHp25+KOa8OP6vr05eYrPfHBIeiPgAOTgC3C7akUcjf0+pgJQpNMdZQsrqvBCMDotojyV03 ivAPycrkaX84baVkg5V87gTKk2n71Th26HwvxlnQNlttP2+okhL87+MaAbAKMivAtVs4QcBMYk Kc2ILBxut4q33YZuH90Faw3MrS51lXXbbcfkbl0PY9mCgtGhzZRehwUtUsxXqHVjml/xRhsRXl auQqZvioUC9mPl8E9Jhm6D4XKO/x2tADeXVGlHgL1vLwWw==; 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=/WGU931CzUxcP81xSwkld+ZuDFpQuGYfLu2kLZnMFg8=; b=PlEtemc2xlnXCoNBeXSmkd95A2 +MjhFcVsRkVYRswYLzJJAzdk87o920spdaqCh+WpghYk09mLyjnlpPzi9UYKjLHLBoFJoVWYr303a LmlePijtDpObnnxm/2o2yf4v395Wgg7Knff0orQycuSDsf9sKiR+k1xf+aYpQFg9xlb9jRiKe0ZlR Isv8V/8MfzGRz61dZ3lf13EC4SgkvsAlaI1wLhFis6oNaVDFTSandaHXfxn0zI0qIfmjYSmPq+Igf rIGQGfqaU+IwsZhgdXEjRIn8mjJ+tFUGHX8tNXUby47dW3bRm1CISIRzo8T0i6iWXXtKWcntR3v0o TMJxdPug==; Received: from authenticated user by zero.zsh.org with local id 1mrkgO-0005bg-KE; Mon, 29 Nov 2021 17:43:16 +0000 Authentication-Results: zsh.org; iprev=pass (mail-qv1-f54.google.com) smtp.remote-ip=209.85.219.54; dkim=pass header.d=gmail.com header.s=20210112 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none Received: from mail-qv1-f54.google.com ([209.85.219.54]:37744) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1mrkgA-0005Ja-8u; Mon, 29 Nov 2021 17:43:02 +0000 Received: by mail-qv1-f54.google.com with SMTP id u16so15317228qvk.4 for ; Mon, 29 Nov 2021 09:43:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=/WGU931CzUxcP81xSwkld+ZuDFpQuGYfLu2kLZnMFg8=; b=BoS4DSYhkh2+JGJ+SrO/iKR6jcyWEFe+ig/R2XMlAT6AXyF/t0Kbqpp0YsXBOZ6nG2 fR6CPWtwWvtPWyJgvd0jaHNTqQXAF1ggvRdj6PHzM750sA29sWv0gaZLHFiCEmeglqND /pxc5bY8nNzG+ADP45jaN3BTVtFuvJcwCRY6keU8kHY1CGHku4qxWQWlBInS+QV+kBY4 6uFUO+/zCL7NrRDz0BxPpok+obSx0WvVdvA/tlLuys5kJJHbhZ/In3KM5e7Ta7bqc4Ld IgdNBaO9mhEtXLh0Zfd2cCBAA3sWiKU8DBs1Dnfzl/d07FQubBN2PdBNZ3EHTyd6Rxbe xeHw== 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=/WGU931CzUxcP81xSwkld+ZuDFpQuGYfLu2kLZnMFg8=; b=MvJMub0YrHwNW/KS25Xx/EXwIvb4beDb4rE/0hKtSa4eGeUXE3lQl32qF3tqcPzweT DLE4V4AgTuKTyaS90PBz1ImxRG7+u/xSSGz6ASvF5TT7F5eTuEr6sDXVffXw9dD/SIay r8rFllK6dMbHYjwYf7nWW6jHs27/S1M5ll6FTmxO86Kl9nST1TDh4f5YLXjdDxr6dtdY pxdKmKC2sZpRR86YJ4KM8EHe5o5rtQSn9rHHHBF8p6zgGu8cE3cRbSX3iZzVI1vvLOr9 G7nkIlQysdloFXpA3LL9wnUyNCzss5ObW0YA0J4JrXSURPvxZ2nGPE5DeIlkU/RPACnh 83DQ== X-Gm-Message-State: AOAM531lFrZ24eStzMM4IaxYsoEVKm3d6eylw0kkayGPOL6ctOK+4BNT 1YG9f8iqGVo77yq1TpMpLZslpOFcJ8GApzQiZLXY2c8XO5k= X-Google-Smtp-Source: ABdhPJzGcVExy1ViD8pC5KGqydEa42kYFV4Icc+KXS1Io2+H5cwJIHGF7gfqppfT3Nlyy2QBEfHAwbvdzkz5txD2UwM= X-Received: by 2002:a05:6214:528a:: with SMTP id kj10mr31606811qvb.72.1638207781112; Mon, 29 Nov 2021 09:43:01 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Roman Perepelitsa Date: Mon, 29 Nov 2021 18:42:48 +0100 Message-ID: Subject: Re: Prompt expansion on signals To: Bart Schaefer Cc: Zsh hackers list Content-Type: text/plain; charset="UTF-8" X-Seq: 49618 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 Mon, Nov 29, 2021 at 12:36 PM Roman Perepelitsa wrote: > > I'm attaching a patch that implements it. Also > available here: > https://github.com/romkatv/zsh/commit/cdcb141c880799847f2b068fef5d097736d484d6 This works rather badly when a signal arrives during a long-running widget like history-incremental-search-backward. Given that my patch delays only zleredisplay but not "job done" messages, we end up in a sorry state of having no prompt. Moreover, the next typed character triggers zleredisplay that may cause prompt reexpansion with wrong options. Maybe the "job done" message should also be delayed? That would probably be OK in practice but I'm not sure. And what about WINCH if it arrives during history-incremental-search-backward? With my patch it won't be processed until the widget is done. Doesn't seem ideal. Maybe a different approach? Perhaps a new zle hook -- something like zle-prompt-pre-expand -- that zle would invoke every time before expanding prompt. The name of the prompt would be passed as an argument ("PS1", "RPS1", etc.). The hook could set REPLY scalar (which would be initially unset) to an alternative prompt value; it could also set reply array (also initially unset) to the list of options that zle must apply on top of the current options before expanding prompt (alternatively, the hook itself could change options if zle would guarantee that these changes will be reverted after prompt is expanded). People who now set PS1 in precmd will be able to do that in zle-prompt-pre-expand. It will allow their prompt-building code to react to changes in TTY dimensions and background jobs. It would simplify my zsh theme's implementation by quite a bit. Roman.