Tutorials on writing a text editor in Scheme?

Hello everyone,

there is a somewhat popular booklet on writing a text editor in around 1000 thousand lines of C: Build Your Own Text Editor

There is also a new ‘rewrite’ using Rust: hecto: Build Your Own Text Editor in Rust | philipp's blog

I was wondering if anyone knows of anything similar using Scheme or another Lisp? :slight_smile:
Or maybe any other starting points I should check out if I want to write my own text editor in Scheme?

Thanks in advance.

1 Like

if you get guile-gi going then you have access to any gobject library, which includes gtk
from there you can use a text view widget and go from there
although be warned, if on guix, guile-gi is funky rn

1 Like

ik lots of terminal based rust progs use ratatui, maybe something similar exists, as in an iteration on ncurses

1 Like

Helix editor is written in rust, but it is going to add steel scheme as the scripting language.

If you want to script in scheme, then you just need to wait on helix editor.

1 Like

Thanks, but the idea is more about writing a text editor just as a pet project/learning experience. It is cool that Helix wants to use a scheme though.

Is ncurses outdated? I saw the Lem Editor using it so I thought it might be the way to go.

ncurses is outdated. You might want to find alternatives, or make a TUI library yourself.

g-golf ( gobject introspection for guile) totally works on guix for me now
So you can use gtk and a text view widget

Hey @sls,
this was the closest I found, while searching for the same thing: Joel Lord

1 Like

You can already script GNU TeXmacs (not just / not strictly an editor) with Guile, or its friendly fork, Mogan, with S7.

Starting points

When I try to install TeXmacs in gentoo, it is masked - only supports guile up to 1.8?

Yes, they will soon be bundling Guile 1.8 with TeXmacs. You can try Mogan, which ships with S7. Massimiliano Gubinelli has a Guile 3 branch and I don’t know why this did not become the official approach for GNU TeXmacs.

Maybe this thread and the blog post it references will help you.

Thanks everyone for your input. Looks like there has been some progress about the general idea of a scheme based text editor.

No only has the guile-emacs project started again but there is also A clone of Emacs and Emacs Lisp written in R7RS Scheme being developed.

I also found this older project of someone using chicken scheme for a text editor.
Than there also another text editing project (hatis) but it seems to now be using common lisp.

The future of any of these projects is relatively unclear but I am collecting them here anyway for inspiration :slight_smile:

1 Like