2

In the good old days, repeated emacs keyboard macros ran without repainting the display until the end. Over the years this changed, and now it appears that the display is redrawn 100% of the time -- which is a bit tedious when I try to run a macro a few million times on a large buffer.

Is there a way to inhibit redraw until all of the repeats are done?

EDIT: Turns out that it can't figure out a reproducer, even though I've seen it a bunch of times. When I do I'll report it as a bug.

Greg Lindahl
  • 121
  • 4

1 Answers1

1

As Stefan says, this sounds like a bug. (I certainly can't replicate it.)

In the meantime you could use this as a very manual workaround:

(defun my-toggle-redisplay (arg)
  "Toggle redisplay.

Force redisplay ON with a positive numeric prefix arg.
Force redisplay OFF with a zero or negative numeric prefix arg."
  (interactive "P")
  (setq inhibit-redisplay
        (if arg
            (<= (prefix-numeric-value arg) 0)
          (not inhibit-redisplay))))

(global-set-key (kbd "<f6>") 'my-toggle-redisplay)

If all the keyboard macro repetitions finish error-free, you could:

  • toggle redisplay off
  • start the macros running
  • press the key to toggle redisplay back on
  • ...wait for all of that to finish

If an error is signalled to abort the macro repetitions (as is extremely common), you'd need to guess when the macros had finished and manually toggle redisplay back on at that point.

(You could always write some error handling to attempt to manage that, but I'm not sure that would be straightforward.)

phils
  • 48,657
  • 3
  • 76
  • 115