From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Yuan Fu Newsgroups: gmane.emacs.devel Subject: A new collaborative editing package (maybe tangent) Date: Fri, 29 Dec 2023 20:22:55 -0800 Message-ID: <3E633CB5-B727-4933-8CF1-E1044CF39E70@gmail.com> Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.700.6\)) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="26081"; mail-complaints-to="usenet@ciao.gmane.io" To: emacs-devel Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Dec 30 05:24:15 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 1rJQtS-0006cn-Fg for ged-emacs-devel@m.gmane-mx.org; Sat, 30 Dec 2023 05:24:14 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rJQsc-0002Iu-UZ; Fri, 29 Dec 2023 23:23:22 -0500 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 1rJQsa-0002HD-QL for emacs-devel@gnu.org; Fri, 29 Dec 2023 23:23:20 -0500 Original-Received: from mail-oi1-x231.google.com ([2607:f8b0:4864:20::231]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rJQsR-000279-Pz for emacs-devel@gnu.org; Fri, 29 Dec 2023 23:23:17 -0500 Original-Received: by mail-oi1-x231.google.com with SMTP id 5614622812f47-3bbbdf0b859so2967911b6e.3 for ; Fri, 29 Dec 2023 20:23:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1703910188; x=1704514988; darn=gnu.org; h=to:date:message-id:subject:mime-version:content-transfer-encoding :from:from:to:cc:subject:date:message-id:reply-to; bh=xDuE8rQuui5clRiDzwAbKYSb65awLtt+lZOO5wV49no=; b=Zu2LHey9JvenGAKeE+AM8kxiUwS+2RD/0uFAUQ5eooPqD0jJudDX3vofyUYwsbLtci BGbauJaOeptfJ5yoLpysxwRAvEWfak6Cd677A0EowrqX+nFXFReE5hPng8ndSE+4JpOL 1YBDAxdXDqGETmyYG2lXL2aRoh3v0W/MG3ozEw3YVBXYrW9TkSRtm0D2GQ/U8r9HaB7R Nn3mOhca3zfzk5sSGByqDVB49ONsSsY9ZKDLwRE7QVL823INngI3o/K2px3hOoVSUPYB o6kuVmm2OH2rIo10Du6LzbzUCo8d83GjfRTZGjuf77hD0jg6FnBh1dkzw9zxDfXV1e+w SjHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703910188; x=1704514988; h=to:date:message-id:subject:mime-version:content-transfer-encoding :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=xDuE8rQuui5clRiDzwAbKYSb65awLtt+lZOO5wV49no=; b=cfil+L/7zQQC/69lLvjHqSCOc3zhdqX5ue4QiP3uF+FKyntMwXan/E5wb8wWv9RiS3 KsAFYJL6DHnWzo35iYAui/FPDG7oynItARXxymcedOV1qM9MQB64/Au/+hX9LaM2RhbH xDGdO6YGO2X2jdphNZzE/EMkAoIE6x+S9W1Yp+5AaEV5VWQ43OXIaUaSp2QrEFn14Zgh mhFKpRff9VIGxjuK6X1+oe8dF787VTqO8afgMZfbjfg0g22sA+dkK6LyfVWslt4jhGGA QHKZaWOBTqGpGf9rzCl5j1bz6yq8Z035Eaha2eyWgt4r6TbxaXfMTYshLIkMOPEeyEDw spdw== X-Gm-Message-State: AOJu0Yy1lla581xpza2Fuqql85M+fH/Rq9Wr9DdC40b9MuL8MLrqWkQV 9e97SM0lCte3By6fNBQtjAqZXlIlU/M= X-Google-Smtp-Source: AGHT+IGGlOFlAaM595OIjvmJSeeXYPmdFCLEwLvSvSLXr2FFhJwaZroMXoZ9gpqrPkPNnFDnolYhNA== X-Received: by 2002:a05:6808:1443:b0:3bb:821b:4b56 with SMTP id x3-20020a056808144300b003bb821b4b56mr17354475oiv.2.1703910187798; Fri, 29 Dec 2023 20:23:07 -0800 (PST) Original-Received: from smtpclient.apple (172-117-161-177.res.spectrum.com. [172.117.161.177]) by smtp.gmail.com with ESMTPSA id c12-20020a62e80c000000b006d5929810a6sm10879138pfi.83.2023.12.29.20.23.06 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 29 Dec 2023 20:23:07 -0800 (PST) X-Mailer: Apple Mail (2.3731.700.6) Received-SPF: pass client-ip=2607:f8b0:4864:20::231; envelope-from=casouri@gmail.com; helo=mail-oi1-x231.google.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, SPF_HELO_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01, T_SPF_TEMPERROR=0.01 autolearn=ham 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:314351 Archived-At: Hi, I=E2=80=99ve been working on a collaborative editing package on-and-off = for a while. I call it collab-mode. It=E2=80=99s far from complete but I want = to gather some early feedback (and find some people to test it). Yes, another collab editing package. I know there=E2=80=99s a pile of abandoned collab editing packages already, and whether it=E2=80=99s = really very useful is questionable in the age of google docs. Nevertheless, there seems to be some niche use-cases and I want to make something original. It is still very much a WIP so expect it to break a lot and maybe don=E2=80=99t post it on Reddit or HN :-) After all, I might never = complete and publish it. My goal for collab-mode is for it to be a p2p, cross-editor, real-time collab editing package (Emacs collab with Vim!). It works kind of like language servers (LSP): a local =E2=80=9Ccollab server=E2=80=9D (called = collab process) talks to the editor over JSONRPC, and collab processes talk among themselves over the internet. Most of the hard work is done by the collab process and the editor end should be relatively easy to implement. As of right now, collab-mode has these features: - Sharing a plain text file - Sharing a directory (still have rough edges) - Undo & redo (linear) - Builtin NAT traversal And it lacks: - Authentication and access control - Auto-resume from network breakage - Follow mode - Better error message and error handling in general - Documentation for writing a editor frontend - Any form of API stability whatsoever And obviously there=E2=80=99s no support for other editors yet. Getting started =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D I hope I didn=E2=80=99t scare everyone away, here=E2=80=99s how to try = it out: You can find the project at https://github.com/casouri/collab-mode You can either clone the repo and make session-1 to run the collab process (you need rust toolchain to compile it). Or download the pre-built binary from Releases [1], and run the server with RUST_BACKTRACE=3D1 RUST_LOG=3Ddebug ./collab-mode run --socket Then, load lisp/collab-mode.el, and M-x collab RET It=E2=80=99ll prompt for your name, and give you some options to = continue. Press: h to open the dashboard (hub) s to share the current buffer S to share a file or directory Let=E2=80=99s go to the hub first. The dashboard should look like this: +-----------------------------------------------------------+ |Connection: UP | |Connection type: (socket 7701) | |Accepting remote peer connections: NO | | | | | | | |=F0=9F=A7=9A No shared docs, not here, not now. | |Let=E2=80=99s create one, and here=E2=80=99s how! = | | | | | |PRESS + TO SHARE A FILE | |PRESS C TO CONNECT TO A REMOTE DOC | |PRESS A TO ACCEPT REMOTE CONNECTIONS (for 180s) | | | ------------------------------------------------------------+ You can share a file by pressing "+". It=E2=80=99ll open that file, = start collab-monitored-mode (which should flash green on success), and present the share link in the hub: +-----------------------------------------------------------+ |Connection: UP | |Connection type: (socket 7701) | |Accepting remote peer connections: YES | |Server at: wss://signal.collab-mode.org/c28c65c2-a02a-11e..| | | | | |=F0=9F=A7=9A Your file is shared, and here=E2=80=99s the link = | |Anyone can connect with just a click! | |LINK: wss://signal.collab-mode.org/c28c65c2-a02a-11ee-b1e..| | | | | |self | |shared-file.txt * | | | |PRESS + TO SHARE A FILE | |PRESS C TO CONNECT TO A REMOTE DOC | |PRESS A TO ACCEPT REMOTE CONNECTIONS (for 180s) | | | +-----------------------------------------------------------+ You=E2=80=99ll notice that the link starts with signal.collab-mode.org. = Does that mean your file is hosted on that server? No. The sharer hosts the file. This server is a _signaling_ server that I set up for NAT traversal, ie, to help setup the connection between collab processes. On another editor, go to the hub, type "C", and enter the link; collab-mode will connect to the other editor and open the shared file. It=E2=80=99ll open the buffer and start collab-monitored-mode (followed = by a green flash on success). Note that, when you share a file, your local collab process will be open for public connection for 3 minutes. During this time, since there=E2=80=99s no authentication right now, anyone that knows your = address (wss://signal.collab-mode.org/c28c65c2-...) can connect to you. If you want to accept remote connection again, press "A" in the hub. That=E2=80=99ll give you another 3 minutes. In the shared buffer =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D In the shared buffer, you can only use collab-mode=E2=80=99s undo and = redo function, which are bound to "C-/" and "C-.", respectively. You can also use undo-only and undo-redo, they are remapped to collab-mode=E2=80=99= s undo/redo commands. In the shared buffer, use collab-share-link to copy the share link to clipboard. In the hub buffer =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D I=E2=80=99ve setup eldoc for the hub buffer. When you leave point on a = doc, eldoc will show you the available commands for this doc. When things go wrong =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D When refreshing in the hub buffer (pressing "g"), if something goes wrong (can=E2=80=99t connect to local or remote collab process), the = error will be printed in the bottom. When in a shared buffer, if something goes wrong, the screen will flash red, and Emacs will show a warning detailing the error. In that case, if you can, please collect the warning and terminal logs and send them to me, so I can try to debug it. For the curious minds =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D There=E2=80=99s a README in src/README.md, it=E2=80=99s mostly for = myself so it=E2=80=99ll be hard to read for others. And before you ask, collab-mode doesn=E2=80=99t = use CRDT, it uses OT with tombstones. Help with rhymes =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D I hope you don=E2=80=99t find the fairy and her bad rhymes annoying. = I=E2=80=99m not very good at rhymes, chatgpt is even worse. If you can come up with better ones, please do send them along :-) [1] The prebuilt binaries are debug build, which are pretty large; the release build is much smaller (~6MB).