From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: martin rudalics Newsgroups: gmane.emacs.devel Subject: Re: User interaction from multiple threads Date: Wed, 15 Aug 2018 10:06:40 +0200 Message-ID: <5B73DF10.5070200@gmx.at> References: <838t59j821.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: blaine.gmane.org 1534320306 9202 195.159.176.226 (15 Aug 2018 08:05:06 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 15 Aug 2018 08:05:06 +0000 (UTC) To: Eli Zaretskii , emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Aug 15 10:05:02 2018 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fpqnd-0002Fx-Je for ged-emacs-devel@m.gmane.org; Wed, 15 Aug 2018 10:05:01 +0200 Original-Received: from localhost ([::1]:47927 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fpqpk-00026G-3b for ged-emacs-devel@m.gmane.org; Wed, 15 Aug 2018 04:07:12 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:32928) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fpqpY-00024l-Jg for emacs-devel@gnu.org; Wed, 15 Aug 2018 04:07:01 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fpqpW-0006ON-JE for emacs-devel@gnu.org; Wed, 15 Aug 2018 04:06:59 -0400 Original-Received: from mout.gmx.net ([212.227.15.18]:59087) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fpqpS-0006Cr-FF; Wed, 15 Aug 2018 04:06:54 -0400 Original-Received: from [192.168.1.101] ([46.125.249.24]) by mail.gmx.com (mrgmx002 [212.227.17.190]) with ESMTPSA (Nemesis) id 0LzKyn-1ftmpL49vV-014X7G; Wed, 15 Aug 2018 10:06:47 +0200 In-Reply-To: <838t59j821.fsf@gnu.org> X-Provags-ID: V03:K1:RaNUYnijfPD2nL4EyQeI3txu3IkMB+VD7CCbXY2iVl47QnQsCjl HqB3uhdOBYbWL4ns+QKXADuAmUwt9x8IxpK0JRPvu0YSo6G/uuaCJPLQt99ET0iengoSOs8 +6+8Avwh5wChpurQ+1bb8DBZGdgCzT/iBwd6za7XAFA2HhLyZXcE66Yie20JqertA3GSmi1 14/gz2jkEFcYCcpEDd0Ow== X-UI-Out-Filterresults: notjunk:1;V01:K0:giCuJMaekoY=:Gl04RvNE5mTzWWmrdt68tE 2thm1ApKx56vHmhSkgvIayIXivXFmf27yeDmCACSTf5mryhGSaUkmyDORnPc82BhVjqeIII4j h+74A47rmu38ibwLZE/Tty67pNSvwKVSw2MLjCTn/wkOKQtOddXDctrWh6IuNypNgiSL+20EW 2kItDUumGUzEy3nFefFwNByPQmjtRBDmNxd13gqalYGWPkGsyeHludOYieBufZcvm0IYmA/kQ UxaMUqHJtWo8HB/RZPcHjvAIFaW/XzR282ewL15d/pmK4w4+vsCqE4J9jra8LlNj0g41/c0oi cOXwPRxJ0LvV3yZMoKstcMfqte9Dw9IqjSxczCumM562kbtJOA70w+z/cicrWUJoV1ysO9FxM 26j+DaeU/peroI7sr9d7TwBLskJ+MnLzij0RLYWXVIk5eXWfvjcpBK636pVEcY5OfMiu4++tv HQXx+O95xXvMih4TuOVpe8U6nkGftY/5vhhBbHXWIJjkqalHKmM0FXynsWF4AJJ+UqU877yYF M3bNlwZ+gFTddzzDtRuPZlZiVr1EXqBlXVLnuC5ZQudxnxq4lx9B6AeY9qYTtdkXx5rw4CrKv m/jRs7QxYrMMI4WgUNoOZu3pXkqsTmzFaa4018EJ6hlrA0vqdkHFMVe6O8KRzotZK++PZOKjl 6N/YTtyH9oywvrW13ZFjjzcKjrn4pScw7aXMPsYJ0pxMrYbNrkBWjKXgUEDaTwLjQ+hW0Ixyz sQ0NyGwB9gBRmLFoTo10uutPaIUz9bgkoPiVf75kWuYW2gQpaEwuJt8Gx0nZpZgj63NWG5zY X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 212.227.15.18 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:228549 Archived-At: > . The main thread is waiting for user input. The user didn't yet > type anything > . A non-main thread runs Lisp that prompts the user for some input > > In this case, we probably want the following input to go to the > prompting thread, right? But it might also be the case that the > user actually wants the input to go to the main thread, e.g. to > perform some unrelated command. Should we allow that? If yes, how > should Emacs know which thread should receive what the user types? If we make a rule that each thread owns a frame with a minibuffer, the decision which thread receives input on a GUI is left to the windowing subsystem. We would have to emulate that behavior on a TTY somehow but that should be an implentational detail. > Same as the previous, but now the user is in the middle of typing a > key sequence, when the non-main thread prompts. For example, > suppose the user has typed "C-x". > > What do we want to happen now? Do we "preempt" the main thread and > let the following input to go to the prompting thread? Or do we let > the prompting thread wait until the main thread reads a full key > sequence and runs the command bound to it? If the former, what to > do with the partial key sequence ("C-x") that the user typed? The partial key sequence should be preserved and typing resumed where it was interrupted when the user switches back to the main thread by selecting a frame owned by the main frame. > If > the latter, how do we indicate to the user that there is a prompt > from another thread? > > Use case #3: > > Similar, but now 2 or more non-main threads prompt the user, one > after the other, in quick succession. What should happen now, and > how will the user know there are multiple prompts? If each prompt has its own frame, this is trivial. The user will answer the prompt of the frame that happens to be selected and will be able to switch between prompts by selecting their respective frames. Obviously, for each frame/thread we would have to record its input state to be able to resume an interaction where the user left off. martin