From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Michael Heerdegen Newsgroups: gmane.emacs.bugs Subject: bug#15042: 24.3.50; while-no-input and input-pending-p Date: Wed, 07 Aug 2013 17:39:42 +0200 Message-ID: <87wqnx7bnl.fsf@web.de> Reply-To: michael_heerdegen@web.de NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1375890134 31992 80.91.229.3 (7 Aug 2013 15:42:14 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 7 Aug 2013 15:42:14 +0000 (UTC) Cc: Thierry Volpiatto To: 15042@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Aug 07 17:42:16 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 1V75sM-00064T-7w for geb-bug-gnu-emacs@m.gmane.org; Wed, 07 Aug 2013 17:42:14 +0200 Original-Received: from localhost ([::1]:48490 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V75sL-0000kx-KG for geb-bug-gnu-emacs@m.gmane.org; Wed, 07 Aug 2013 11:42:13 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:33304) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V75rK-0007RS-JG for bug-gnu-emacs@gnu.org; Wed, 07 Aug 2013 11:41:18 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V75rC-0005GR-JH for bug-gnu-emacs@gnu.org; Wed, 07 Aug 2013 11:41:10 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:51378) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V75rC-0005Fi-Ga for bug-gnu-emacs@gnu.org; Wed, 07 Aug 2013 11:41:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1V75rC-0003iD-2B for bug-gnu-emacs@gnu.org; Wed, 07 Aug 2013 11:41:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Michael Heerdegen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 07 Aug 2013 15:41:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 15042 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.137589003613847 (code B ref -1); Wed, 07 Aug 2013 15:41:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 7 Aug 2013 15:40:36 +0000 Original-Received: from localhost ([127.0.0.1]:45693 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1V75qh-0003a9-Pf for submit@debbugs.gnu.org; Wed, 07 Aug 2013 11:40:35 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:59631) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1V75qU-0003UL-DO for submit@debbugs.gnu.org; Wed, 07 Aug 2013 11:40:23 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V75qG-00050k-Pq for submit@debbugs.gnu.org; Wed, 07 Aug 2013 11:40:12 -0400 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:43008) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V75qG-00050F-M3 for submit@debbugs.gnu.org; Wed, 07 Aug 2013 11:40:04 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:33029) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V75q9-00067Q-G1 for bug-gnu-emacs@gnu.org; Wed, 07 Aug 2013 11:40:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V75q2-0004la-JS for bug-gnu-emacs@gnu.org; Wed, 07 Aug 2013 11:39:57 -0400 Original-Received: from mout.web.de ([212.227.15.3]:57237) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V75q2-0004lN-AK for bug-gnu-emacs@gnu.org; Wed, 07 Aug 2013 11:39:50 -0400 Original-Received: from drachen.dragon ([90.187.127.150]) by smtp.web.de (mrweb101) with ESMTPSA (Nemesis) id 0LjJPH-1VjRrX16dD-00dXrp for ; Wed, 07 Aug 2013 17:39:48 +0200 X-Provags-ID: V03:K0:D9SJgOtv3HMOUu5mpBw52aL0rapt2Gd3BaFUxgiEFLdvLpmNkSn XhDc0ltNUWHBh1n2aOPub+9R3FfLI38k7TuSgSLdQEg8ObADboLEwm3Uc0ogCO9SgGOXk1D M6qo9Yr0S0sHfcq9r3vy71PS2/MTiAfuFFn0UqdxIWU5fxahIVqRHh9ho61NoTR527nW6dE OXaaHUyNCa+KsZ/LKbMsw== X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). 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:77019 Archived-At: Hello, I want to discuss if the current implementation of `while-no-input': --8<---------------cut here---------------start------------->8--- (defmacro while-no-input (&rest body) "Execute BODY only as long as there's no pending input. If input arrives, that ends the execution of BODY, and `while-no-input' returns t. Quitting makes it return nil. If BODY finishes, `while-no-input' returns whatever value BODY produced." (declare (debug t) (indent 0)) (let ((catch-sym (make-symbol "input"))) `(with-local-quit (catch ',catch-sym (let ((throw-on-input ',catch-sym)) (or (input-pending-p) (progn ,@body))))))) --8<---------------cut here---------------end--------------->8--- that uses a preliminary `input-pending-p' test is useful. My reasons: 1. `input-pending-p' can (and does) return t in cases were no input is pending (see the doc). In such cases, `while-no-input' just returns t, although no input was given. This contradicts the doc, is not useful and the behavior is unforeseeable. 2. Even if `input-pending-p' would not give false alarm sometimes - why needs `while-no-input' to use it? If the programmer really wants to check for input _before_ starting the calculation, he can do so explicitly. With the current implementation, I have to `discard-input' if I don't want this. 2 is probably arguable, but 1 is really bad. I experienced that (while-no-input code ...) is sometimes semantically equivalent to t without any input. Regards, Michael. In GNU Emacs 24.3.50.1 (x86_64-pc-linux-gnu, GTK+ Version 3.8.2) of 2013-08-04 on dex, modified by Debian (emacs-snapshot package, version 2:20130804-1) Windowing system distributor `The X.Org Foundation', version 11.0.11204000 System Description: Debian GNU/Linux testing (jessie) Configured using: `configure --build x86_64-linux-gnu --host x86_64-linux-gnu --prefix=/usr --sharedstatedir=/var/lib --libexecdir=/usr/lib --localstatedir=/var --infodir=/usr/share/info --mandir=/usr/share/man --with-pop=yes --enable-locallisppath=/etc/emacs-snapshot:/etc/emacs:/usr/local/share/emacs/24.3.50/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/24.3.50/site-lisp:/usr/share/emacs/site-lisp --without-compress-info --with-crt-dir=/usr/lib/x86_64-linux-gnu/ --with-x=yes --with-x-toolkit=gtk3 --with-imagemagick=yes CFLAGS='-DDEBIAN -DSITELOAD_PURESIZE_EXTRA=5000 -g -O2' CPPFLAGS='-D_FORTIFY_SOURCE=2' LDFLAGS='-g -Wl,--as-needed -znocombreloc'' Important settings: value of $LC_ALL: de_DE.utf8 value of $LANG: de_DE.utf8 locale-coding-system: utf-8-unix default enable-multibyte-characters: t