From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Po Lu Newsgroups: gmane.emacs.devel Subject: Re: Emacs design and architecture. How about copy-on-write? Date: Wed, 20 Sep 2023 09:01:56 +0800 Message-ID: <87cyydverf.fsf@yahoo.com> References: <83edizjn0v.fsf@gnu.org> <0518f65b-1dd1-6923-8497-da4d3aeac631@gutov.dev> <87sf7fc7kd.fsf@dataswamp.org> <834jjuk68t.fsf@gnu.org> <87cyyhc7uu.fsf@dataswamp.org> <83ttrsg9nx.fsf@gnu.org> <83h6nrg4eg.fsf@gnu.org> <83v8c7elan.fsf@gnu.org> <87h6nrwqvq.fsf@yahoo.com> <83msxjed5c.fsf@gnu.org> <83ediuck9t.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="40668"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: acm@muc.de, incal@dataswamp.org, emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Sep 20 03:03:22 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 1qilcf-000AGD-C7 for ged-emacs-devel@m.gmane-mx.org; Wed, 20 Sep 2023 03:03:21 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qilbh-0005f1-Hp; Tue, 19 Sep 2023 21:02:21 -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 1qilbf-0005ee-90 for emacs-devel@gnu.org; Tue, 19 Sep 2023 21:02:19 -0400 Original-Received: from sonic314-21.consmr.mail.ne1.yahoo.com ([66.163.189.147]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qilbc-00018d-Sj for emacs-devel@gnu.org; Tue, 19 Sep 2023 21:02:18 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1695171729; bh=1c/q7TEyZZ2/KAFZ0G/HzFjw06PycWM7EX2yoEWmhx0=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From:Subject:Reply-To; b=c5Dg4jbsd99XpiTTn6bDamZOLISgf120LnBqHTLvp8C38pO/W/qVIbSWobK5wTlb/5OMyErbICSryt2svsN4yrGtueWH14x1DZFSv1WXWF03G2r6aBjHuaWFTIBrwJqynCRfHjkJAu8AievnURhQx2DD9EzLkzgDNVTKEuqh7+RH+3B5r+yDMMAxCLPXkelY3oxz/1pzQPKDuh6m3KbxNSggLP6mhJRsxM/x37nz9OY9Yu3p7Qh5ptjIexqCqIlOMkmlcg7uf4s2fZe8CGBC3xRHWf5wUlYMa/AbmTWFjindu5jdRcuwsHUWtEFra2GyHKujWqm0eW+9HYDF+l1cGA== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1695171729; bh=bbTi+cndKVwRsLmdnYgOwIEjiNW1Hi1LoWBDuLfR72R=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b=B+F53A0eoCDa/31liqva4Ei1tWTn4CZE7cPXDK+bakvsJQW4Xew8eD6IDBv9sjND4KU4bkCmEbeabNaN61uKzZrCEFu7bUys+5JmF1BPN9LSnhE4hG+Leo7wD1uqF8Pxo5DdRvT8VuTY7ETYO6xSe/O7SsHShlEjdIxOYoG7HD/6VDj6x3IyUCM4ZB1d6Ym9SCcuNo7qT9RdAanu0EkVrp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ail.ne1.yahoo.com by sonic314.consmr.mail.ne1.yahoo.com with HTTP; Wed, 20 Sep 2023 01:02:09 +0000 Original-Received: by hermes--production-sg3-55c667b499-wx5qv (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID 6537963e2fb379c9578c92c57ce009f3; Wed, 20 Sep 2023 01:02:02 +0000 (UTC) In-Reply-To: <83ediuck9t.fsf@gnu.org> (Eli Zaretskii's message of "Tue, 19 Sep 2023 17:25:34 +0300") X-Mailer: WebService/1.1.21797 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.yahoo Received-SPF: pass client-ip=66.163.189.147; envelope-from=luangruo@yahoo.com; helo=sonic314-21.consmr.mail.ne1.yahoo.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action 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:310799 Archived-At: Eli Zaretskii writes: > So if point moves off the window, we will have a window that doesn't > show point? We will have a window whose point does not reflect its contents on the display. A supervening redisplay within the main thread will give due consideration to its new value when it does transpire. > Yes, but almost everything we do in Emacs has its purpose of affecting > display, eventually. Including process output we read and whatever > computations we do. Emacs is a real-time display editor, first and > foremost, so this should not be a surprise. The only notable > exception from this rule is batch-style execution in a script. These eventualities must take place within the main thread, that's all. > How do you "transfer it to the main thread for display", exactly? By setting a global variable that is subsequently read by the main thread, modifying unread-command-events, and signaling a condition variable that induces read_char to return the new value of unread-command-events. > And won't you want to display some kind of progress indicator while > fetching? or show an error message if things fail? Every Lisp program > invokes gazillion low-level subroutines and primitives, and some of > those feel free to ask the user questions, show messages, etc. Even > process.c shows messages, and modifying a file-visiting buffer might > ask about supersession locks. We cannot just forbid display from > non-main threads, unless we are willing to rewrite most of the > application code in Emacs, and many of the primitives as well. The > only solution that avoids the massive rewrite is to invent mechanisms > that still allow non-main threads to communicate with users. process.c can't be employed from non-main threads, as they are forbidden from entering wait_reading_process_output. Likewise for the file-lock stuff, as it calls read_char. My idea is that non-main threads will communicate with subprocesses and read or write files through a different set of primitives, but they have not been implemented. The principle difficulty with the existing file primitives is that they can call thread-unsafe Lisp; file name handlers provided by TRAMP, for example.