about summary refs log tree commit diff
path: root/exwm-core.el
diff options
context:
space:
mode:
Diffstat (limited to 'exwm-core.el')
-rw-r--r--exwm-core.el8
1 files changed, 5 insertions, 3 deletions
diff --git a/exwm-core.el b/exwm-core.el
index 146594da0a16..2c810dfc647d 100644
--- a/exwm-core.el
+++ b/exwm-core.el
@@ -76,10 +76,12 @@
   (xcb:flush exwm--connection))
 
 (defmacro exwm--defer (secs function &rest args)
-  "Defer the action until SECS seconds later.
+  "Defer the execution of FUNCTION.
 
-The action is to call FUNCTION with arguments ARGS."
-  `(run-with-idle-timer (time-add (or (current-idle-time) 0) ,secs)
+The action is to call FUNCTION with arguments ARGS.  If Emacs is not idle,
+defer the action until Emacs is idle.  Otherwise, defer the action until at
+least SECS seconds later."
+  `(run-with-idle-timer (time-add (or (current-idle-time) (- ,secs)) ,secs)
                         nil
                         ,function
                         ,@args))