]> git.eshelyaron.com Git - emacs.git/commitdiff
(vhdl-run-when-idle): Don't use `timer--triggered`
authorStefan Monnier <monnier@iro.umontreal.ca>
Wed, 31 Jul 2024 08:52:08 +0000 (04:52 -0400)
committerEshel Yaron <me@eshelyaron.com>
Wed, 31 Jul 2024 14:33:35 +0000 (16:33 +0200)
* lisp/progmodes/vhdl-mode.el (vhdl-run-when-idle): Avoid relying
needlessly on internal accessor and fix last change to make sure
we always create a timer.

(cherry picked from commit 44c9c2c8456117625ec8a54d4a6908404e483f83)

lisp/progmodes/vhdl-mode.el

index 2c4b83bed239e0eb912dff35b78e7cf32eeb6f75..bf309500a38ea661f68bff58a291068ef705f55d 100644 (file)
@@ -2338,11 +2338,13 @@ Ignore byte-compiler warnings you might see."
 
 (defun vhdl-run-when-idle (secs repeat function)
   "Wait until idle, then run FUNCTION."
-  (if (fboundp 'start-itimer)
+  (if (fboundp 'start-itimer) ;;XEmacs
       (start-itimer "vhdl-mode" function secs repeat t)
     ;; explicitly activate timer (necessary when Emacs is already idle)
-    (when (featurep 'xemacs)
-      (aset (run-with-idle-timer secs repeat function) 0 nil))))
+    (let ((timer (run-with-idle-timer secs repeat function)))
+      ;; `run-with-idle-timer' already sets the `triggered' flag to nil,
+      ;; at least since Emacs-24.
+      (if (< emacs-major-version 24) (aset timer 0 nil)))))
 
 (defun vhdl-warning-when-idle (&rest args)
   "Wait until idle, then print out warning STRING and beep."