From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.devel Subject: Re: unwind-protect within while-no-input Date: Sun, 12 May 2024 04:59:22 +0300 Message-ID: <4220bb78-9bb3-4b46-b674-ac0d2ef9c9f0@gutov.dev> References: <9E5E5354-052D-43B4-AA09-4FCC4F0EFC4D@fuzy.me> <9e9003da-a8d4-4585-b62e-e780d2595ac5@gutov.dev> <875xvkxaqh.fsf@daniel-mendler.de> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="1921"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla Thunderbird Cc: Zhengyi Fu , Spencer Baugh , emacs-devel@gnu.org To: Daniel Mendler Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun May 12 04:00:11 2024 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1s5yVV-0000Gl-3G for ged-emacs-devel@m.gmane-mx.org; Sun, 12 May 2024 04:00:09 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s5yUt-0005uG-Vj; Sat, 11 May 2024 21:59:32 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s5yUr-0005tr-RB for emacs-devel@gnu.org; Sat, 11 May 2024 21:59:29 -0400 Original-Received: from wfout7-smtp.messagingengine.com ([64.147.123.150]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s5yUp-000326-Tm for emacs-devel@gnu.org; Sat, 11 May 2024 21:59:29 -0400 Original-Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailfout.west.internal (Postfix) with ESMTP id 0F8AE1C001B8; Sat, 11 May 2024 21:59:25 -0400 (EDT) Original-Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Sat, 11 May 2024 21:59:26 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gutov.dev; h=cc :cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm2; t=1715479165; x=1715565565; bh=VNKhgj7fUwTWi7Y/miXw8ElagHPqBkpEJ7S/NQsp2yc=; b= Q49xaw35Ae9X5NjwCQDGCb3fkUVwONRy5JDoUcNZdfQGp/GloxdATSa8JZZNCEqx DQlI6Z1d78dLJKftRX3y7cg+ZYl28dWUhmXk8/14mKknG++/Cz1rsD7swS4gak+X ip26Y5rhXVsEqlPR1Cvl0IZT1kxIcr/+EmURV15pY0qzEbDCnIkH+HG06Cicyh8E T6hcKNS0dx6ca2rvfoNukT/eHYme901QSAr/zuNHmdJXX9RRVmPXmXB+W0RO9Ug5 KKppcv/lg/4YQXPdhPuRF5PoqlbkZ95Kq+tB1MtEqP86pA8S4pbLh8/HVKxkIgep XjBcwzFmlTOGq5X2CC63eg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1715479165; x= 1715565565; bh=VNKhgj7fUwTWi7Y/miXw8ElagHPqBkpEJ7S/NQsp2yc=; b=d gVpWJeoYNXmEQ5pbbatpkre5RxxofT4AxRoAPwBifetRe9MHB9ZmACo0Lt1PvC8x gdvwBT78glgeITPr63U14GOKpvzxpkbFDAAvBEKABVgqXZfTdu67h8QLMOX4lfez uSH45+h0y89LxMOVsqmb7BJW+JBWVvIzsm5m/RhHQTL5m7O14GLtrxSB6bS6jutG SovFdZsjriC8lY7DlH9iq1rGlDKqiJT3ojbv8e2jylPd4phUvFQgU5mdMlOOyYBV JyovAmFR3zeZqH3dJhwZ8FKlu3F6dn7NFCQBj9fYTYhE7iA+nJVakVrgLqZRWJ4M WXCeavsflnt5LQd/Nyx8Q== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrvdeguddgheefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepkfffgggfuffvvehfhfgjtgfgsehtjeertddtvdejnecuhfhrohhmpeffmhhi thhrhicuifhuthhovhcuoegumhhithhrhiesghhuthhovhdruggvvheqnecuggftrfgrth htvghrnhepteduleejgeehtefgheegjeekueehvdevieekueeftddvtdevfefhvdevgedu jeehnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepug hmihhtrhihsehguhhtohhvrdguvghv X-ME-Proxy: Feedback-ID: i0e71465a:Fastmail Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 11 May 2024 21:59:24 -0400 (EDT) Content-Language: en-US In-Reply-To: <875xvkxaqh.fsf@daniel-mendler.de> Received-SPF: pass client-ip=64.147.123.150; envelope-from=dmitry@gutov.dev; helo=wfout7-smtp.messagingengine.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:319174 Archived-At: Hi Daniel, It's good to see you in this thread. On 12/05/2024 01:08, Daniel Mendler wrote: >>> Is cape-wrap-noninterruptible from the cape package helpful? >> It should help, but it would be odd if any non-trivial completion function would >> need to use cape to function inside corfu-mode reliably. > cape-wrap-noninterruptible and similarly cape-wrap-silent and > cape-wrap-purify are meant as stop gap measures, used to wrap non-robust > Capfs, until they are improved. There are multiple Capfs in the wild > which regularly print messages or throw unexpected errors. For example, > pcomplete-completions-at-point even modified the buffer until Emacs 29, > which could be mitigated with cape-wrap-purify. How would such a capf (that has to use cape-wrap-noninterruptible) usually be improved? What's your recommendation regarding the necessary cleanup inside the while-no-input block? Michael's suggestion -- (let (foo) (while-no-input (unwind-protect (while t nil) (let ((inhibit-quit t)) (sleep-for 10) (setq foo 'interrupted) (message "foo: %s" foo))) (message "foo: %s" foo))) -- seems to work. Meaning that the interpreter doesn't quit at the beginning of the unwind block (right before 'let') even when some pending input exists. But is that a reliable way to write this logic, i.e. one that both works on all supported platforms and is likely to survive the potential future optimizations in the Elisp VM?