From: Paul Eggert <eggert@cs.ucla.edu>
To: 12430@debbugs.gnu.org
Subject: bug#12430: Glitches caused by addition of psec to timers
Date: Wed, 12 Sep 2012 23:04:32 -0700 [thread overview]
Message-ID: <50517770.6080207@cs.ucla.edu> (raw)
Tags: patch
A private correspondent pointed out that the higher-resolution time
stamps patch (see Bug#9000) changed the format of timers but some
Lisp code that accesses timer-list wasn't updated. The patch
below fixes the instances I found. This
patch should be applied anyway, for clarity, but this raises
a compatibility point. The old timer format (through 24.2) was:
[high-seconds low-seconds usecs repeat-delay function args idle-delay]
The new (24.3) format, introduced to the trunk on 2012-06-22, adds a
PSECS component after USECS, like this:
[high-seconds low-seconds usecs psecs repeat-delay function args idle-delay]
which means that old code like (aref timer 5) to get the function, no
longer has the intended meaning. Code is supposed to use
(timer--function timer) instead of (aref timer 5), but not everyone
got the memo apparently. Clearly this stuff should be documented in
NEWS so the patch below does that too.
My correspondent suggests that the new format be changed to put PSECS
at the end:
[high-seconds low-seconds usecs repeat-delay function args idle-delay psecs]
to support older code that uses aref or elt. Does this sound like a
good idea? It would cater to backward compatiblity better, but would
make the new code a bit weirder.
Here's the patch to fix the bugs mentioned above, which I plan to
install shortly:
=== modified file 'etc/ChangeLog'
--- etc/ChangeLog 2012-09-11 02:28:27 +0000
+++ etc/ChangeLog 2012-09-13 05:56:38 +0000
@@ -1,3 +1,7 @@
+2012-09-13 Paul Eggert <eggert@cs.ucla.edu>
+
+ * NEWS: Document timer format change.
+
2012-09-11 Paul Eggert <eggert@cs.ucla.edu>
Simplify, document, and port floating-point (Bug#12381).
=== modified file 'etc/NEWS'
--- etc/NEWS 2012-09-12 19:16:36 +0000
+++ etc/NEWS 2012-09-13 05:56:38 +0000
@@ -101,6 +101,11 @@
file-attributes and format-time-string, have been changed accordingly.
Old-format time stamps are still accepted.
+** The format of timers in timer-list and timer-idle-list is now
+[HIGH-SECONDS LOW-SECONDS USECS PSECS REPEAT-DELAY FUNCTION ARGS IDLE-DELAY].
+The PSECS slot is new, and uses picosecond resolution. It can be
+accessed via the new timer--psecs accessor.
+
** Emacs now generates backtraces on fatal errors.
On encountering a fatal error, Emacs now outputs a textual description
of the fatal signal, and a short backtrace on platforms like glibc
=== modified file 'lisp/ChangeLog'
--- lisp/ChangeLog 2012-09-13 02:41:46 +0000
+++ lisp/ChangeLog 2012-09-13 05:00:33 +0000
@@ -1,3 +1,11 @@
+2012-09-13 Paul Eggert <eggert@cs.ucla.edu>
+
+ Fix glitches caused by addition of psec to timers.
+ * image.el (image-animate-timer):
+ * time.el (display-time-world-timer):
+ Use timer--function and timer--args rather than raw access to
+ timer vector.
+
2012-09-13 Glenn Morris <rgm@gnu.org>
* emacs-lisp/bytecomp.el (byte-compile-warning-prefix):
=== modified file 'lisp/gnus/ChangeLog'
--- lisp/gnus/ChangeLog 2012-09-11 10:08:59 +0000
+++ lisp/gnus/ChangeLog 2012-09-13 05:00:33 +0000
@@ -1,3 +1,9 @@
+2012-09-13 Paul Eggert <eggert@cs.ucla.edu>
+
+ Fix glitches caused by addition of psec to timers.
+ * gnus-art.el (gnus-article-stop-animations): Use timer--function
+ rather than raw access to timer vector.
+
2012-09-11 Julien Danjou <julien@danjou.info>
* gnus-notifications.el (gnus-notifications): Check for nil values in
=== modified file 'lisp/gnus/gnus-art.el'
--- lisp/gnus/gnus-art.el 2012-08-14 05:34:20 +0000
+++ lisp/gnus/gnus-art.el 2012-09-13 05:00:33 +0000
@@ -4554,7 +4554,7 @@
(defun gnus-article-stop-animations ()
(dolist (timer (and (boundp 'timer-list)
timer-list))
- (when (eq (elt timer 5) 'image-animate-timeout)
+ (when (eq (timer--function timer) 'image-animate-timeout)
(cancel-timer timer))))
(defun gnus-stop-downloads ()
=== modified file 'lisp/image.el'
--- lisp/image.el 2012-08-15 16:29:11 +0000
+++ lisp/image.el 2012-09-13 05:00:33 +0000
@@ -645,8 +645,8 @@
(while tail
(setq timer (car tail)
tail (cdr tail))
- (if (and (eq (aref timer 5) 'image-animate-timeout)
- (eq (car-safe (aref timer 6)) image))
+ (if (and (eq (timer--function timer) 'image-animate-timeout)
+ (eq (car-safe (timer--args timer)) image))
(setq tail nil)
(setq timer nil)))
timer))
=== modified file 'lisp/time.el'
--- lisp/time.el 2012-05-04 06:13:18 +0000
+++ lisp/time.el 2012-09-13 05:00:33 +0000
@@ -575,7 +575,8 @@
(let ((list timer-list))
(while list
(let ((elt (pop list)))
- (when (equal (symbol-name (aref elt 5)) "display-time-world-timer")
+ (when (equal (symbol-name (timer--function elt))
+ "display-time-world-timer")
(cancel-timer elt)))))))
;;;###autoload
next reply other threads:[~2012-09-13 6:04 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-13 6:04 Paul Eggert [this message]
2012-09-13 12:49 ` bug#12430: Glitches caused by addition of psec to timers Stefan Monnier
2012-09-13 16:26 ` Paul Eggert
2012-09-13 16:57 ` Eli Zaretskii
2012-09-13 18:48 ` Paul Eggert
2012-09-13 19:19 ` Eli Zaretskii
2012-09-13 19:37 ` Paul Eggert
2012-09-13 20:11 ` Glenn Morris
2012-09-14 6:32 ` Eli Zaretskii
2012-09-13 21:35 ` Stefan Monnier
2012-09-14 6:32 ` Eli Zaretskii
2012-09-14 13:18 ` Stefan Monnier
2012-09-14 13:44 ` Eli Zaretskii
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=50517770.6080207@cs.ucla.edu \
--to=eggert@cs.ucla.edu \
--cc=12430@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.