From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Bruno Barbier Newsgroups: gmane.emacs.help Subject: Re: Redisplay inside keyboard macros Date: Wed, 09 Feb 2022 19:28:49 +0100 Message-ID: <620407a3.1c69fb81.7d4cb.38fb@mx.google.com> References: <83czjxwbjm.fsf@gnu.org> <6202c76b.1c69fb81.56b06.2c5d@mx.google.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="2522"; mail-complaints-to="usenet@ciao.gmane.io" Cc: help-gnu-emacs To: Eduardo Ochs Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Wed Feb 09 19:51:48 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 1nHs4B-0000W1-R1 for geh-help-gnu-emacs@m.gmane-mx.org; Wed, 09 Feb 2022 19:51:47 +0100 Original-Received: from localhost ([::1]:59490 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nHs4A-0005qm-7z for geh-help-gnu-emacs@m.gmane-mx.org; Wed, 09 Feb 2022 13:51:46 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:59552) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nHrh3-0008In-2o for help-gnu-emacs@gnu.org; Wed, 09 Feb 2022 13:27:53 -0500 Original-Received: from [2a00:1450:4864:20::32f] (port=51961 helo=mail-wm1-x32f.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nHrh0-0001Hi-3H; Wed, 09 Feb 2022 13:27:51 -0500 Original-Received: by mail-wm1-x32f.google.com with SMTP id r131so2036300wma.1; Wed, 09 Feb 2022 10:27:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:from:to:cc:subject:in-reply-to:references:date :mime-version; bh=OfiQhG2oDZ6P0vKOKz6wVEIWjdU5cGY1idIwajVZXZQ=; b=eCzJn0wWMM5PzxAW0w02LYXlqqLV66qqVpZbrPMm5FJoJlKc0cLgGfJRkL2BMSung6 EOy1RuZyJ8XqjQJwekmRaruOhUFwlZMjxCIzpb3Pp4Z5aiIz7EaxFT9YZi+SS1t1s/bc T2lI5nLdWohzoAzlvgzt5YWGTgXbWW/AyiHJcKfGg4qrpHN2AGJB06x5QGg3uwCnJePk rZ1qh9KKDbsMWfIC1Hq1hDEFih6FEjcuHhw+DDXNjj5QT5BcZRnlkVMzMWTC0ULO1YK8 n6cNZ1YIhA6wWJRDOvKO/WPBO4Y5FFssBHL1grUSMutzUMRbzS9GkOLhETVfqIY/Y1Ea 55Gg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:from:to:cc:subject:in-reply-to :references:date:mime-version; bh=OfiQhG2oDZ6P0vKOKz6wVEIWjdU5cGY1idIwajVZXZQ=; b=GYwtvL8ruqqGHHsV//hwsKU2E/F7IXTHgmQnw9k+xREAsVVxhmJW1VNKH96uVej33s dj3zYVqV6YhmC7j2ulqJQIgNq59dkN9wrO+ZdscBV/QTlX3WeZGAnRkdHCBEFd2T6AI+ 6EuITIkRggZJcbYsA726y/kHD/8ttwe395rE0dNkizSN50dwlc4AgI7aVERE4vPUnXTa 6Q7MaoHQ+WxAlyuxW501PR50HSlrj4rJZqEutl3rMUS56iga0ooJjSrynn19hvEPRxNu jzWsncTU01vJjyYXWVz1EJj6ICSSCPwzxg0sGy/QMp2l6xsAwYTg8E3im+ytRHinTlqN 23Gg== X-Gm-Message-State: AOAM531xvqmaPSWxoqJg6Wl05+Y9LN6n8dXcQG6YYFJlgARHCm5fyTGl in8x4NSfDXma1EgZiewZL74= X-Google-Smtp-Source: ABdhPJz+bWgxUK7BftQkVatOEPNgns9Pykl+SAl55tqCZ5XcDL5q8GdLGw0+6XRz6ifoxrMprs7iWg== X-Received: by 2002:a05:600c:1e0e:: with SMTP id ay14mr3690622wmb.118.1644431267571; Wed, 09 Feb 2022 10:27:47 -0800 (PST) Original-Received: from tosh-laptop ([2a01:e0a:505:3460:1a16:a0c4:3f89:c0d9]) by smtp.gmail.com with ESMTPSA id x11sm5226243wmi.37.2022.02.09.10.27.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Feb 2022 10:27:47 -0800 (PST) Original-Received: by tosh-laptop (sSMTP sendmail emulation); Wed, 09 Feb 2022 19:28:49 +0100 In-Reply-To: X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::32f (failed) Received-SPF: pass client-ip=2a00:1450:4864:20::32f; envelope-from=brubar.cs@gmail.com; helo=mail-wm1-x32f.google.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 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, FREEMAIL_FROM=0.001, MSGID_FROM_MTA_HEADER=0.001, PDS_HP_HELO_NORDNS=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action 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:135871 Archived-At: Hi Eduardo, Eduardo Ochs writes: > On Tue, 8 Feb 2022 at 17:39, Bruno Barbier wrote: >> Eduardo, your 'eek' function just works fine in my emacs, using >> just the (sleep-for 1) definition. I can cleanup and share my hack if >> you're interested. >> >> Bruno. > > Hi Bruno! > I'm interested! Please share! =) Here is my hack to force a redisplay between each command, when executing a keyboard macro; this ensures that running the macro does the same thing as when recording it, and the same thing as when running it step by step. Not that I'm adding my hack to 'post-command-hook', so, be careful, and only try it in a *new* instance of emacs, just to be safe. #+begin_src elisp (defun bba-kmacros-force-redisplay () "Hack to force redisplay when running keyboard macros." (when executing-kbd-macro (let (;; Hide any pending events. (unread-command-events nil) ;; Pretend that we are not currently executing a keyboard ;; macro ... (executing-kbd-macro nil) (defining-kbd-macro nil) ) ;; Make emacs believe that we're asking something to the user: that ;; triggers a redisplay. (let ((mb-oops (read-event "kmacro replay (hack): don't touch anything ..." nil .0)) ) (when mb-oops ;; Really ? Got an event before 0 second ? ... sweeping it ;; under the carpet, hoping that nobody notices ... (message "ERROR: bba-kmacros-force-redisplay: loosing one event %S..." mb-oops)) ) ))) ;; Tell emacs to run `bba-kmacros-force-redisplay' after each command. (add-hook 'post-command-hook 'bba-kmacros-force-redisplay :better-at-the-end) #+end_src I just tested your example with GNU Emacs 27.2, and no personal config (-Q) and it seems to do what you want. Bruno. > [[]], Eduardo