achempion

achempion

Emacs like text editor in Elixir

I’ve been using Emacs as my main code editor for more than a two years. It’s a custom build version although I’ve tried doom emacs and spacemacs for some time.

Previously I used VS Code, Idea, Sublime, Vim, Notepad++ (10 years ago) and I maybe something else which I forgot.

I’ve been playing with idea about writing some bare-bones editor which runs as mix application where you just clone the repository and can extend it as you wish by writing different OTP modules.

Recently, I discovered GitHub - ndreynolds/ratatouille: A TUI (terminal UI) kit for Elixir · GitHub library with a simple DSL to write console applications and decided to give my idea a go.

It’s still an early stage and more like proof of concept but here it is: GitHub - achempion/alice: Text editor · GitHub, I hope to reach stage when it starts to be usable for simple edits.

In order to make consistent progress I decided to also try streaming development and all the issues I’m trying to figure out on twitch channel Twitch, for this year I want to stream each day at CET 8 p.m for an hour or so, would appreciate any feedback.

Most Liked

JediLuke72

JediLuke72

Hi achempion - I am so glad you posted this here, for I think we share a vision. I was also a heavy user of vim & emacs, always had my own large .vim_rc / init.el file, and it was a constant project to improve and maintain it. One day I had the epiphany that if I was going to spend the rest of my life hacking away on editors, then I absolutely didn’t want to be doing it in elisp/vimscript!! So about 2 years ago I began a project which I think shares a vision with your own, it’s called Flamelex, and I have a small video I just made which goes over some of the functionality I have built so far:

https://github.com/JediLuke/flamelex

