unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Eduardo Ochs <eduardoochs@gmail.com>
To: help-gnu-emacs <help-gnu-emacs@gnu.org>
Subject: Redisplay inside keyboard macros
Date: Tue, 8 Feb 2022 12:17:52 -0300	[thread overview]
Message-ID: <CADs++6h-LPgARdeo=QkgJVE=M4hR8LLfuvxpoMFm6MUavVPnWQ@mail.gmail.com> (raw)

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 <<s>> 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


             reply	other threads:[~2022-02-08 15:17 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-08 15:17 Eduardo Ochs [this message]
2022-02-08 16:47 ` Redisplay inside keyboard macros Eli Zaretskii
2022-02-08 19:42   ` Bruno Barbier
2022-02-08 21:00     ` Eduardo Ochs
2022-02-09 18:28       ` Bruno Barbier
2022-02-08 17:31 ` Eduardo Ochs

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CADs++6h-LPgARdeo=QkgJVE=M4hR8LLfuvxpoMFm6MUavVPnWQ@mail.gmail.com' \
    --to=eduardoochs@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).