~sforman/Xerblin

An experiment in user interface design.
6 days ago
8 days ago

#Xerblin

An experiment in user interface design.

Xerblin is an IDE for the Thun dialect of Joy. It's essentially a text editor with a Joy interpreter that works on files in a Git repository and that autosaves all edits and state changes.

The project is hosted at Sourcehut.

It's kind of a mess right now. I'm cleaning it up (March, 2024.)

#Introduction

Right now this is a script (called xerblin) that uses the library package (also called xerblin) to build a simple IDE.

Out of Date! Documentation at ReadTheDocs

#Installation

#Install Thun

First get the latest version of Thun:

$ git clone https://git.sr.ht/~sforman/Thun

or from the mirror:

$ git clone https://github.com/calroc/Thun.git

There are several implementations in various languages. If you have Python installed already then the easiest thing to do is copy the implementations/Python/joy.py file to some directory on your PYTHONPATH (or set PYTHONPATH to your local Thun/implementations/Python directory.)

I used to use pip install --user --editable . but now it doesn't work. The Python folks are deprecating the use of setup.py install but it's not yet clear to me what to replace it with, so I'm waiting another year or two for the commotion to settle. They're actively working on it, so some time in the near future this should be on PyPI again. In the meantime, I just set PYTHONPATH, see below.

#Install Dulwich

Next, install the one (non-Thun) dependency, the Dulwich Git-in-Python library:

$ pip install dulwich

#Install Xerblin

Once you have Thun you can clone the Xerblin repo and install it:

$ git clone https://git.sr.ht/~sforman/Xerblin

Again, this is where I would like to use pip install --user --editable ./Xerblin but it's not working right now, so instead I copy the Xerblin/scripts/xerblin script to ~/bin (or somewhere else on PATH) and add the Xerblin/xerblin directory to PYTHONPATH.

E.g. (in bash, assuming the repos are cloned into your home directory):

$ export PYTHONPATH=$HOME/Thun/implementations/Python:$HOME/Xerblin
$ cp $HOME/Xerblin/scripts/xerblin  ~/bin/xerblin

In sum, you add the xerblin dir to your PYTHONPATH and copy the xerblin script in your PATH somewhere and you should be good-to-go.

#Using Xerblin

Start the script, it will create the default repo JOY_HOME in ~/.xerblin and tell you about it:

$ xerblin 
INFO:root:Creating JOY_HOME '/home/USER/.xerblin'
INFO:root:no repository in '/home/USER/.xerblin'
INFO:root:initializing repository in '/home/USER/.xerblin'
INFO:root:using repository in '/home/USER/.xerblin'
INFO:root:log exists and is tracked.

You should see something like this:

A pair of windows: the stack viewer and the log text viewer.

Note the log viewer window's title bar: "#484c80a9ea - log.txt". The first part of the title is actually the prefix of the Git hash of the text file. If you edit the log window you'll see an asterisk appear in front of the hash to indicate that the contents of the text viewer are out-of-sync with the underlying file. Once you stop editing, after a brief pause, Xerblin will auto-save the file and commit it to Git, and the hash will change to the latest hash (and the asterisk will disappear.)

That's one of the main points about Xerblin: all changes are saved to the Git repository history, whether they are due to the user editing a file or executing a command word.

Continue with the User Guide.

#Notes

In re: the Tcl/Tk text widget (see also the Tkinter Text wrapper docs):

  • It's a very well-developed text widget (e.g. undo is baked-in.)
  • I've already written the shim code to make it respond to three-button mouse chords. (The amount of work it would take to redo that in e.g. Red lang's GUI widgets is more than I want to spend. Also, of all the code I've written over the years the xerblin\gui\mousebindings.py file is the longest-serving, having existed more-or-less in it's current form for over fifteen years. I have feels.)

Copyright © 2020, 2022, 2023 Simon Forman

Xerblin is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

Xerblin is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with Xerblin. If not see http://www.gnu.org/licenses/