October 11, 2019

Text Editor Day 5

I'm challenging myself to code every day live on Twitch. I've always wanted to take a stab at writing my own text editor.

I'm inspired by emacs. I love that emacs is a complete elisp interpreter that can then be extended in all sorts of useful ways.

I also think working with plain text (rather than binaries or data structures or windows or guis) is the most productive and powerful way to get a computer to do what you want it to do.

So, ideally, I'd like to create a platform similar to emacs, but instead of elisp, I'd like it to be complete clojure(script) environment.

So far it's going ok, I was able to create a very basic electron project, and was able to setup shadow-cljs to complile use clojurescript to control the main and renderer processes.

The past 2 days I've started implementing a text editor using reagent components. So far, I can write text to the screen and the cursor sort-of, kind-of get's positioned to the correct location.

The challenge will be how to calculate the exact position of the cursor and battling all the subtle nuances of the dom, and css, and measurement of dom elements.

I'm worried that I'll get pulled down the rabbit hole of learning how react works. And I'm worried that learning react will take me away of actually building a working text editor. For example, today, the react component was updating hundreds of times a minute for apparently no reason?!! ... and ot sure why. I might re-think and use something other than react, but I'd very much like to use a functional library for managing the dom, so, we'll see.

But all in all, learned a ton this week and I'm getting more comfortable with the whole Twitch thing. More to come .. stay tuned!

Tags: programming clojurescript personal development