From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.help Subject: Re: Redisplay inside keyboard macros Date: Tue, 08 Feb 2022 18:47:09 +0200 Message-ID: <83czjxwbjm.fsf@gnu.org> References: Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="28185"; mail-complaints-to="usenet@ciao.gmane.io" To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Tue Feb 08 18:44:52 2022 Return-path: Envelope-to: geh-help-gnu-emacs@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 1nHUXr-0007Cs-Sd for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 08 Feb 2022 18:44:52 +0100 Original-Received: from localhost ([::1]:60712 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nHUXq-0005b8-Gz for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 08 Feb 2022 12:44:50 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:40552) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nHTeF-0003vU-Qz for help-gnu-emacs@gnu.org; Tue, 08 Feb 2022 11:47:25 -0500 Original-Received: from [2001:470:142:3::e] (port=34386 helo=fencepost.gnu.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nHTeD-00062e-PU for help-gnu-emacs@gnu.org; Tue, 08 Feb 2022 11:47:22 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=c1H5H8kfTinndgQAq5ys8e64rYy+DnIZvHMLWy2nRrk=; b=EGQ8ugOT2yZU 8b9FZPmF4lcTzJ9x6JpRt31h2q1qypPzODQAZHqv7sjXHeaNWY2s4qAFWLLk7nYnvZrL4VSIEKj8C cH+WRAHzMYKKIpxz0FrkBUgshmgMCbUokMje0LyFa4oBPz/5uNj2e82E1LK88IaG37hjjxhEeh0Fk D2GKVpd1oiWc8JSYO1GGH+bujWZv1CFwr9cVln1JrmQKPbYpB/2SjYO65iRrBUZJdULiH2PO3B1gf CigRzIGI4TmawYx1M0lz0L8BcpXhDd+QG2Df71m/OMBz18oNp2+3HCb+N7OcoS3IMbD9OK3KpIh9W e1PUnKLXjLq/6WLzoXUQbg==; Original-Received: from [87.69.77.57] (port=4015 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nHTeD-0004lW-7h for help-gnu-emacs@gnu.org; Tue, 08 Feb 2022 11:47:21 -0500 In-Reply-To: (message from Eduardo Ochs on Tue, 8 Feb 2022 12:17:52 -0300) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:135838 Archived-At: > From: Eduardo Ochs > Date: Tue, 8 Feb 2022 12:17:52 -0300 > > I am trying to write a keyboard macro that does some things, pauses > for one second, and then does more things, but I discovered that the > obvious ways to do sleep-and-redisplay don't work. Try to run the code > below with your favorite variant of C-e C-x C-e after each sexp: > > (defun eek (str) > "Execute STR as a keyboard macro. See `edmacro-mode' for the exact > format.\n > An example: (eek \"C-x 4 C-h\")" > (interactive "sKeys: ") > (execute-kbd-macro (read-kbd-macro str))) > > ;; Choose one: > (defun s () (interactive) (sleep-for 1)) > (defun s () (interactive) (redisplay) (sleep-for 1) (redisplay)) > (defun s () (interactive) (redisplay 'force) (sleep-for 1) (redisplay > 'force)) > > (eek "RET ab <> cd") > > I expected to see an "ab", then a pause, then the "cd", but that's not > what happens - I get a pause and then "abcd". > > What am I doing wrong? I just triple-checked the docs about redisplay > and this behavior makes no sense to me... 'redisplay' exits immediately if called from a keyboard macro. It's a feature.