eschulte / epresent

Presentations in Emacs -- based on Org-mode
183 stars 51 forks source link

Avoid redrawing everything on every page change #63

Open kqr opened 5 years ago

kqr commented 5 years ago

By running (redraw-display), we cause a noticeable flicker in /all/ open Emacs frames, which, while not catastrophic, is a bit of a rough edge.

If we instead redraw only the currently selected frame, we still cause a brief flash in the presenting frame, but not in any other frames.

My current workaround for this is to add advice around redraw-display and simply run redraw-frame instead if the major mode is epresent-mode, like-a-so:

(define-advice redraw-display
      (:around (actual-redraw &rest args) epresent-only-redisplay-frame)
    (if (eq major-mode 'epresent-mode)
        (apply 'redraw-frame (cons nil args))
      (apply actual-redraw args)))
kqr commented 5 years ago

It is worth noting that I have tried briefly running this completely without the redraw, and I haven't noticed any negative behaviour – only a more smooth presentation experience. That said, I haven't done any thorough testing either, so I won't have too strong opinions on it. Not to mention that my Emacs display-fu is very, very weak.

If we want to experiment, we could set up a defcustom variable for toggling whether or not to redraw.