diff options
Diffstat (limited to '')
-rw-r--r-- | 2024/talks/gypsum.md | 284 |
1 files changed, 282 insertions, 2 deletions
diff --git a/2024/talks/gypsum.md b/2024/talks/gypsum.md index 1c3f0aa3..3ee5a75a 100644 --- a/2024/talks/gypsum.md +++ b/2024/talks/gypsum.md @@ -7,10 +7,289 @@ # Gypsum: my clone of Emacs and ELisp written in Scheme -Ramin Honary (he/him) - <mailto:ramin.honary@gmail.com> +Ramin Honary (he/him) + + - E-mail: <mailto:ramin.honary@gmail.com> + - ActivityPub: @ramin_hal9001@fe.disroot.org + - Website: <https://tilde.town/~ramin_hal9001> [[!inline pages="internal(2024/info/gypsum-before)" raw="yes"]] +## Slides + +### Introduction + +1. Ramin Honary + + - Emacs enthusiast since 2017 + + - Software developer (full stack) + + - I love Haskell, Scheme, functional programming + + - Started learning Scheme about 2 years ago + +2. My project: an Emacs Clone + + - Tentative name: "Gypsum" + - Its not a great name, open to suggestions. + +### Goal: to Clone **Emacs Lisp** + +- Many clones already: + + - Edwin, Jed, jEdit, Jove, Lem, MG, Yi, Zile + +- These only clone the key bindings, not Elisp + +- Only XEmacs (a fork of GNU Emacs) provided an alternative Emacs Lisp + +### Most people don't use Emacs for the keybindings + +- Anecodtal, but yes really. + +- Use Emacs because of the power of Emacs Lisp + +- Emacs is as powerful as a system shell + +- A good language is what makes it powerful + +### Goal: use R7RS Standard Scheme + +- I want it to work on a many Scheme implementations + +- Guile is the reference implementation + +- (more about this later) + +### Goal: able to run any `init.el` + +- Should be able to use `init.el` without significant changes + +- Many invest significant time in their configs + +- Suddenly not having your config is disruptive + +- Such an Emacs clone would be more useful + +### Why do this? + +- I personally like Scheme's minimalism. + +- Use Scheme as more than just an academic language. + +- Seems to be a lot of interest in a project like this. + +- Talk of "Guile Emacs" for about 30 years + +### A long history of Guile Emacs (1/3) + +- **Early 90s**: Initial discussion between RMS, Tom Lord, + Aubrey Jaffer, begin work on replacing Emacs Lisp with Scheme. + +- **1999--2009**: Ken Raeburn's [Guile-Based Emacs](https://www.mit.edu/~raeburn/guilemacs/). + (My project is similar.) + + > "*This project that I (Ken Raeburn) have started is for converting* + > *GNU Emacs to use Guile as its programming language. Support for* + > *Emacs Lisp will continue to exist, of course, but it may be* + > *through translation and/or interpretation; the Lisp engine itself* + > *may no longer be the core of the program.*" + +### A long history of Guile Emacs (2/3) + +- **2010**: Andy Wingo and Ludovic Courtes + take maintainership of Guile project. + +- **2009--2011**: Emacs Lisp interpreter implemented in Guile. + Still ships with Guile. + +- **2011**: Guile 2.0 is released + +- **2011--2015**: Robin Templeton's GSoC project. + (Is presenting later today!) + +### A long history of Guile Emacs (3/3) + +- **2020**: Vasilij Schneidermann published an overview called + "[The State of Emacs Lisp on Guile](https://emacsninja.com/posts/state-of-emacs-lisp-on-guile.html)". + +- **2020 to present**: Guile Emacs is dead? Andrea Corallo, GCC Emacs, + JIT-compiler for Emacs Lisp based on "libgccjit", brings into + question any need for combining Guile with Emacs. + +### Demo + +### GUI is barely working + +- I have almost no experience with Gtk or GObject Introspection + +- Hard to debug, crashes at C-level produce no stack traces + +- Using GDB requires rebuilding all of Gtk, GIO, GLib, etc. + +### Emacs Lisp parser based on Guile Emacs Lisp + +- Foked the Guile Emacs Lisp implementation for easier development + +- Have already submitted a patch to the parser upstream + +### Emacs Lisp interpter is barely working + +- Implementing my own interpreter in portable Scheme + +- Monadic pattern matcher + +### Can parse but not interpret "`subr.el`" + +- "`subr.el`" is the first ELisp file run by Emacs + +- A good way to determine what to work on first + +### A call for help + +### Latest Emacs has **1,393** built-in functions + +- I could never implement that many functions alone + +- Probably not all are required to create a useful editor + +### My job is to make contributing easy + +- Document the build and test process + +- Document the system architecture + +- Prioritize which built-in functions are most essential + +- Find low-hanging fruit, use as means to teach others + +### The work for which I will take responsibility + +- Clone enough Elisp to be able to run ERT tests + +- Then use GNU Emacs's own regression tests to test patches + +- Make sure there is a usable GUI + +- (Someday?) be able to contribute a patch from within + +### Quick architectural overview + +### The editor is based in Scheme, not Emacs Lisp + +- Config, scripting, packages all done in Scheme + +- Use of Emacs Lisp for scripting not encouraged + +- Should still be able to run your `init.el` + +- Ideally should be able to run ELPA packages + +### Difference with Robin Templeton's project + +- Guile-Emacs links Guile runtime into Emacs + +- Not a Scheme application + +- An IDE for Schemers + +### Emacs Lisp is an "environment" + +- "Environments" are a feature of Scheme + +- Scheme procedures can be called from Emacs Lisp + +- Scheme state can be mutated by Emacs Lisp + +- (See "`./gypsum/elisp-eval.scm`", "`new-env`") + +### "Functional Lenses" + +- Because R7RS does not standardize MOP (not even in "large") + +- Inspired by Haskell + +- Composes getters and setters + +- Single source file, easy to port + +- Ported to 3 other Schemes + +### A lot of work went into keymaps data structure + +- Keybindings are an important part of Emacs + +- Had to do this well from very beginning + +- Keybindings work correctly in demo + +### A lot of work went into separating GUI from Editor logic + +- "Parameters" are a feature of Scheme + +- Platform-specific APIs are always parameterized + + - Windowing and widgets + + - Translate key events to bindings + + - Evaluating Scheme expressions + + - Text buffering and rendering + +- (See "`./gypsum/editor-impl.scm`") + +### Monadic pattern matching + +- Simpler, more portable + +- (Not as feature-rich) + +- Easier than porting SRFI-241 ("Match") to Guile + +- No relation to SRFI-247 ("Syntatic Monads") + +- You can still use pattern matching + +### Monad pattern matching + +Example program + + + (define push-stack (put-with cons)) + (define collatz + (many + push-stack + (either + (try (check (λ (n) (<= n 1))) + (success)) + (try (check odd?) + (next (λ (n) (+ 1 (* 3 n))))) + (try (check even?) + (next (λ (n) (quotient n 2)))) + (fail "not an integer") + ))) + +### Conclusion + +- I am just getting the ball rolling + +- Helping others contribute is my top priority + +- ActivityPub :: `ramin_hal9001@fe.disroot.org` + +- E-mail :: <span class="spurious-link" + target="ramin.honary@gmail.com">*ramin.honary@gmail.com*</span> + +- Homepage :: <https://tilde.town/~ramin_hal9001> + +- Codeberg :: <https://codeberg.org/ramin_hal9001> + +- This presentation :: <https://emacsconf.org/2024/talks/gypsum/> + + +## Original presentation proposal I would like to demonstrate an Emacs clone I have been writing in Guile Scheme for the past year, which I am tentatively calling "Gypsum". Unlike other editors which @@ -79,7 +358,8 @@ spending most of my free time. I am only a Scheme programming enthusiast, I am not involved with Scheme professionally. - +You may also like another talk by this speaker: +[EmacsConf - 2022 - talks - Build a Zettelkasten with the Hyperbole Rolodex](https://emacsconf.org/2022/talks/rolodex/) [[!inline pages="internal(2024/info/gypsum-after)" raw="yes"]] |