Writing a Programmers Editor (Modes & Extensibility) - Part 11
Draft — not yet published.
In Part 10 we will have undo/redo. The editor can hold text, display it, search it, highlight it, and undo mistakes. Now we arrive at the question that started this whole series in Part 1: how much power should the user have?
This part covers:
- Major modes: language-specific behaviour (Scheme mode, C mode, Markdown mode). How the editor switches behaviour based on file type.
- Minor modes: optional, composable features (auto-indent, line numbers, flymake). Multiple minor modes can be active simultaneously.
- Hooks: extension points where user code runs at specific events (before-save-hook, post-command-hook, etc.).
- The scripting layer: exposing the editor's internals to user Scheme code.
This is the "
100%power" promise — the same language that built the editor extends it. - Comparison with emacs' elisp layer and vim's vimscript.
- Implementing a mode system and hook mechanism in Scheme.
This is the part that answers the original question. If the editor is written in Scheme and the user scripts it in Scheme, there is no power gap. The runtime is the extension language.
Watchout for this assay when it is published, till then.
Shorel'aran
Writing a Programmer's Editor
A series of assays on building a programmable text editor from scratch in Scheme — exploring the balance of power between the C runtime and the scripting language, data structures, terminal I/O, and extensibility.
- 1 Writing a Programmers Editor - Part 1 2018-08-06
- 2 Writing a Programmers Editor (DS/Gapbuffer) - Part 2 2018-08-11
- 3 Writing a Programmers Editor (Gap Buffer in Scheme) - Part 3 Draft 2018-08-18
- 4 Writing a Programmers Editor (Lines & Display) - Part 4 Draft 2018-08-25
- 5 Writing a Programmers Editor (Terminal I/O & Raw Mode) - Part 5 Draft 2018-09-01
- 6 Writing a Programmers Editor (Keymaps & Input Handling) - Part 6 Draft 2018-09-08
- 7 Writing a Programmers Editor (Rendering & Redisplay) - Part 7 Draft 2018-09-15
- 8 Writing a Programmers Editor (Search & Replace) - Part 8 Draft 2018-09-22
- 9 Writing a Programmers Editor (Syntax Highlighting) - Part 9 Draft 2018-09-29
- 10 Writing a Programmers Editor (Undo/Redo & Command Log) - Part 10 Draft 2018-10-06
- 11 Writing a Programmers Editor (Modes & Extensibility) - Part 11 Here 2018-10-13
- 12 Writing a Programmers Editor (Reflections & Lessons) - Part 12 Draft 2018-10-20
Responses