From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Paul Eggert Newsgroups: gmane.emacs.bugs Subject: bug#12430: Glitches caused by addition of psec to timers Date: Wed, 12 Sep 2012 23:04:32 -0700 Organization: UCLA Computer Science Department Message-ID: <50517770.6080207@cs.ucla.edu> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1347516326 21993 80.91.229.3 (13 Sep 2012 06:05:26 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 13 Sep 2012 06:05:26 +0000 (UTC) To: 12430@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Sep 13 08:05:29 2012 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1TC2YI-000519-NB for geb-bug-gnu-emacs@m.gmane.org; Thu, 13 Sep 2012 08:05:26 +0200 Original-Received: from localhost ([::1]:56062 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TC2YE-0003nx-T8 for geb-bug-gnu-emacs@m.gmane.org; Thu, 13 Sep 2012 02:05:22 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:35131) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TC2Y8-0003nY-Gv for bug-gnu-emacs@gnu.org; Thu, 13 Sep 2012 02:05:20 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TC2Y4-0007f8-6F for bug-gnu-emacs@gnu.org; Thu, 13 Sep 2012 02:05:16 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:48848) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TC2Y4-0007ev-34 for bug-gnu-emacs@gnu.org; Thu, 13 Sep 2012 02:05:12 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1TC2Yr-0004WR-PZ for bug-gnu-emacs@gnu.org; Thu, 13 Sep 2012 02:06:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Paul Eggert Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 13 Sep 2012 06:06:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 12430 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.134751633917352 (code B ref -1); Thu, 13 Sep 2012 06:06:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 13 Sep 2012 06:05:39 +0000 Original-Received: from localhost ([127.0.0.1]:58394 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TC2YU-0004Vo-Bb for submit@debbugs.gnu.org; Thu, 13 Sep 2012 02:05:39 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:38026) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TC2YQ-0004Vg-48 for submit@debbugs.gnu.org; Thu, 13 Sep 2012 02:05:36 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TC2Xa-0007E1-Ll for submit@debbugs.gnu.org; Thu, 13 Sep 2012 02:04:43 -0400 Original-Received: from lists.gnu.org ([208.118.235.17]:37360) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TC2Xa-0007Dx-Im for submit@debbugs.gnu.org; Thu, 13 Sep 2012 02:04:42 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:33544) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TC2XT-0003fC-2G for bug-gnu-emacs@gnu.org; Thu, 13 Sep 2012 02:04:42 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TC2XR-0007CG-G2 for bug-gnu-emacs@gnu.org; Thu, 13 Sep 2012 02:04:34 -0400 Original-Received: from smtp.cs.ucla.edu ([131.179.128.62]:38235) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TC2XR-0007CB-84 for bug-gnu-emacs@gnu.org; Thu, 13 Sep 2012 02:04:33 -0400 Original-Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp.cs.ucla.edu (Postfix) with ESMTP id 8281039E800D for ; Wed, 12 Sep 2012 23:04:32 -0700 (PDT) X-Virus-Scanned: amavisd-new at smtp.cs.ucla.edu Original-Received: from smtp.cs.ucla.edu ([127.0.0.1]) by localhost (smtp.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 5tbLs1sQ6zJv for ; Wed, 12 Sep 2012 23:04:31 -0700 (PDT) Original-Received: from [192.168.1.3] (pool-108-23-119-2.lsanca.fios.verizon.net [108.23.119.2]) by smtp.cs.ucla.edu (Postfix) with ESMTPSA id 2B73D39E8007 for ; Wed, 12 Sep 2012 23:04:31 -0700 (PDT) User-Agent: Mozilla/5.0 (X11; Linux i686; rv:15.0) Gecko/20120827 Thunderbird/15.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:64223 Archived-At: 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 + + * NEWS: Document timer format change. + 2012-09-11 Paul Eggert 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 + + 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 * 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 + + 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 * 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