GNU TeXmacsUser manualReferenceAboutEnglish
Collaboration, the TeXmacs server and versioning

1.Introduction

TeXmacs contains a small client/server system which allows several users to store documents on a shared server, to exchange messages, to share resources and to edit “live” documents together. The same TeXmacs binary plays both roles: an instance started in server mode listens on a TCP port and answers requests, while ordinary instances connect to one or more servers as clients. Independently of the server, TeXmacs also provides tools for comparing two versions of a document and a thin integration with the external version control systems Subversion and Git.

This chapter describes how these facilities are implemented. It is aimed at developers who want to understand, debug or extend them. For the user point of view, see the user manual chapters Setting up a TeXmacs server and Remote tools and collaborative editing.

2.Architecture overview

2.1.Who runs what

A TeXmacs server is a normal TeXmacs process (usually started with the -server command line option, possibly together with -headless) in which the Scheme modules under

progs/server/

have been loaded. A client is any TeXmacs process in which the modules under

progs/client/

are loaded; they are loaded lazily, the first time the user opens a remote menu or a remote tmfs URL (see the lazy-define, lazy-menu and lazy-tmfs-handler declarations in

init-texmacs.scm

). One process may simultaneously be a server and a client of other servers (or of itself).

The work is split between C++ and Scheme as follows:

2.2.Map of the source files

Transport (C++)
System/Link/client_server.hpp

,

texmacs_server.cpp

,

texmacs_client.cpp

,

tm_link.cpp

(packet framing and legacy encryption),

tm_contact.hpp

, socket_contact.*, Plugins/Qt/QTMSockets.* (non blocking sockets driven by QSocketNotifier), Plugins/Gnutls/gnutls.* (TLS contacts, certificates, PBKDF2). The Scheme glue is declared in

Scheme/Glue/build-glue-basic.scm

.

Server (Scheme)
server/server-base.scm

(dispatcher, accounts, login),

server-authentication.scm

(preferences, logs, password encodings),

server-tmfs.scm

(remote file system and server side versions),

server-db.scm

(remote database access),

server-sync.scm

and

server-db-sync.scm

(synchronization),

server-live.scm

,

server-chat.scm

,

server-notifications.scm

,

server-cache.scm

(tree cache),

server-backup.scm

,

server-widgets.scm

and

server-menu.scm

(user interface), plus the regression tests server-*-test.scm and

server-fixtures.scm

. The file

server/todo.tm

contains the original design notes.

Client (Scheme)
client/client-base.scm

(dispatcher, connections, accounts, login),

client-authentication.scm

,

client-tmfs.scm

(remote file browser and tmfs handlers),

client-db.scm

,

client-sync.scm

,

client-db-sync.scm

,

client-live.scm

,

client-chat.scm

,

client-notifications.scm

,

client-remote-config.scm

(remote administration of server preferences),

client-widgets.scm

,

client-menu.scm

and

client-markup.scm

.

Live documents
utils/relate/live-document.scm

(states and histories),

live-connection.scm

(remote peers and conversion between patches and lists of modifications),

live-view.scm

(views of a live document inside ordinary buffers), and the markup in

packages/utilities/live.ts

and

packages/miscellaneous/live-document.ts

.

Versioning
version/version-tmfs.scm

(dispatch to back-ends, tmfs handlers for histories and revisions),

version-svn.scm

,

version-git.scm

,

version-compare.scm

(structural diff),

version-edit.scm

and

version-drd.scm

(editing of differences),

version-menu.scm

and

version-kbd.scm

. The markup for differences is defined in

packages/standard/std-fold.ts

.

Patches and undo (C++)
Kernel/Types/modification.hpp

, Data/History/patch.*,

commute.cpp

, archiver.*, and

kernel/library/patch.scm

on the Scheme side.

2.3.Status of the various parts

The code base has been developed over a long period (initial design in 2007 and 2013, TLS and authentication in 2022, accounts, notifications, tree cache and backups in 2025–2026), and its parts have different levels of maturity:

The individual sections indicate more precisely what is implemented.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation License".