From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.bugs Subject: bug#19381: The doc string for `sit-for' is wrong; redisplay isn't unconditionally done. Date: Tue, 16 Dec 2014 17:00:23 +0000 Message-ID: <20141216170023.GB3134@acm.acm> References: <20141214171350.GA2606@acm.acm> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1418749362 790 80.91.229.3 (16 Dec 2014 17:02:42 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 16 Dec 2014 17:02:42 +0000 (UTC) Cc: 19381-done@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Dec 16 18:02:35 2014 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 1Y0vW3-0005tB-Qu for geb-bug-gnu-emacs@m.gmane.org; Tue, 16 Dec 2014 18:02:31 +0100 Original-Received: from localhost ([::1]:45824 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y0vW2-00025u-Ks for geb-bug-gnu-emacs@m.gmane.org; Tue, 16 Dec 2014 12:02:30 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:43650) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y0vUk-00006B-3Q for bug-gnu-emacs@gnu.org; Tue, 16 Dec 2014 12:01:17 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Y0vUc-0001tJ-EU for bug-gnu-emacs@gnu.org; Tue, 16 Dec 2014 12:01:09 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:38687) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y0vUc-0001tC-AC for bug-gnu-emacs@gnu.org; Tue, 16 Dec 2014 12:01:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1Y0vUb-00068h-SD for bug-gnu-emacs@gnu.org; Tue, 16 Dec 2014 12:01:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Alan Mackenzie Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 16 Dec 2014 17:01:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 19381 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 19381-done@debbugs.gnu.org id=D19381.141874925023570 (code D ref 19381); Tue, 16 Dec 2014 17:01:01 +0000 Original-Received: (at 19381-done) by debbugs.gnu.org; 16 Dec 2014 17:00:50 +0000 Original-Received: from localhost ([127.0.0.1]:48053 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Y0vUP-000686-HH for submit@debbugs.gnu.org; Tue, 16 Dec 2014 12:00:50 -0500 Original-Received: from colin.muc.de ([193.149.48.1]:47984 helo=mail.muc.de) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Y0vUN-00067x-2h for 19381-done@debbugs.gnu.org; Tue, 16 Dec 2014 12:00:47 -0500 Original-Received: (qmail 89468 invoked by uid 3782); 16 Dec 2014 17:00:45 -0000 Original-Received: from acm.muc.de (pD951A574.dip0.t-ipconnect.de [217.81.165.116]) by colin.muc.de (tmda-ofmipd) with ESMTP; Tue, 16 Dec 2014 18:00:44 +0100 Original-Received: (qmail 4971 invoked by uid 1000); 16 Dec 2014 17:00:23 -0000 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-Delivery-Agent: TMDA/1.1.12 (Macallan) X-Primary-Address: acm@muc.de 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:97393 Archived-At: Hello, Stefan. On Mon, Dec 15, 2014 at 01:50:25PM -0500, Stefan Monnier wrote: > > The doc string for `sit-for', in its first (and most important) line > > states unequivocally that redisplay is performed. (That line is "Perform > > redisplay, then wait for SECONDS seconds or until input is available.") > > That's not what the function currently does - it doesn't perform > > redisplay if input is already available when it is called. > I've changed it to say: > "Redisplay, then wait for SECONDS seconds. Stop when input is available. Thanks, that's better. It's an awkward thing to have to squeeze into one line. > So that the "when input is available" part is not so closely tied to > the "wait" part but can also apply to the "redisplay" part. > > It would seem at first sight that the obvious thing to do is correct the > > first line of the doc string. However there are lots (125) of instances > > of "(sit-for 0)" in Emacs, and a lot of these are probably intended to > > mean "perform redisplay NOW". So it might be better to make `sit-for' > > always do a redisplay. > While fixing the docstring, I also saw that the code of sit-for hints > at the solution to the above problem: if you just want to redisplay, > don't call (sit-for 0), but call `redisplay' instead (where the `force' > argument can be used to decide whether pending input should prevent > redisplay or not). Yes. There are 17 calls to `redisplay' in Emacs. Of the 125 "(sit-for 0)"s, a lot of them will be wanting redisplay, but are being called in the context of a user typing individual keys. (This is certainly the case in edebug.el, for example.) So, it doesn't matter too much. > Stefan -- Alan Mackenzie (Nuremberg, Germany).