As you can see, I decided to proceed by basing my project on the Scenic graphics lib (https://www.youtube.com/watch?v=1QNxLNMq3Uw) - Scenic is fast approaching v1.0, Boyd has put a ton of work in over the last year or so as well. It is fast & easy to work with, and capable.

The above video does a good job of showing of functionality, but I confess, it’s a choreographed demo - so far in this project’s journey, I have spent a lot of time working on low-level components and doing hacky investigation type implementations, just to learn how to attack all the problems at hand. I am now at a point where many problems have been solved in a “proof of concept” manner (not all, e.g. I want to have re-arrangable split panes, and need to introduce a layering system so I can have notifications and so the menu bars work correctly) - but my major focus for next year is going to be trying to refactor & condense this functionality down into a stable, testable, properly debugged piece of desktop software. There’s a whole bunch of extra functionality I would love to make, e.g. a git interface like magit, and a directory tree off to the side, but for now I think I am going to try and shore up some of the bugs that exist, and try to fit the code into a more cohesive general architecture.

Editing is one big part of Flamelex, but if you check out this talk I recently gave at the Denver elixir meetup (https://www.youtube.com/watch?v=ahyH5EqSDwk&t=0s) - I have actually spent the biggest chunk of my effort building the “Memex” - a personal knowledge base that’s integrated within the software. It’s analogous to org-mode, but instead of markup files it’s using a back-end which is based on the data-model used by TiddlyWiki. Check the video out for more, I’m just highlighting that this has actually been a decent chunk of work, and now that it’s more or less done, I am back to fixing up the editing experience & other parts of the app.

Personally for my money, I think writing apps in a free-form graphics package like Scenic is the way to go. You have total freedom to present things however you want, including nice curves and animations. Scenic even supports sprites, people have made some cool games in it. It’s also very fast & capable, you can see from that video that it’s very snappy and I honestly haven’t even done any optimization yet. Of course there will always be a place in this world for terminal based editors, but in my own career I am an elixir developer through and through, I try to stay away from anything that I will need to SSH in to other boxes :smiley: so having a dedicated local IDE/editor meets my needs perfectly (it’s of course not impossible to shoe-horn a shell into Flamelex, but, not yet :wink: )

It would be great to get in touch and discuss the issues, and see how we can maybe help each other :slight_smile: if you are dedicated to the terminal-based approach, there is likely still a lot of useful libraries we can share (e.g. my VimServer is only partially implemented, but it’s pure Elixir, I don’t port-out to neovim or anything). Or if you’re simply trying to calcify your vision & get the Elixir-based editor of your dreams, I would be happy to catch up on a video call or something, help you pull the repo and get it running, step you through the code etc… I’m 2 years in, so that’s a good head-start, plus open-source lives on passionate programmers who want to scratch their own itch - if this project fits your vision too, perhaps it can give you a massive head-start, and we can work together to get where we both want to go even faster !

If you want to get in touch, even just to chat about editors in general, send me a DM here or you can each me on the Elixir Slack, my handle is JediLuke and I like to hang out in scenic

  • Luke
JediLuke72

JediLuke72

Hey achempion, cheers :smiley: it has been an on-and-off side-project for me for a while now, but about 5 months ago Scenic put out a new major release (v0.11-beta) and since then I have been working on it during all my spare-time coding hours. You managed to find a lot of bugs, I assure you there are even more of them you didn’t find :smiley: I will get to work on fixing the one you reported (thankyou so much for this!).

It was awesome to watch your stream back and see someone in real-time interacting with software I wrote, really it was quite a thrill :smiley: I will definitely check back in with you on twitch! I really like your project too, and as you saw I think we can have a lot of crossover - we have both implemented Buffer behaviours and I’m sure so much else.

Going forward, my main focus is to re-write from scratch the actual text_box component (which you found in neo_text_box.ex) and do it correctly, with new knowledge I’ve developed as I go about how to use Scenic correctly. This is a fairly complex problem when you have to implement it from scratch, and there are a few fairly distinct use-cases for one piece of code, e.g. I want to be able to support internal scrolling, resizing and wrapping of text, depending on opts that get passed in - I need to satisfy all these use cases in order to have one generic text-box component across the entire application, and it should become a re-usable component for the entire Scenic community. It should also support multi-mode (i.e. vim) editing, but that will probably come after/seperately.

Will keep you updated - keep streaming, I will check back in, and when I’ve fixed up some of these issues over the holidays maybe we can revisit it :smiley: again, was super fun for me to watch you interact with Flamelex, I learned a lot and Flamelex will benefit a lot even just from users like you trying it out and sharing feedback! Let me know when you want someone to try out alice for the first time, I will gladly return the favor :slight_smile:

thiagomajesk

thiagomajesk

Cool project @achempion

This reminds me of this talk I’ve watched recently:

I was just thinking about it this week.

BTW: Just out of curiosity, have you benchmarked your editor against other editors? I’d love to know how viable is to create a full-fledge text editor in elixir.

Where Next?

Popular in Discussions Top

Rustixir
Hi everyone, im working on find best language/framework/system for high concurrency, high performance and stable performance after wor...
New
owaisqayum
I have a sample string sentence = "Hello, world ... 123 *** ^%&*())^% %%:>" From this string, I want to only keep the integers, ...
New
mmmrrr
Just saw that dhh announced https://hotwire.dev/ Is it just me or is this essentially live view? :smiley: Although I like the “iFrame-e...
New
AstonJ
I’ve just started the Phoenix part of the utterly brilliant online course by @pragdave. On generating the Phoenix app he uses the --no-ec...
New
crabonature
I’m still quite new to Elixir. As I understand we got in Elixir “multi guards” as convention to simplify one large guard with or’s?: de...
New
eteeselink
Hi all, In the last days, two things happened: A blog post titled “They might never tell you it’s broken” made the rounds. It’s about ...
New
klo
Got a question about when to concat vs. prepending items to list then reversing to achieve appending. So i know lists boil down to [1 | ...
New
chulkilee
Here are the list of HTTP client libraries/wrappers, and some thoughts on HTTP client in general. I’d like to hear from others how they w...
New
wmnnd
The Go vs Elixir thread got me thinking: Would it be too hard to implement a simple mechanism for creating Go-style static app binaries f...
New
pdgonzalez872
If this has been asked here before, please point me to where it was asked as I didn’t find it when I searched the forum. Maybe a mailing ...
New

Other popular topics Top

chrismccord
As promised, the first release candidate of Phoenix 1.3.0 is out! This release focuses on code generators with improved project structure...
New
albydarned
Hello all! I am typing this post from my new MacBook Pro with the M1 chip. I’m loving it so far, and will probably use it as my daily dr...
New
lessless
I believe there are people here who are dealing with CSV files import on the daily basis, and since Excel is a really popular tool there ...
New
AngeloChecked
What learn first? Rust or Elixir Hi Elixir community! I’m here because i want learn a new language. I’m a junior developer and mainly i ...
New
gausby
I asked this very same question on twitter and got some interesting feedback, but I thought it would be a good question to ask here as we...
1207 39523 209
New
aalberti333
As the title describes, I’m trying to run Enum.map() over a list of key/value pairs, where the value is a map. My data looks like this: ...
New
saif
Hello everyone, Long time lurker first time poster here. I’ve recently begun working on Elixir full-time again! :raised_hands: It’s been...
New
dogweather
I wrote this comment on r/haskell, and it’s not popular there. :wink: But I think I’m on to something… Haskell reminds me of Java, and e...
New
dokuzbir
I want to highlight html closing tags when i click a html tag. That works in .html files but doesnt work for html.eex templates. How can...
New
svb
Hi! Currently I want to submit a form by pressing the Enter key. However, since my input field is of type “textarea” this is just adds a...
New

We're in Beta

About us Mission Statement