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 4839 invoked from network); 29 Nov 2021 01:39:17 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 29 Nov 2021 01:39:17 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1638149957; b=FVrgbgwgNMr8BDp9vH7me6LWuyvHDn9urP8BdsxZ40fTXW11QmREz7TCRz6XaOSo2c7KR1E1L3 CONUVVkm+tndbg69ectQs16KOTBzW+GpDdZRbhwajCqhJEDgGeieUbStdwJE++9LJWOCrJrd8B prTv+jn7fYg1qBeYLKcKbgbpBmRJBa7ldU5V9p0DWuQxarTan/Kxkc/yTcHD0xUlMdtuqRNGor w5f8qlcy3C2oMXyaGOVGS0RX0uQQO5sZU5UDFUxmmKSwS9NmVtWF31aRLMerUr5cjUKsgWjLMO Hjptg2DemUmHt7c4W3fsItFmjAO5LVoEl84VHYIz16gpeg==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-yb1-f173.google.com) smtp.remote-ip=209.85.219.173; 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=1638149957; bh=pR9n20Kpbr708OetOfqv97dgpb5ajVCL9M8iZS0VU4Q=; 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=MIioMEm7YvxJsfdvVVK41GBiJChLr2kvjo2sAdwEEimCtF65eQO4ueZmImGVI7D0KjmxbT2kf2 N5OfPm9VzXtBmd7vXQPmNrFHRbU65g+wcUIJjC/PsxBhbqaoLWLIMkpp3fV6MED+S02gy3iIuF Ll5vg9QiRPx7t4i14tmiQorC+qS6b2svej0UU4LjxTamgo5hBAGN/fNMfPoS8Z9ObD7Pmf1Tp0 GUt6FLZ7N1HAVPY+437SAzzzB5Aq30mFCY5cJjQInAJS/D4JGUmwL9LLqi0kYEyjB+6XRfDfUS O+ymovDDjYf0BRLaQn+QP+38kJJ76ZYf+rB8sVges6Okrw==; 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=zRR+JBEh5nx4rCWTmua47jaLnv0H1OGmo8mDRn5ATKE=; b=bUCMFtrPxYxxWawzuolZFLz8X8 c7C7lSXNXTbysm6QQi2/5Ah0sLZLNDbzFQHuYyqQSa22eNEcFfsAoCKNhhzaj0v5iLEVd62AfZQRJ lCHTKvRHMJqdqtBRt7oH0N2ftXQwbjOX3n5P4sLMcknncPSopfyQVY3GaqUPtqCf3iP/rKWhrCfYy 88iQhpI4zuMN3Mj/bJfEPMvAg730+G0ly56V2ij2/OxOGyjWqfETGx/CAdu9AS6hYxkiQQ/UsoyWI S5X/21YKZ7pa1Oax8RWSPV/1cnx7wevHl5a0gw3ginhKv3F4/wRhuPTzBZobF/SDAD/6269B/g+fA ttPrSQJQ==; Received: from authenticated user by zero.zsh.org with local id 1mrVdU-0000NY-A1; Mon, 29 Nov 2021 01:39:16 +0000 Authentication-Results: zsh.org; iprev=pass (mail-yb1-f173.google.com) smtp.remote-ip=209.85.219.173; 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-yb1-f173.google.com ([209.85.219.173]:44736) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1mrVdE-00006l-H1; Mon, 29 Nov 2021 01:39:01 +0000 Received: by mail-yb1-f173.google.com with SMTP id q74so37458844ybq.11 for ; Sun, 28 Nov 2021 17:39:00 -0800 (PST) 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=zRR+JBEh5nx4rCWTmua47jaLnv0H1OGmo8mDRn5ATKE=; b=MRQ0Aj2qLbvtsmt87QjW+2nAX5ekchUq4Mh7LtB19dOn8t1LRdVZsJmWG4M8mt5hou 5il+raI6g6CuwFkgfL+OvwQFcSykkQw/haZEV8uksrnB0n+lv9bj05ftJWI1FLwL40QH 43D4jsk5Z41awLbbusLO7J0VgLA/fkJBRhjZcfU/H3ehvA4Dv27QrXuhGseAMUN66rzp ALEix8tZ40N7R52PwVLei6wEaxY/NI/9pqpvRktnV3QYq97rwm3IRWSWwsmQFACwNNnq J+rm4R9nG1Bg8b5T6+lYZDLgXhiTKjco5ddHKasiRDUWYHdVQHRWkLcfdxppCFBli+CT tPLw== 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=zRR+JBEh5nx4rCWTmua47jaLnv0H1OGmo8mDRn5ATKE=; b=frQT84Zcs5hNB/NDDsI1KXdBVd3IV2SFrvL9M6+GF28pAdWGmI6oSCmCSb2PlZHKr/ bYCAU8vZCH3gQUikWOXVPjFe832o+msg+f2YNRnxVwgefe9owta4l4pgQBeThTG9xyu8 hU67OvWSedyAkZdJBHc+ktcXkwJPWcoz13BmdX+Gg94EfnYsZ+yjbP656CenFRIp8P6p +vdgGXeIgYEGQpLxwAjVplv5j2kHNkw50ZFFWx7XOBmlMh3bV8pCv16W0xOo4j3FamlR B8N8qrozfqlOhK7liawQ+A83fOW9YA3ocDAK3ZiNgLptGvc2nMFdZRFjPpRWvwyODcpX bd2A== X-Gm-Message-State: AOAM533arjdb1dykYk5dQD5mZ5C0f08V62Nj2khp19VAeomDNQC9NPW5 /rv1Nf8KTZUZGpsIy7qyk8+TvkGfTLG5j+lwUM40ZA== X-Google-Smtp-Source: ABdhPJy1PRGCK2pYEd3x4+0nOAIc3mO+ozpOY2egg4ZVr1DoCY4qYQTNgZH54H/Dm8UvSj9Pi08LeB9NMc/amjsGJ+w= X-Received: by 2002:a25:ae64:: with SMTP id g36mr31807860ybe.45.1638149939145; Sun, 28 Nov 2021 17:38:59 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Bart Schaefer Date: Sun, 28 Nov 2021 17:38:48 -0800 Message-ID: Subject: Re: Prompt expansion on signals To: Roman Perepelitsa Cc: Zsh hackers list Content-Type: text/plain; charset="UTF-8" X-Seq: 49615 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 Sun, Nov 28, 2021 at 12:32 PM Roman Perepelitsa wrote: > > On Sun, Nov 28, 2021 at 8:50 PM Bart Schaefer wrote: > > > > On Sun, Nov 28, 2021 at 2:01 AM Roman Perepelitsa > > wrote: > > > > > > For this to work correctly, prompt_subst must be set when prompt is > > > expanded. However, this requirement can be violated when prompt is > > > expanded in a signal handler. To clarify this point (in part for Oliver), the question is not what happens when the signal handler is a zsh function and that function expands prompts. The problem occurs when a default (C-implementation) signal handler causes ZLE to redraw the prompt as a side-effect. "... when prompt is expanded in a signal handler" confused me for a while the first time I read through this. > > A more egregious example might be when the global settings have > > "unsetopt promptpercent". > > I can control these in my config. I'm not understanding the distinction ... you can control prompt_subst in your config as well. I'm just pointing out another case where a user might want a particular global config that is messed with by "emulate -R". > I cannot control options that are > active when zsh processes SIGCHLD though (unless I never change > options in zle widgets). For SIGCHLD in particular you could try "setopt nonotify" in your zle widgets. That doesn't help with SIGWINCH, but it might give us an idea of whether there's a problem with delaying those signals. I haven't followed the logic through very thoroughly, but what if instead of delaying the signal handling, we delayed reprinting the prompt? Is there a reason an in-progress widget would want the prompt redisplayed without an explicit call to reset-prompt? > > Are prompts the only case where this is an issue, though? The most > > visible, certainly, but "zle -F" for example? > > As far as I'm aware, prompt expansion on signals is the only place > where it's impossible to set options. Perhaps I'm misunderstanding > what you mean by "zle -F" in this context? Sorry, I got the question sort of inside-out (see above about "in a signal handler" confusion). The relevant bit is that, like a zle widget, a zle -F handler might have changed local options and then be hit with SIGWINCH. > > What about the reverse situation, where the signal handler is a > > function that changes options locally? > > What do you mean? Ignore that, more confusion.