emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] trunk r114704: Don't run timers in input-pending-p. Its ne


From: Barry O'Reilly
Subject: [Emacs-diffs] trunk r114704: Don't run timers in input-pending-p. Its new check-timers param
Date: Fri, 18 Oct 2013 04:30:27 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 114704
revision-id: address@hidden
parent: address@hidden
fixes bug: http://debbugs.gnu.org/15045
committer: Barry O'Reilly <address@hidden>
branch nick: trunk
timestamp: Fri 2013-10-18 00:27:34 -0400
message:
  Don't run timers in input-pending-p.  Its new check-timers param
  provides the prior behavior..
  * src/keyboard.c (Finput_pending_p): Accept optional check-timers
  param.
  * lisp/subr.el (sit-for): Call (input-pending-p t) so as to behave
  as before.
  * test/automated/timer-tests.el: New file.  Tests that (sit-for 0)
  allows another timer to run.
added:
  test/automated/timer-tests.el  timertests.el-20131018030924-fs4oywoym2ynuoh6-1
modified:
  etc/NEWS                       news-20100311060928-aoit31wvzf25yr1z-1
  lisp/ChangeLog                 changelog-20091113204419-o5vbwnq5f7feedwu-1432
  lisp/subr.el                   subr.el-20091113204419-o5vbwnq5f7feedwu-151
  src/ChangeLog                  changelog-20091113204419-o5vbwnq5f7feedwu-1438
  src/keyboard.c                 keyboard.c-20091113204419-o5vbwnq5f7feedwu-449
  test/ChangeLog                 changelog-20091113204419-o5vbwnq5f7feedwu-8588
=== modified file 'etc/NEWS'
--- a/etc/NEWS  2013-10-16 00:21:06 +0000
+++ b/etc/NEWS  2013-10-18 04:27:34 +0000
@@ -620,6 +620,9 @@
 
 * Incompatible Lisp Changes in Emacs 24.4
 
+** `(input-pending-p)' no longer runs other timers which are ready to
+run.  The new optional CHECK-TIMERS param allows for the prior behavior.
+
 ** `defvar' and `defcustom' in a let-binding affect the "external" default.
 
 ** The syntax of ?» and ?« is now punctuation instead of matched parens.

=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2013-10-18 02:26:28 +0000
+++ b/lisp/ChangeLog    2013-10-18 04:27:34 +0000
@@ -1,3 +1,8 @@
+2013-10-17  Barry O'Reilly  <address@hidden>
+
+       * lisp/subr.el (sit-for): Call (input-pending-p t) so as to behave
+       as before.
+
 2013-10-18  Reuben Thomas  <address@hidden>
 
        * textmodes/remember.el (remember): set buffer-offer-save in

=== modified file 'lisp/subr.el'
--- a/lisp/subr.el      2013-10-04 19:06:45 +0000
+++ b/lisp/subr.el      2013-10-18 04:27:34 +0000
@@ -2222,7 +2222,7 @@
    (noninteractive
     (sleep-for seconds)
     t)
-   ((input-pending-p)
+   ((input-pending-p t)
     nil)
    ((<= seconds 0)
     (or nodisp (redisplay)))

=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2013-10-17 06:42:21 +0000
+++ b/src/ChangeLog     2013-10-18 04:27:34 +0000
@@ -1,3 +1,10 @@
+2013-10-17  Barry O'Reilly  <address@hidden>
+
+       Don't run timers in input-pending-p.  Its new check-timers param
+       provides the prior behavior. (Bug#15045).
+       * src/keyboard.c (Finput_pending_p): Accept optional check-timers
+       param.
+
 2013-10-17  Paul Eggert  <address@hidden>
 
        Make some functions static in non-Microsoft builds.

=== modified file 'src/keyboard.c'
--- a/src/keyboard.c    2013-10-17 06:42:21 +0000
+++ b/src/keyboard.c    2013-10-18 04:27:34 +0000
@@ -9950,12 +9950,13 @@
   return (!NILP (Vunread_command_events));
 }
 
-
-DEFUN ("input-pending-p", Finput_pending_p, Sinput_pending_p, 0, 0, 0,
+DEFUN ("input-pending-p", Finput_pending_p, Sinput_pending_p, 0, 1, 0,
        doc: /* Return t if command input is currently available with no wait.
 Actually, the value is nil only if we can be sure that no input is available;
-if there is a doubt, the value is t.  */)
-  (void)
+if there is a doubt, the value is t.
+
+If CHECK-TIMERS is non-nil, timers that are ready to run will do so.  */)
+  (Lisp_Object check_timers)
 {
   if (!NILP (Vunread_command_events)
       || !NILP (Vunread_post_input_method_events)
@@ -9965,7 +9966,8 @@
   /* Process non-user-visible events (Bug#10195).  */
   process_special_events ();
 
-  return (get_input_pending (READABLE_EVENTS_DO_TIMERS_NOW
+  return (get_input_pending ((NILP (check_timers)
+                              ? 0 : READABLE_EVENTS_DO_TIMERS_NOW)
                             | READABLE_EVENTS_FILTER_EVENTS)
          ? Qt : Qnil);
 }

=== modified file 'test/ChangeLog'
--- a/test/ChangeLog    2013-10-15 06:36:43 +0000
+++ b/test/ChangeLog    2013-10-18 04:27:34 +0000
@@ -1,3 +1,8 @@
+2013-10-17  Barry O'Reilly  <address@hidden>
+
+       * test/automated/timer-tests.el: New file.  Tests that (sit-for 0)
+       allows another timer to run.
+
 2013-10-14  Dmitry Gutov  <address@hidden>
 
        * indent/ruby.rb: More examples for bug#15594, both failing and

=== added file 'test/automated/timer-tests.el'
--- a/test/automated/timer-tests.el     1970-01-01 00:00:00 +0000
+++ b/test/automated/timer-tests.el     2013-10-18 04:27:34 +0000
@@ -0,0 +1,38 @@
+;;; timer-tests.el --- tests for timers -*- lexical-binding:t -*-
+
+;; Copyright (C) 2013 Free Software Foundation, Inc.
+
+;; This file is part of GNU Emacs.
+
+;; This program is free software: you can redistribute it and/or
+;; modify it under the terms of the GNU General Public License as
+;; published by the Free Software Foundation, either version 3 of the
+;; License, or (at your option) any later version.
+;;
+;; This program is distributed in the hope that it will be useful, but
+;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+;; General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see `http://www.gnu.org/licenses/'.
+
+;;; Commentary:
+
+;;; Code:
+
+(ert-deftest timer-tests-sit-for ()
+  (let ((timer-ran nil)
+        ;; Want sit-for behavior when interactive
+        (noninteractive nil))
+    (run-at-time '(0 0 0 0)
+                 nil
+                 (lambda () (setq timer-ran t)))
+    ;; The test assumes run-at-time didn't take the liberty of firing
+    ;; the timer, so assert the test's assumption
+    (should (not timer-ran))
+    (sit-for 0 t)
+    (should timer-ran)))
+
+;;; timer-tests.el ends here
+


reply via email to

[Prev in Thread] Current Thread [Next in Thread]