doom-emacs/README.md
2025-12-09 11:23:13 +03:00

146 lines
2.8 KiB
Markdown

# Doom Emacs Configuration
Personal Doom Emacs configuration for Erlang/OTP and LFE development.
## Quick Start (Using This Repo)
```bash
# 1. Install Emacs first (see macOS Installation below)
# 2. Install Doom Emacs
git clone https://github.com/doomemacs/doomemacs ~/.config/emacs
# 3. Clone this config
git clone git@git.hitech.fast:hitech/doom-emacs.git ~/.config/doom
# 4. Run doom install/sync
~/.config/emacs/bin/doom install
doom sync
# 5. Add shell setup to ~/.zshrc (see Shell Setup section)
```
## macOS Installation
### Emacs Mac Port
```bash
brew tap railwaycat/emacsmacport
brew install emacs-mac --with-imagemagick --with-modern-icon --with-modules
```
### Doom Emacs
```bash
git clone https://github.com/doomemacs/doomemacs ~/.config/emacs
~/.config/emacs/bin/doom install
```
### Shell Setup (.zshrc)
```bash
# Emacs
export EMACSPATH=$HOME/.config/emacs
export PATH="$EMACSPATH/bin:$PATH"
# Daemon auto-start
if ! pgrep -U "$USER" -x "emacs" > /dev/null; then
emacs --daemon &> /dev/null &
fi
alias e='emacsclient -t -a ""' # terminal
alias ec='emacsclient -c -a ""' # GUI
```
### Other Tools
```bash
brew install ag # silver searcher (for doom)
brew install just # command runner
```
## Prerequisites
### Language Servers
#### erlang_ls
Erlang Language Server - starts automatically via eglot.
```bash
# Install via releases or build from source
# https://github.com/erlang-ls/erlang_ls
```
Current location: `~/.local/bin/erlang_ls`
#### lfe-ls
LFE Language Server - **must be started manually** before opening LFE files.
```bash
# Start the server (listens on localhost:10567)
lfe-ls
```
Current location: `~/.local/bin/lfe-ls`
### Other Tools
- **just** - Command runner (`brew install just`)
## Files
| File | Purpose |
|------|---------|
| `init.el` | Doom modules (erlang, elixir, etc.) |
| `config.el` | Personal configuration |
| `packages.el` | Additional packages |
| `custom.el` | Emacs customize settings |
## Key Configurations
### Erlang
- Auto-starts `erlang_ls` via eglot when opening `.erl` files
- Enabled in `init.el`: `erlang`
### LFE (Lisp Flavoured Erlang)
- Connects to `lfe-ls` on `localhost:10567`
- **Requires manual start**: run `lfe-ls` in a terminal first
- Syntax highlighting via `lfe-mode`
### Justfile
- `just-mode` for syntax highlighting
- `SPC j` to run recipes via `justl`
### UI
- Theme: `doom-one`
- Transparency: 85% (requires Emacs 29+)
- Line numbers enabled
## Usage
```bash
# Sync doom after changes
doom sync
# For LFE development, start lfe-ls first
lfe-ls &
# Then open Emacs
emacs
```
## Troubleshooting
### eglot can't connect to lfe-ls
Make sure `lfe-ls` is running:
```bash
lfe-ls
# Should show: port: {ok,10567}
```
### erlang_ls not found
Ensure it's in PATH:
```bash
which erlang_ls
# Should return ~/.local/bin/erlang_ls or similar
```