|
| 1 | +# Telomare Mode for Emacs |
| 2 | + |
| 3 | +LSP-enabled major mode for the Telomare programming language, with support for Doom Emacs, Spacemacs, and vanilla Emacs. |
| 4 | + |
| 5 | +## Features |
| 6 | + |
| 7 | +Based on the Telomare LSP server capabilities: |
| 8 | +- **Syntax highlighting** via semantic tokens (keywords, comments, strings, numbers, operators) |
| 9 | +- **Hover information** showing expression evaluation and parse errors |
| 10 | +- **Go to definition** and **Find references** (via LSP) |
| 11 | +- **Rename symbol** support |
| 12 | +- **Parse error reporting** displayed on hover |
| 13 | +- **Comment support** (`-- comments`) |
| 14 | + |
| 15 | +## Installation |
| 16 | + |
| 17 | +### Prerequisites |
| 18 | + |
| 19 | +Ensure your Telomare LSP server is available at the configured path (default: `/home/hhefesto/src/telomare#lsp`). |
| 20 | + |
| 21 | +### Modular Configuration (4 files) |
| 22 | + |
| 23 | +Place all four files in a directory in your load-path. All variants require `telomare-mode-common.el`. |
| 24 | + |
| 25 | +#### Doom Emacs |
| 26 | + |
| 27 | +1. Place all files in `~/.doom.d/lisp/` |
| 28 | +2. Add to your `config.el`: |
| 29 | +```elisp |
| 30 | +(load! "lisp/telomare-mode-doom") |
| 31 | +``` |
| 32 | +3. Run `doom sync` |
| 33 | + |
| 34 | +#### Spacemacs |
| 35 | + |
| 36 | +1. Place all files in `~/.spacemacs.d/lisp/` |
| 37 | +2. Add to `dotspacemacs/user-config`: |
| 38 | +```elisp |
| 39 | +(add-to-list 'load-path "~/.spacemacs.d/lisp/") |
| 40 | +(require 'telomare-mode-spacemacs) |
| 41 | +``` |
| 42 | +3. Ensure the `lsp` layer is enabled in `dotspacemacs-configuration-layers` |
| 43 | + |
| 44 | +#### Vanilla Emacs |
| 45 | + |
| 46 | +1. Place all files in `~/.emacs.d/lisp/` |
| 47 | +2. Add to your `init.el`: |
| 48 | +```elisp |
| 49 | +(add-to-list 'load-path "~/.emacs.d/lisp/") |
| 50 | +(require 'telomare-mode-vanilla) |
| 51 | +``` |
| 52 | +3. Install lsp-mode if not present: |
| 53 | +```elisp |
| 54 | +(package-install 'lsp-mode) |
| 55 | +``` |
| 56 | + |
| 57 | +## Configuration |
| 58 | + |
| 59 | +### Customizing the LSP Command |
| 60 | + |
| 61 | +```elisp |
| 62 | +;; Use a different nix path |
| 63 | +(setq telomare-lsp-command '("nix" "run" "/path/to/your/telomare#lsp" "--")) |
| 64 | +
|
| 65 | +;; Use a local binary |
| 66 | +(setq telomare-lsp-command '("/usr/local/bin/telomare-lsp")) |
| 67 | +``` |
| 68 | + |
| 69 | +## Key Bindings |
| 70 | + |
| 71 | +### Doom Emacs |
| 72 | +- `SPC m g` - Go to definition TODO: improve |
| 73 | +- `SPC m G` - Find references |
| 74 | +- TODO: `SPC m h` - Describe at point (hover) |
| 75 | +- TODO: `SPC m r` - Rename symbol |
| 76 | + |
| 77 | +### Spacemacs |
| 78 | +- `SPC m g` - Go to definition TODO: improve |
| 79 | +- `SPC m G` - Find references |
| 80 | +- TODO: `SPC m h` - Describe at point (hover) |
| 81 | +- TODO: `SPC m r` - Rename symbol |
| 82 | + |
| 83 | +### Vanilla Emacs |
| 84 | +- `M-.` - Go to definition |
| 85 | +- `M-?` - Find references |
| 86 | +- TODO: `C-c h` - Describe at point (hover) |
| 87 | +- TODO: `C-c r` - Rename symbol |
| 88 | + |
| 89 | +## Troubleshooting |
| 90 | + |
| 91 | +1. **LSP not starting**: Test your LSP command in terminal: |
| 92 | + ```bash |
| 93 | + nix run /home/hhefesto/src/telomare#lsp -- |
| 94 | + ``` |
| 95 | + |
| 96 | +2. **Check LSP status**: With a `.tel` file open, run: |
| 97 | + - `M-x lsp-describe-session` |
| 98 | + |
| 99 | +3. **View LSP logs**: Check the `*lsp-log*` buffer for errors |
| 100 | + |
| 101 | +## File Structure |
| 102 | + |
| 103 | +- `telomare-mode-common.el` - Core mode definition and LSP client registration |
| 104 | +- `telomare-mode-doom.el` - Doom Emacs specific keybindings and setup |
| 105 | +- `telomare-mode-spacemacs.el` - Spacemacs specific keybindings and setup |
| 106 | +- `telomare-mode-vanilla.el` - Vanilla Emacs minimal configuration |
0 commit comments