Skip to content

Latest commit

 

History

History
97 lines (73 loc) · 3.36 KB

File metadata and controls

97 lines (73 loc) · 3.36 KB

CLAUDE.md - Lem Editor

Lem is a text editor written in Common Lisp with multiple frontend support (terminal, GUI, browser).

Quick Reference

# Build and run
make sdl2          # GUI version
make ncurses       # Terminal version

# Development
qlot install       # Install dependencies
make test          # Run tests

Project Structure

src/                    # Core editor
├── lem.lisp            # Entry point
├── buffer/             # Text buffer system
├── window/             # Window management
├── mode.lisp           # Mode system
├── keymap.lisp         # Key bindings
├── defcommand.lisp     # Command definition
└── interface.lisp      # Frontend abstraction

frontends/              # UI implementations
├── sdl2/               # Desktop GUI
├── ncurses/            # Terminal
└── webview/            # Browser-based

extensions/             # Language modes (50+)
├── lisp-mode/          # Common Lisp with REPL
├── lsp-mode/           # LSP client
└── vi-mode/            # Vim emulation

Architecture

Four-layer design: Frontends → Interface (lem-if:*) → Core → Extensions

Key abstractions:

  • Buffer: Text storage with points, marks, undo history
  • Window: Buffer display, organized in tree (splits) or floating
  • Mode: Major (one per buffer) + Minor (multiple, toggleable)
  • Command: Interactive operation via define-command

Coding Standards

This project uses code-contractor for automated PR review. code-contractor is a GitHub App that validates pull requests against rules defined in contract.yml.

All coding standards are defined in contract.yml at the repository root. Refer to it for:

  • Package and file structure rules
  • Documentation requirements
  • Style conventions (loop syntax, error handling, etc.)
  • Functional programming guidelines

Key Files for Common Tasks

Task Files
Add command src/defcommand.lisp for macro, src/commands/ for examples
Add mode extensions/ for examples, inherit language-mode
Add frontend src/interface.lisp for protocol, frontends/ for impl
Buffer ops src/buffer/internal/buffer.lisp, src/buffer/internal/edit.lisp
Window ops src/window/window.lisp

Development Notes

  • Use lem-core package symbols, avoid lem:: internal access
  • Frontends implement lem-if:* generic functions
  • Modes register via define-major-mode / define-minor-mode
  • Commands register via define-command with argument descriptors

Configuration

User config locations (in order):

  1. $LEM_HOME/init.lisp
  2. ~/.config/lem/init.lisp
  3. ~/.lem/init.lisp
  4. ~/.lemrc

Documentation

Recent Changes

  • 001-multi-language-canvas: Added Common Lisp (SBCL), tree-sitter-cl FFI bindings + lem/core, tree-sitter-cl, lem-call-graph (existing), lem-tree-sitter
  • 001-multi-language-canvas: Added [if applicable, e.g., PostgreSQL, CoreData, files or N/A]

Active Technologies

  • Common Lisp (SBCL), tree-sitter-cl FFI bindings + lem/core, tree-sitter-cl, lem-call-graph (existing), lem-tree-sitter (001-multi-language-canvas)
  • N/A (in-memory graph structures, optional position caching) (001-multi-language-canvas)