unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Re: master e56e4b345a2: Use timer accessors instead of aref/aset
       [not found] ` <20240725124103.A15EBC35350@vcs2.savannah.gnu.org>
@ 2024-07-30 18:43   ` Stefan Monnier
  2024-07-30 21:01     ` Mattias Engdegård
  0 siblings, 1 reply; 2+ messages in thread
From: Stefan Monnier @ 2024-07-30 18:43 UTC (permalink / raw)
  To: emacs-devel; +Cc: Mattias Engdegård

> commit e56e4b345a25194bc7adb83523e8d886b718c9fa
> Author: Mattias Engdegård <mattiase@acm.org>
> Commit: Mattias Engdegård <mattiase@acm.org>
>
>     Use timer accessors instead of aref/aset
>     
>     * lisp/emacs-lisp/timer-list.el (list-timers):
>     * lisp/gnus/mail-source.el (mail-source-start-idle-timer):
>     * lisp/play/gamegrid.el (gamegrid-set-timer):
>     * lisp/progmodes/vhdl-mode.el (vhdl-run-when-idle):
>     * lisp/simple.el (analyze-text-conversion):
>     * lisp/time.el (display-time-event-handler):
>     Use timer accessors.
> diff --git a/lisp/progmodes/vhdl-mode.el b/lisp/progmodes/vhdl-mode.el
> index 144bfa944d3..22706be6bb5 100644
> --- a/lisp/progmodes/vhdl-mode.el
> +++ b/lisp/progmodes/vhdl-mode.el
> @@ -2341,7 +2341,7 @@ Ignore byte-compiler warnings you might see."
>    (if (fboundp 'start-itimer)
>        (start-itimer "vhdl-mode" function secs repeat t)
>      ;; explicitly activate timer (necessary when Emacs is already idle)
> -    (aset (run-with-idle-timer secs repeat function) 0 nil)))
> +    (setf (timer--triggered (run-with-idle-timer secs repeat function)) nil)))

`vhdl-mode.el` likes to be compatible with XEmacs, so this change might
be problematic.  I'm not sure if it's still important, but I'll also
note that, according to my reading of the `timer.el` code, the timer
objects returned by `run-with-idle-timer` already have their `triggered`
field set to nil.

I'm not sure if it's always been the case, but maybe we could make the
`aset` conditional on `(< emacs-major-version 30)` (or some older version
number once we investigate since when this is the case)?


        Stefan




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: master e56e4b345a2: Use timer accessors instead of aref/aset
  2024-07-30 18:43   ` master e56e4b345a2: Use timer accessors instead of aref/aset Stefan Monnier
@ 2024-07-30 21:01     ` Mattias Engdegård
  0 siblings, 0 replies; 2+ messages in thread
From: Mattias Engdegård @ 2024-07-30 21:01 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Emacs Devel

30 juli 2024 kl. 20.43 skrev Stefan Monnier <monnier@iro.umontreal.ca>:

> `vhdl-mode.el` likes to be compatible with XEmacs, so this change might
> be problematic.  I'm not sure if it's still important, but I'll also
> note that, according to my reading of the `timer.el` code, the timer
> objects returned by `run-with-idle-timer` already have their `triggered`
> field set to nil.
> 
> I'm not sure if it's always been the case, but maybe we could make the
> `aset` conditional on `(< emacs-major-version 30)` (or some older version
> number once we investigate since when this is the case)?

Thank you, yes, I agree but kept the original code for XEmacs only. (Even that is a stretch, given that XEmacs users are not very likely to use our version.)

Do modify the code if you find it reckless.




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-07-30 21:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <172191126257.28696.12556479493109361955@vcs2.savannah.gnu.org>
     [not found] ` <20240725124103.A15EBC35350@vcs2.savannah.gnu.org>
2024-07-30 18:43   ` master e56e4b345a2: Use timer accessors instead of aref/aset Stefan Monnier
2024-07-30 21:01     ` Mattias Engdegård

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).