From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Michael Heerdegen Newsgroups: gmane.emacs.bugs Subject: bug#34535: 27.0.50; emacs -nw: while-no-input + sit-for + => Quit Date: Sat, 23 Feb 2019 05:27:36 +0100 Message-ID: <87pnrjqgcn.fsf@web.de> References: <87r2c4ennz.fsf@web.de> <83k1hrrejp.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="80453"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Cc: Stefan Monnier , 34535@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Feb 23 05:28:20 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gxOvE-000Kp8-5Z for geb-bug-gnu-emacs@m.gmane.org; Sat, 23 Feb 2019 05:28:20 +0100 Original-Received: from localhost ([127.0.0.1]:60850 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gxOvC-0000yb-Ut for geb-bug-gnu-emacs@m.gmane.org; Fri, 22 Feb 2019 23:28:19 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:60900) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gxOv2-0000yU-PI for bug-gnu-emacs@gnu.org; Fri, 22 Feb 2019 23:28:09 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gxOuz-0005R4-9A for bug-gnu-emacs@gnu.org; Fri, 22 Feb 2019 23:28:07 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:35192) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gxOuw-0005M8-Gb for bug-gnu-emacs@gnu.org; Fri, 22 Feb 2019 23:28:04 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1gxOuw-0002YE-6i for bug-gnu-emacs@gnu.org; Fri, 22 Feb 2019 23:28:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Michael Heerdegen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 23 Feb 2019 04:28:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 34535 X-GNU-PR-Package: emacs Original-Received: via spool by 34535-submit@debbugs.gnu.org id=B34535.15508960749793 (code B ref 34535); Sat, 23 Feb 2019 04:28:02 +0000 Original-Received: (at 34535) by debbugs.gnu.org; 23 Feb 2019 04:27:54 +0000 Original-Received: from localhost ([127.0.0.1]:48736 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gxOuo-0002Xt-0u for submit@debbugs.gnu.org; Fri, 22 Feb 2019 23:27:54 -0500 Original-Received: from mout.web.de ([212.227.15.3]:51931) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gxOul-0002Xf-RA for 34535@debbugs.gnu.org; Fri, 22 Feb 2019 23:27:52 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=dbaedf251592; t=1550896058; bh=q6YT2DMGvv7a2C/lSk+QId01LwgLcEXrg3hSI2qBT0k=; h=X-UI-Sender-Class:From:To:Cc:Subject:References:Date:In-Reply-To; b=PlJLc7gdOJlG6qfb8HAott6zjh3bDKz18TS4EGAZXduyAZ1nKEFyhSBj1yIyQP9xP bXvT48HohAGjgLTR8MFShAu6WbPS7kAE/LJRdqxVHSD7iQS+fXqfgkc/2dV3DfviEt GLOHi/7dqgRqc/mVEhrmmV1ngRZRCXhdkc+3aK/A= X-UI-Sender-Class: c548c8c5-30a9-4db5-a2e7-cb6cb037b8f9 Original-Received: from drachen.dragon ([88.67.111.211]) by smtp.web.de (mrweb002 [213.165.67.108]) with ESMTPSA (Nemesis) id 0LtFAh-1h92bB28aZ-012o4x; Sat, 23 Feb 2019 05:27:38 +0100 In-Reply-To: <83k1hrrejp.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 22 Feb 2019 18:08:58 +0200") X-Provags-ID: V03:K1:oN5LfOWcgMvjbW7oXcyUxMWSulc6e2oH4DrqCCuChjyn7ykIgKY b8GTyDNF5ZbcTuLchEUmAI4xKrZMD1SQqZSAQUHiIiuejhuxvz1oFa8wMuwN21hoszTDsnZ tyO4OGyOjV1YPwzy3qQ7110I55zz+QUJqWHDgWsVZ+PGtiSLQ9yeQ8BnBCeKeizSjlfPa4b /9vlsGEXp9SAgjSCgsv1Q== X-UI-Out-Filterresults: notjunk:1;V03:K0:YVR8uM6GnNQ=:69ziS8tJp8KrpKeu5phtLO Nj5a6xdkORxCzababMZzISgcO6G3JrVonQCcxjjjtYoTG8ACE3etKV3sWmmN3yhBA5u9qVrWI dKK0N5vhZywTnaFfhBnMD8RNTXN8YaCNH3gbz5gEapJxiRHXxs0rhjX6K4+djaXMAHHi9sOFa lyL5UUCHMPtogHvW36f9HWlL7l4Y2R7YsBLApl+j3g6ZHUVrgYFjY2Z3p0kYuD1SffdEyWKiO kSVYakNvx8BXUdS2Tlsi5rVe7lNQ8J4SsHDskyrUpr2Ohni5jforECG77lpB2F17CxcO3MELK p8VC0Ib7iRMfkNoF7QRftssuRbuQE8BRMZ/qAA+NvYq79tMCUeRGeNCmyJvsQvkY269PHPpeR 7kHDxYRqYhhVhV19puTMUaLxyR0bQgIvgIYamfLkoOO6EcBqG+x7w6Q4qbYJ0e613jyn+eS+z IQDqHY3Bbl1P63xbeL7eJA4/BIT6eaJMvonLvsFTj+PENRlrZcpyuBPLZe+h8nWIQhsQDrkkH hnhsPng9D1uHgTiJOB7QyqJA/rU3Gpu71N6gTfux4KoxP/S8WelfBRk6kECJTG+YIbko6MEqg hZ29Sm91xKhrtU6iRDszFxSrOSCwRoc3qgtvDK34DYKfP91E3Ac+vzM+Wkk4muPGyKfQpc2Ek 722CEPivtfUN8JaaNsGZiaGZjCjAho+kfRQCNj0kn8KIvI7ekEEwWLLpMhaVtzc2Zugmh7ar1 339cYtKtCx18xSqpu858XFhxRYZdEMeE1h0nr+ecT82T9FtJ2g4MIqbdpMbruBNt1alRi333 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:155665 Archived-At: --=-=-= Content-Type: text/plain Eli Zaretskii writes: > The below seems to fix the problem, but I hope you also have a more > complex real-life use case, because I'm not really sure this solution > has no adverse effects elsewhere. My use case was like this: --=-=-= Content-Type: application/emacs-lisp Content-Disposition: inline; filename=test.el Content-Transfer-Encoding: quoted-printable ;; -*- lexical-binding: t -*- (eval-when-compile (require 'cl-lib)) (defvar test--mb-hints-timer nil) (defun test-trigger-mb-hints () (if (not (timerp test--mb-hints-timer)) (setq test--mb-hints-timer (run-at-time 2 nil #'test--display-mb-hint= s)) (timer-set-time test--mb-hints-timer (time-add (current-time) .5)) (timer-activate test--mb-hints-timer))) (defun test-setup-mb () (when (timerp test--mb-hints-timer) (cancel-timer test--mb-hints-timer)) (setq test--mb-hints-timer nil) (add-hook 'post-command-hook #'test-trigger-mb-hints t t)) (defun test--display-mb-hints () (when (minibufferp) (while-no-input (let ((ol (make-overlay (point-max) (point-max) nil t t))) (unwind-protect (cl-flet ((display-message (lambda (message &rest args) (setq message (propertize (apply #'format message args) 'face 'shadow)) (put-text-property 0 1 'cursor t message) (overlay-put ol 'after-string message) (redisplay)))) (display-message " [A useful hint]") (sit-for 5)) (delete-overlay ol)))) (when quit-flag ;; When `quit-flag' is bound here, it had been set by `while-no-input' ;; meaning the user explicitly quit. This means we must: (funcall (key-binding [(control ?g)]))))) ;; f12 to start test: (global-set-key [f12] (defun my-test () (interactive) (minibuffer-with-setup-hook #'test-setup-mb (read-string "Enter a string: ")))) --=-=-= Content-Type: text/plain This seems fixed for me with your patch. In real real life, I made it so that while-no-input only covers the computation needed for the minibuffer hint (counting matches) which must be interruptible, but not the sit-for used to delay the minibuffer hint being removed. That sit-for was inside while-no-input originally was a matter of laziness, I was able to rewrite it to circumvent the issue. Thanks, Michael. --=-=-=--