From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Spencer Baugh Newsgroups: gmane.emacs.devel Subject: Re: A UI approach for making synchronous commands asynchronous Date: Thu, 27 Jul 2023 11:32:33 -0400 Message-ID: References: <83mszhnbez.fsf@gnu.org> <83sf99l7bc.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="34067"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) To: emacs-devel@gnu.org Cancel-Lock: sha1:UrOLUdsXDY4ypy0EZ9r9oYKGmms= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Jul 27 19:12:27 2023 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qP4XL-0008iy-OF for ged-emacs-devel@m.gmane-mx.org; Thu, 27 Jul 2023 19:12:27 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qP4LD-0006Gc-Su; Thu, 27 Jul 2023 12:59:55 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qP2yu-0007Cv-H3 for emacs-devel@gnu.org; Thu, 27 Jul 2023 11:32:48 -0400 Original-Received: from ciao.gmane.io ([116.202.254.214]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qP2ys-00013L-R1 for emacs-devel@gnu.org; Thu, 27 Jul 2023 11:32:48 -0400 Original-Received: from list by ciao.gmane.io with local (Exim 4.92) (envelope-from ) id 1qP2yp-00096u-HO for emacs-devel@gnu.org; Thu, 27 Jul 2023 17:32:43 +0200 X-Injected-Via-Gmane: http://gmane.org/ Received-SPF: pass client-ip=116.202.254.214; envelope-from=ged-emacs-devel@m.gmane-mx.org; helo=ciao.gmane.io X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, HEADER_FROM_DIFFERENT_DOMAINS=0.25, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Thu, 27 Jul 2023 12:59:53 -0400 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 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-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:308161 Archived-At: Eli Zaretskii writes: >> From: Spencer Baugh >> Date: Thu, 27 Jul 2023 10:22:17 -0400 >> >> Eli Zaretskii writes: >> > In addition, it is not clear what hides behind the "UI" notion that >> > you have in mind. There are two aspects to UI: input and display. >> > Which one are you talking about? Only the display or also about input >> > (via the keyboard, mouse, window-system events etc.)? >> >> By "UI" I'm referring to the category of things which includes questions >> like: >> - should I call display-buffer or message here? >> - what keybindings should I use for this set of commands? >> - should I provide a prefix argument for so-and-so behavior, or >> put it in a different command, or make it customizable? > > And you wanted _those_ to be asynchronous? What would that buy us?? No, I don't want those to be asynchronous. I'm explaining what "UI" means, since you asked. > And when I asked a question about a specific command, you describe, > below, something very different... > > So now I'm completely confused regarding what you have in mind. In > particular, since both the prefix argument and the key sequence that > invokes the command are completely detached from the command itself, > and are basically processed by the Emacs main loop. > >> I don't care about the terminology, so what would you call this category >> of questions? > > I have no idea. Moreover, I'm not even sure why we should find some > terminology, because the collection of things you call "UI" is not > meaningful for the issue at hand, which is how to make Emacs "less > blocking". > >> > Please describe in more details how this would work for some file >> > operation in Dired. Suppose I mark some files and then run some >> > command which searches them or renames them or deletes them -- how >> > would this work under your hypothetical "backgrounding"? >> >> 1. I dired-do-rename to move directory "foo" from /home/sbaugh to >> /mnt/sbaugh >> >> 2. Emacs messages: >> Renaming ~/foo to /mnt/sbaugh/foo... >> And stops responding. >> >> 3. After about a second I realize that this is a cross-device move which >> will take several minutes (a common occurence for me). >> I decide I don't want to wait, so I hit C-M-& and Emacs messages: >> Renaming ~/foo to /mnt/sbaugh/foo... backgrounded. >> I switch to some other buffers and do some work. >> >> 4. Several minutes later, Emacs messages: >> Renaming ~/foo to /mnt/sbaugh/foo... done. > > What happens if during the time the command runs "in the background", > you go in the Dired display to one of the files that have been renamed > and press RET? Or some command you invoke while the "backgrounded" > one runs wants to access or visit one of the renamed files? Good question. I'd say, let's follow what the shell does. If you run "mv ~/foo /mnt/sbaugh/foo &" and then run ls, you'll see some of the files still in the source, some of the files in the destination. If you try to access the former, you might get failures. The user already can go do other things that interact with those files, while Emacs is moving them, which won't behave perfectly. So I don't think we should take special care around them. > More importantly, why do you think this kind of "backgrounding" will > be possible without deep changes to the Emacs main loop and to the > implementation of the commands as well? You are basically describing > an Emacs that can run several Lisp threads concurrently, and we just > had (or are still having) a long discussion outlining the problems and > very non-trivial solutions for that. Again, I'm talking here about what would be a nice *experience for the user*. Perhaps "user experience" is a better word to use here. I don't care about what the implementation is. I have thoughts about how we could implement this, but I am not going to discuss it in this thread, as I said in my initial email, since we already have a very long thread about that. I just want to discuss what a good user experience would be, without talking about implementation. This is necessarily somewhat speculative, since we could describe designs which are hard to implement. That's nevertheless what I want to do in this thread, since I think it's useful.