From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Platon Pronko Newsgroups: gmane.emacs.bugs Subject: bug#34821: discard_input_tty does not discard pending input, resulting in garbage inserted into the buffer Date: Sun, 7 Apr 2019 22:06:23 +0300 Message-ID: <0029f748-36b6-e344-9aef-53f0e2101200@gmail.com> References: <6e2317c9-5063-3718-740e-f53c70f5db5b@gmail.com> <83v9zp93gq.fsf@gnu.org> <492c723c-6ba9-24da-108f-b25cef0dd54e@gmail.com> <83r2ad8yh1.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="259580"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.3 To: 34821@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Apr 07 21:07:13 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hDD8K-0015PP-JE for geb-bug-gnu-emacs@m.gmane.org; Sun, 07 Apr 2019 21:07:12 +0200 Original-Received: from localhost ([127.0.0.1]:42543 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hDD8J-0007Ne-J9 for geb-bug-gnu-emacs@m.gmane.org; Sun, 07 Apr 2019 15:07:11 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:51324) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hDD8D-0007NW-5j for bug-gnu-emacs@gnu.org; Sun, 07 Apr 2019 15:07:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hDD8B-0006Tc-Li for bug-gnu-emacs@gnu.org; Sun, 07 Apr 2019 15:07:05 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:35169) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hDD8A-0006SJ-2Y for bug-gnu-emacs@gnu.org; Sun, 07 Apr 2019 15:07:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hDD89-000537-ON for bug-gnu-emacs@gnu.org; Sun, 07 Apr 2019 15:07:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Platon Pronko Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 07 Apr 2019 19:07:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 34821 X-GNU-PR-Package: emacs Original-Received: via spool by 34821-submit@debbugs.gnu.org id=B34821.155466399619372 (code B ref 34821); Sun, 07 Apr 2019 19:07:01 +0000 Original-Received: (at 34821) by debbugs.gnu.org; 7 Apr 2019 19:06:36 +0000 Original-Received: from localhost ([127.0.0.1]:48713 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hDD7k-00052O-Ha for submit@debbugs.gnu.org; Sun, 07 Apr 2019 15:06:36 -0400 Original-Received: from mail-lf1-f54.google.com ([209.85.167.54]:43509) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hDD7i-00052B-TN for 34821@debbugs.gnu.org; Sun, 07 Apr 2019 15:06:35 -0400 Original-Received: by mail-lf1-f54.google.com with SMTP id g7so7799441lfh.10 for <34821@debbugs.gnu.org>; Sun, 07 Apr 2019 12:06:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding:content-language; bh=5KaOg8/b8Xu5tKM+/HrbKN5zZ5l32j8ezfeiEqXJ4WQ=; b=eJlGQCT4PqznscI7Kmk20DjeQ9bP7f3TYDGdpsQSLdRigIkckmRlwrstkMku4y9oUw LngcWy9bW425cmWTJSEzp8q72+hM+w+Fqtzis3PuZ34OC2MuRxk56SUirgN+P1gmJMp1 YWiW0+M4LI7LR/Bl1EhfYmh8gtFckV3x1/LI8miDSkkuYO/XIW1v/9Wjr/bNY+Qua4/L Ng3yN8s2VTWKvRVw5XO8WJCN5pbRVnUoKRv2wppY4OaPCMlZfWQnVyx7Yw5HpF7M5ri8 Q9Ue2IdOaj5YKo5atvg+8NfOPlAdsggDtGBxX5vMfT/z6TCh8TEhy5xDMEEmKVRsrMcK yrQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=5KaOg8/b8Xu5tKM+/HrbKN5zZ5l32j8ezfeiEqXJ4WQ=; b=mINHGlXEUfliVYgbiGvIsphveRsGJSJLKT9oR0VRQOjinrOR+fYyemay+5L0aiOy5+ FYxZInj0qL7sySNxpAiS0vxJoDdFoGsqjShYz40j78469rsGkUTsYpktGbq9jA8mxIfv f4NL39/wF3LtY9fqzLotpgBbSCvqjaPxwQ06xfZ4HFaglmPErwnZXCw9/PZeAYRDyXYy t7JsLt5sBBcTrN7pYRtHSrkF1EBfyF+FgFOy3EN1Wm03Sfu4ia4rWJv4W5S6KpYKeqpN HHn5BdE+AOVDL3Nh0w53UVKZyjzF2XAbaeGxlPG66cN4HSFWMWOXYYAuZG7xkU//eFCr uhPA== X-Gm-Message-State: APjAAAVlbRK5BXJkZdCHwiU8BBqoT0Py77CP3aXBlcLl3cD8wycnrgBp 0OrNPaltio7MLUgOB9CfuF4NC8Kc X-Google-Smtp-Source: APXvYqyhh7eNQLi2rCf/MM9JEGsjgvqAsK5BRpwPlzau1vynyUz8r2XWtV9J4BBNTdCcvgMytz/wkw== X-Received: by 2002:ac2:4850:: with SMTP id 16mr4356090lfy.70.1554663988136; Sun, 07 Apr 2019 12:06:28 -0700 (PDT) Original-Received: from [192.168.1.65] (109-252-80-126.nat.spd-mgts.ru. [109.252.80.126]) by smtp.gmail.com with ESMTPSA id u19sm5634638lfg.74.2019.04.07.12.06.26 for <34821@debbugs.gnu.org> (version=TLS1_3 cipher=AEAD-AES128-GCM-SHA256 bits=128/128); Sun, 07 Apr 2019 12:06:26 -0700 (PDT) In-Reply-To: <83r2ad8yh1.fsf@gnu.org> Content-Language: en-US X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.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" Xref: news.gmane.org gmane.emacs.bugs:157321 Archived-At: > What do you mean by "run concurrently"? Emacs is pretty much a single > threaded program, and there's only one Lisp thread running at any > given time, which will execute both calls. My knowledge of Emacs internals is pretty thin indeed. But since adding sleep-for results in reordering of events, I thought that there are at least different threads that compete for execution (concurrent, maybe not parallel). Also I noticed that for example read_char() calls can block for quite a lot of time, while Lisp code continues to run. Perhaps there is one Lisp thread and some other background C threads? > You may be right, but my reasoning was that without knowing why > there's a second buffer-switch event sometimes, we will be unable to > devise a good solution. IOW, I think we need to understand the issue > better before we are ready to discuss a solution. I agree. I'll look at what causes that second event, I'm quite interested in the mechanics of it anyway.