From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Barry OReilly Newsgroups: gmane.emacs.bugs Subject: bug#15045: Point jumps inappropriately around time of Semantic lexing Date: Thu, 17 Oct 2013 11:03:11 -0400 Message-ID: References: <87pptptk9n.fsf@engster.org> <87eha4t7xz.fsf@engster.org> <8738qksz6l.fsf@engster.org> <837gfvua2r.fsf@gnu.org> <87y58bs9x4.fsf@engster.org> <83zjsrs3k2.fsf@gnu.org> <87pptmsv4z.fsf@engster.org> <83siyira0w.fsf@gnu.org> <87vc3drhuv.fsf@engster.org> <83haexrgjn.fsf@gnu.org> <83ppr7pr6c.fsf@gnu.org> <83li1upkfx.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a11c33560ca1aa404e8f11d55 X-Trace: ger.gmane.org 1382022258 14153 80.91.229.3 (17 Oct 2013 15:04:18 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 17 Oct 2013 15:04:18 +0000 (UTC) Cc: 15045@debbugs.gnu.org, David Engster , Eric Ludlam To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Oct 17 17:04:22 2013 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 1VWp7e-0008Rh-2b for geb-bug-gnu-emacs@m.gmane.org; Thu, 17 Oct 2013 17:04:22 +0200 Original-Received: from localhost ([::1]:52668 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VWp7d-0002FD-FS for geb-bug-gnu-emacs@m.gmane.org; Thu, 17 Oct 2013 11:04:21 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:56983) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VWp7U-0002EV-Ap for bug-gnu-emacs@gnu.org; Thu, 17 Oct 2013 11:04:17 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VWp7K-0001AI-JP for bug-gnu-emacs@gnu.org; Thu, 17 Oct 2013 11:04:12 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:41626) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VWp7K-0001A9-FW for bug-gnu-emacs@gnu.org; Thu, 17 Oct 2013 11:04:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1VWp7J-00088u-Nv for bug-gnu-emacs@gnu.org; Thu, 17 Oct 2013 11:04:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Barry OReilly Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 17 Oct 2013 15:04:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 15045 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 15045-submit@debbugs.gnu.org id=B15045.138202220231246 (code B ref 15045); Thu, 17 Oct 2013 15:04:01 +0000 Original-Received: (at 15045) by debbugs.gnu.org; 17 Oct 2013 15:03:22 +0000 Original-Received: from localhost ([127.0.0.1]:55644 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VWp6f-00087s-I2 for submit@debbugs.gnu.org; Thu, 17 Oct 2013 11:03:22 -0400 Original-Received: from mail-ob0-f180.google.com ([209.85.214.180]:47620) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VWp6c-00087b-05 for 15045@debbugs.gnu.org; Thu, 17 Oct 2013 11:03:19 -0400 Original-Received: by mail-ob0-f180.google.com with SMTP id wo20so1605455obc.25 for <15045@debbugs.gnu.org>; Thu, 17 Oct 2013 08:03:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=8Kl12+HvA1QMq+8hYnuXAzW7mXWvv7ZX735pGiVd854=; b=cCO0QEau48iXmY3XMLelL0NlQ3lTgw+U9zvpE0+DICTAfKHHxA+6R9gNmLdmwCLfSM TXWtO2ptwjomUw01UTf8jJwaZVarOBS5Msbk+UUi5Z+HgLHJe0TnaRWiGrFsq51SsVlx Pf0Q4wx1aq3cC8PwBU4Or3CgtwYm62/JJV/2kEMoMqeg3ykyvkWzuvU5lCfOfKEdPEEb SodGCXPAlQtLz9vWLsm0D62izFzDGI5Q+hMMdL7iMxeW8o+zWTTuRCvHNP7YrEnbJloH SuTg2a8F5YMCWMmrmGfn0af5NQwcyPni4Lrjjyb+gr/zRiBsw4ksQO7Z+ZBoEWnSSfhm FRTA== X-Received: by 10.182.96.100 with SMTP id dr4mr14575884obb.22.1382022191387; Thu, 17 Oct 2013 08:03:11 -0700 (PDT) Original-Received: by 10.76.156.103 with HTTP; Thu, 17 Oct 2013 08:03:11 -0700 (PDT) In-Reply-To: X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x 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:79337 Archived-At: --001a11c33560ca1aa404e8f11d55 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Here's the solution you requested. Let me know that it's good to install. diff --git a/ChangeLog b/ChangeLog index a755b5c..8b58ebc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2013-10-17 Barry O'Reilly + + Change how input-pending-p checks for timers to run. Its default + changes from checking to not checking. Its new check-timers param + allows for prior behavior. (Bug#15045). + * 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. + 2013-10-13 Glenn Morris * configure.ac [alpha]: Explicit error in non-ELF case. (Bug#15601= ) diff --git a/etc/NEWS b/etc/NEWS index ddb9a9f..06372f9 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -611,6 +611,9 @@ low-level libraries gfilenotify.c, inotify.c or w32notify.c. ^L * 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 ?=BB and ?=AB is now punctuation instead of matched paren= s. diff --git a/lisp/subr.el b/lisp/subr.el index 0d03e9a..952b9b6 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -2222,7 +2222,7 @@ floating point support." (noninteractive (sleep-for seconds) t) - ((input-pending-p) + ((input-pending-p t) nil) ((<=3D seconds 0) (or nodisp (redisplay))) diff --git a/src/keyboard.c b/src/keyboard.c index e0cd4d4..7f8692a 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -9947,12 +9947,13 @@ requeued_events_pending_p (void) 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) @@ -9962,8 +9963,9 @@ if there is a doubt, the value is t. */) /* Process non-user-visible events (Bug#10195). */ process_special_events (); - return (get_input_pending (READABLE_EVENTS_DO_TIMERS_NOW - | READABLE_EVENTS_FILTER_EVENTS) + return (get_input_pending ((EQ (check_timers, Qnil) + ? 0 : READABLE_EVENTS_DO_TIMERS_NOW) + | READABLE_EVENTS_FILTER_EVENTS) ? Qt : Qnil); } diff --git a/test/automated/timer-tests.el b/test/automated/timer-tests.el new file mode 100644 index 0000000..b4cb1e6 --- /dev/null +++ b/test/automated/timer-tests.el @@ -0,0 +1,42 @@ +;;; timer-tests.el --- tests for timers -*- coding: utf-8; 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: + +(require 'ert) + +(ert-deftest timer-tests-sit-for () + (let ((timer-ran nil) + (timeout (time-add (current-time) + '(0 10 0 0))) + ;; Want sit-for behavior when interactive + (noninteractive nil)) + (run-at-time '(0 1 0 0) + nil + (lambda () + (setq timer-ran t))) + (while (not timer-ran) + (should (time-less-p (current-time) + timeout)) + (sit-for 0 t)))) + +;;; timer-tests.el ends here + --001a11c33560ca1aa404e8f11d55 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
Here's the solution you requested. Let me know that it= 's good to
install.

