From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eduardo Ochs Newsgroups: gmane.emacs.help Subject: Re: Redisplay inside keyboard macros Date: Tue, 8 Feb 2022 14:31:27 -0300 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="11145"; mail-complaints-to="usenet@ciao.gmane.io" To: help-gnu-emacs Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Tue Feb 08 20:53:51 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 1nHWYh-0002aN-Jp for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 08 Feb 2022 20:53:51 +0100 Original-Received: from localhost ([::1]:58650 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nHWYg-0007iR-GU for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 08 Feb 2022 14:53:50 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:53932) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nHULA-0007ko-Tb for help-gnu-emacs@gnu.org; Tue, 08 Feb 2022 12:31:45 -0500 Original-Received: from [2607:f8b0:4864:20::1036] (port=54238 helo=mail-pj1-x1036.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nHUL7-0005J3-Cb for help-gnu-emacs@gnu.org; Tue, 08 Feb 2022 12:31:43 -0500 Original-Received: by mail-pj1-x1036.google.com with SMTP id qe15so7517735pjb.3 for ; Tue, 08 Feb 2022 09:31:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=trURLkafUuFtxLpq5V9SzRm8ugpqPX5hfkXfQjML/dA=; b=Jyv3GLFUY10Alj0fwFpBUE3udFieAeflzOsP+LcWNy5pUJU9VvrsAgwqtk3DAkEyM3 xrvTb3zPtT6Za/nVJKvEgpiV2uYK+G0wbI2cUvJt+2VmRQE+A2Pd3Yf6xqfD5Gzrta6k 8+gG4zaC4abfvm4VAxtkYhtMJ8yj+RVR2UX9fLqQaFrmatrBr8UkAVEox9dDzmPa+RlH dX87Oswt0rPBBFlGjF+XbOtv/VD8nLsI+hFjROyRksQgqzLSTfQfVP09sHTNEukLU+Ux JTqYPrXrMJNML8DHE3ou2L66Bwu7i9+9E6IwphYxxh+97K98k3FSsZMLGNg0HxYILJNv qELw== 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; bh=trURLkafUuFtxLpq5V9SzRm8ugpqPX5hfkXfQjML/dA=; b=V4QZq23UogzbQ2rBqsA9fnWcj5BPTKPoWXmW/F5qpE35z7V7BKCbBiAr1GbPsiTG59 fup6tJGC+zaShp8/f/ZBAWcK7Apecrf3VGrRRmhybl6bQgStu8THHFMvD98ehy0tL2Lw u7BzntsYOC/ZIqWduX3pM+/8RGN22dNS9zvHudIMkh/n9ee3FU94QJzq/BrFfw6QiWI5 ReUc4DAOPcfPweuaQYN9MPqVee8T6yToiHNBls8z1KNWM1il0aSqs+fxrEJ+zOI8pfy/ YpMON2uAC21ZG3PWyHedeegjAE4VNzIBo0w6HJha38CC54muP/seItZONJ3zASXLO5xF DYuA== X-Gm-Message-State: AOAM533Qlj00VffMHeqvpU2/AJpteg5BFjINiv5PPNNtfTXg7GbWdzjj gEq+X6F2uyfbCp7k3pffsb9N19Vc5/omWNqXKMC45u0maVw= X-Google-Smtp-Source: ABdhPJyXWnmEW3zJoSVPxsFp5CJJ3uK/AAr/c9DVNS5zPzcgdlnqlJbyxfgyadPeA4v1A7c+kJGEDmSIUT/X/ncd0Ho= X-Received: by 2002:a17:90a:9a7:: with SMTP id 36mr2519116pjo.154.1644341499224; Tue, 08 Feb 2022 09:31:39 -0800 (PST) In-Reply-To: X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::1036 (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::1036; envelope-from=eduardoochs@gmail.com; helo=mail-pj1-x1036.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, 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:135845 Archived-At: On Tue, 8 Feb 2022 at 12:17, Eduardo Ochs wrote: > > Hi list, > > 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... > > Thanks in advance!!! > Eduardo Ochs > http://angg.twu.net/#eev Hi Eli, > 'redisplay' exits immediately if called from a keyboard macro. It's a > feature. Aha! Thanks! This works: (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))) (defun rd () (interactive) (redisplay 'force)) (defun s () (interactive) (rd) (sleep-for 1) (rd)) (defun eeks (str &rest rest) (eek str) (if rest (progn (s) (apply 'eeks rest)))) (eeks "RET ab" "cd" "ef") Cheers =), Eduardo Ochs http://angg.twu.net/#eev