From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Qiantan Hong Newsgroups: gmane.emacs.devel Subject: Re: Question collaborative editing. Date: Thu, 1 Oct 2020 15:21:37 +0000 Message-ID: References: <20200929215849.zg4wzytbrwx2b7ih@Ergus> <84B86B7C-81F0-42DF-894C-BF577E4B3D6E@mit.edu> <83a6x7js6y.fsf@gnu.org> <83eemji6e8.fsf@gnu.org> <83blhni3kr.fsf@gnu.org> <0B69D727-B2C1-44FC-8382-FDAB6C7CBDAD@mit.edu> <83a6x7i1d0.fsf@gnu.org> <20200930231159.q6h6etboucwkjcfe@Ergus> <83pn62gj2s.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/signed; boundary="Apple-Mail=_1929E6DE-D6C4-4B00-9A0D-E716A765D512"; protocol="application/pkcs7-signature"; micalg=sha-256 Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="29242"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Ergus , Fermin , Jean Louis , Noam Postavsky , Emacs developers , Karl Fogel , Stefan Monnier To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Oct 01 17:23:44 2020 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 1kO0Qq-0007VP-6x for ged-emacs-devel@m.gmane-mx.org; Thu, 01 Oct 2020 17:23:44 +0200 Original-Received: from localhost ([::1]:50582 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kO0Qp-0000yZ-6v for ged-emacs-devel@m.gmane-mx.org; Thu, 01 Oct 2020 11:23:43 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:53276) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kO0PT-0007mc-CB for emacs-devel@gnu.org; Thu, 01 Oct 2020 11:22:19 -0400 Original-Received: from outgoing-exchange-1.mit.edu ([18.9.28.15]:45702) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kO0PQ-0000j1-Ek; Thu, 01 Oct 2020 11:22:18 -0400 Original-Received: from oc11exedge1.exchange.mit.edu (OC11EXEDGE1.EXCHANGE.MIT.EDU [18.9.3.17]) by outgoing-exchange-1.mit.edu (8.14.7/8.12.4) with ESMTP id 091FLUVW031526; Thu, 1 Oct 2020 11:22:10 -0400 Original-Received: from oc11expo16.exchange.mit.edu (18.9.4.47) by oc11exedge1.exchange.mit.edu (18.9.3.17) with Microsoft SMTP Server (TLS) id 15.0.1293.2; Thu, 1 Oct 2020 11:20:56 -0400 Original-Received: from oc11expo16.exchange.mit.edu (18.9.4.47) by oc11expo16.exchange.mit.edu (18.9.4.47) with Microsoft SMTP Server (TLS) id 15.0.1365.1; Thu, 1 Oct 2020 11:21:37 -0400 Original-Received: from oc11expo16.exchange.mit.edu ([18.9.4.47]) by oc11expo16.exchange.mit.edu ([18.9.4.47]) with mapi id 15.00.1365.000; Thu, 1 Oct 2020 11:21:37 -0400 Thread-Topic: Question collaborative editing. Thread-Index: AQHWkA+RtV3K1wr9B0aFczVHqkD+n6lzGC2+gAByx1WAA75ZgIABUIuAgAAtCoCAAKrvgIAEEd+AgAGGOACAABFAAIAAe9OAgABIs4CAAA5xVYAAjDuAgAAchYCAAKh2a4AAZX0A///GIeWAAE52AIAAAPKA///BnCeAAEq0gP//wqnFABL5n4AAFfmrTwAL44iA In-Reply-To: <83pn62gj2s.fsf@gnu.org> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: yes x-ms-exchange-messagesentrepresentingtype: 1 x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [18.18.245.17] Received-SPF: pass client-ip=18.9.28.15; envelope-from=qhong@mit.edu; helo=outgoing-exchange-1.mit.edu X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/01 11:22:14 X-ACL-Warn: Detected OS = Windows 7 (Websense crawler) X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 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" Xref: news.gmane.io gmane.emacs.devel:256863 Archived-At: --Apple-Mail=_1929E6DE-D6C4-4B00-9A0D-E716A765D512 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > IMO, that is not a good idea, to put it mildly. Since these > properties can potentially span very few characters, or even change > the value at each buffer position in extreme cases, they will most > probably slow down redisplay, perhaps even significantly so. The > problem here is that the display engine always knows where's the next > buffer position, called "stop position" at which text properties > change values. Between the stop positions, the display engine runs at > full throttle, using the information about properties (notably, faces) > and overlays it computed at the last stop position. But when it comes > to the next stop position, it stops and reconsiders all the stuff that > can affect display: text properties (faces, invisibility), overlays, > composed characters, etc., something that requires non-trivial > processing. Having text properties change too often will cause > slowdown, even though these properties don't affect redisplay. Thanks for the insight, I=E2=80=99ve never knew Emacs internal so much to be able to consider this. The optimistic side is that I=E2=80=99m = using the merge-item approach as in Yjs so hopefully text property change is not so frequent=E2=80=A6 > I'm not sure we need to implement this in Emacs. For example, Tandem > doesn't require this from its plugins; presumably, it builds the > character IDs internally? You could look at its implementation of > CRDT and take the ideas from there; AFAIU, it requires only a couple > of very simple operations to be implemented by plugins. IMO the problem of this approach is that if there=E2=80=99s any desync = between buffer in the library and buffer in the editor the outcome is = disastrous, and this can not only come from some bug =E2=80=94 Emacs and C library has to talk asynchronously and bidirectionally, which means = theoretically there will be case that Emacs does some change, sent a message to C library, but some message before C library receive the change from Emacs arrives later=20 Emacs C-Library | | \ / | | | X | | | / \ | V Although the latency window on local machine is very small, the latency of Emacs Lisp interpreter responding to events is a another = complication... There are way to work around this of course, but it=E2=80=99ll = definitely require more work rather than just sending simple operation and buffer position, at = least there need to be UID for each operation and some transaction mechanism. I see that Tandem send old text and new text with the text operation. = This is definitely a workaround with no correctness guarantee, and it = doesn=E2=80=99t specify what to do when a desync happens. But those are just my mutering about correctness, I can imagine that it might work good enough in = practice.= --Apple-Mail=_1929E6DE-D6C4-4B00-9A0D-E716A765D512 Content-Disposition: attachment; filename="smime.p7s" Content-Type: application/pkcs7-signature; name="smime.p7s" Content-Transfer-Encoding: base64 MIAGCSqGSIb3DQEHAqCAMIACAQExDzANBglghkgBZQMEAgEFADCABgkqhkiG9w0BBwEAAKCCA70w ggO5MIIDIqADAgECAhAaql39NsO1qLVjkS2hl517MA0GCSqGSIb3DQEBCwUAMGwxCzAJBgNVBAYT AlVTMRYwFAYDVQQIEw1NYXNzYWNodXNldHRzMS4wLAYDVQQKEyVNYXNzYWNodXNldHRzIEluc3Rp dHV0ZSBvZiBUZWNobm9sb2d5MRUwEwYDVQQLEwxDbGllbnQgQ0EgdjEwHhcNMjAwODAzMDEyNDIz WhcNMjEwODAxMDEyNDIzWjCBoTELMAkGA1UEBhMCVVMxFjAUBgNVBAgTDU1hc3NhY2h1c2V0dHMx LjAsBgNVBAoTJU1hc3NhY2h1c2V0dHMgSW5zdGl0dXRlIG9mIFRlY2hub2xvZ3kxFTATBgNVBAsT DENsaWVudCBDQSB2MTEVMBMGA1UEAxMMUWlhbnRhbiBIb25nMRwwGgYJKoZIhvcNAQkBFg1xaG9u Z0BNSVQuRURVMIIBIjANBgkqhkiG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