diff --git a/ChangeLog b/ChangeLog
ind= ex a755b5c..8b58ebc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3= +1,15 @@
+2013-10-17=A0 Barry O'Reilly=A0 <gundaetiapo@gmail.com>
+
+=A0=A0=A0=A0=A0=A0 Change how= input-pending-p checks for timers to run. Its default
+=A0=A0=A0=A0=A0= =A0 changes from checking to not checking. Its new check-timers param
+=A0=A0=A0=A0=A0=A0 allows for prior behavior. (Bug#15045).
+=A0=A0=A0= =A0=A0=A0 * src/keyboard.c (Finput_pending_p): Accept optional check-timers=
+=A0=A0=A0=A0=A0=A0 param.
+=A0=A0=A0=A0=A0=A0 * lisp/subr.el (sit-f= or): Call (input-pending-p t) so as to behave
+=A0=A0=A0=A0=A0=A0 as before.
+=A0=A0=A0=A0=A0=A0 * test/automated/time= r-tests.el: New file. Tests that (sit-for 0)
+=A0=A0=A0=A0=A0=A0 allows = another timer to run.
+
=A02013-10-13=A0 Glenn Morris=A0 <rgm@gnu.org>
=A0
=A0=A0=A0=A0=A0=A0=A0 * configure.ac= [alpha]: Explicit error in non-ELF case.=A0 (Bug#15601)
diff --git = a/etc/NEWS b/etc/NEWS
index ddb9a9f..06372f9 100644
--- a/etc/NEWS+++ b/etc/NEWS
@@ -611,6 +611,9 @@ low-level libraries gfilenotify.c, inotify.c or w32noti= fy.c.
=A0^L
=A0* Incompatible Lisp Changes in Emacs 24.4
=A0
+*= * `(input-pending-p)' no longer runs other timers which are ready to+run. The new optional CHECK-TIMERS param allows for the prior behavior. +
=A0** `defvar' and `defcustom' in a let-binding affect the &qu= ot;external" default.
=A0
=A0** The syntax of ?=BB and ?=AB is n= ow punctuation instead of matched parens.
diff --git a/lisp/subr.el b/li= sp/subr.el
index 0d03e9a..952b9b6 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el@@ -2222,7 +2222,7 @@ floating point support."
=A0=A0=A0 (noninte= ractive
=A0=A0=A0=A0 (sleep-for seconds)
=A0=A0=A0=A0 t)
-=A0=A0 (= (input-pending-p)
+=A0=A0 ((input-pending-p t)
=A0=A0=A0=A0 nil)
=A0=A0=A0 ((<=3D seconds 0)
=A0=A0=A0=A0 (or nod= isp (redisplay)))
diff --git a/src/keyboard.c b/src/keyboard.c
index = e0cd4d4..7f8692a 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
= @@ -9947,12 +9947,13 @@ requeued_events_pending_p (void)
=A0=A0 return (!NILP (Vunread_command_events));
=A0}
=A0
-
-DEF= UN ("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,
=A0=A0=A0=A0=A0=A0=A0 doc: /* Return t if command input is currently availa= ble with no wait.
=A0Actually, the value is nil only if we can be sure t= hat no input is available;
-if there is a doubt, the value is t.=A0 */)<= br>-=A0 (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.=A0 */)
+=A0 (Lisp_Object check_= timers)
=A0{
=A0=A0 if (!NILP (Vunread_command_events)
=A0=A0=A0= =A0=A0=A0 || !NILP (Vunread_post_input_method_events)
@@ -9962,8 +9963,9 @@ if there is a doubt, the value is t.=A0 */)
=A0=A0= /* Process non-user-visible events (Bug#10195).=A0 */
=A0=A0 process_sp= ecial_events ();
=A0
-=A0 return (get_input_pending (READABLE_EVENTS_= DO_TIMERS_NOW
-=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0=A0 | READABLE_EVENTS_FILTER_EVENTS= )
+=A0 return (get_input_pending ((EQ (check_timers, Qnil)
+=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0 ? 0 : READABLE_EVENTS_DO_TIMERS_NOW)
+=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 | READABLE_EVENTS_FI= LTER_EVENTS)
=A0=A0=A0=A0 =A0 ? Qt : Qnil);
=A0}
=A0
diff --git a/test/automate= d/timer-tests.el b/test/automated/timer-tests.el
new file mode 100644index 0000000..b4cb1e6
--- /dev/null
+++ b/test/automated/timer-test= s.el
@@ -0,0 +1,42 @@
+;;; timer-tests.el --- tests for timers -*- coding: utf-8; lexical-binding= :t -*-
+
+;; Copyright (C) 2013 Free Software Foundation, Inc.
++;; This file is part of GNU Emacs.
+
+;; This program is free soft= ware: you can redistribute it and/or
+;; modify it under the terms of the GNU General Public License as
+;; p= ublished by the Free Software Foundation, either version 3 of the
+;; Li= cense, 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
+;; MERCH= ANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.=A0 See the GNU
+;; Gener= al Public License for more details.
+;;
+;; You should have received = a copy of the GNU General Public License
+;; along with this program.=A0 If not, see `http://www.gnu.org/licenses/'.
+
+;;; Commentary:<= br>+
+;;; Code:
+
+(require 'ert)
+
+(ert-deftest timer-= tests-sit-for ()
+=A0 (let ((timer-ran nil)
+=A0=A0=A0=A0=A0=A0=A0 (timeout (time-add (cu= rrent-time)
+=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0 '(0 10 0 0)))
+=A0=A0=A0=A0=A0=A0=A0 ;; Want s= it-for behavior when interactive
+=A0=A0=A0=A0=A0=A0=A0 (noninteractive = nil))
+=A0=A0=A0 (run-at-time '(0 1 0 0)
+=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 nil
+=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 (lambda ()
+=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 (setq timer-ran t)))
+=A0=A0=A0 (while (n= ot timer-ran)
+=A0=A0=A0=A0=A0=A0=A0 (should (time-less-p (current-time)=
+=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0 timeout))
+=A0=A0=A0=A0=A0=A0=A0 (sit-for 0 t))))
+
+;;; timer-tests.el ends he= re
+

--001a11c33560ca1aa404e8f11d55--