3

Sometimes a function will make the display blink and stutter, due do things happening in the background while the function is running (visiting other buffers etc). Does anyone know if there's a function, or another way, to tell Emacs not to redisplay during the course of an sexp? I'm searching for something like this:

(defun my-automatic-todo ()
  (interactive)
  (no-redisplay
   (let ((org-capture-entry
          `("z" "Automatic todo" entry (file ,my-todo-file)
            ,(format "* TODO %s" (my-get-todo-text-function))
            :immediate-finish t)))
     (org-capture))))

In the example above, no-redisplay would run the body without updating the display (and probably update the display when exiting the body). The no-redisplay function doesn't exist though.

Drew
  • 77,472
  • 10
  • 114
  • 243
Erik Sjöstrand
  • 826
  • 4
  • 15

1 Answers1

4

You can let-bind the variable inhibit-redisplay for this purpose, so:

(defun my-automatic-todo ()
  (interactive)
  (let ((inhibit-redisplay t))
    (let ((org-capture-entry
           `("z" "Automatic todo" entry (file ,my-todo-file)
             ,(format "* TODO %s" (my-get-todo-text-function))
             :immediate-finish t)))
      (org-capture))))
dieggsy
  • 475
  • 2
  • 10
  • Thank you for this. Unfortunately it did not solve my problem, but I think that may be because of my use of EXWM and how it handles the display in X buffers. – Erik Sjöstrand Oct 02 '17 at 11:32