elt-ask
: Ask questions directly (C-c l a)elt-explain
: Explain selected text with context (C-c l e)elt-rewrite
: Rewrite selected text with style options (C-c l r)elt-translate
: Translate selected text (C-c l t)
- Async requests: Won't block Emacs while waiting for responses
- Context awareness:
elt-explain
includes surrounding code for better understanding - Flexible response handling: Can insert directly or show in separate buffer
- Error handling: Graceful handling of network issues and API errors
- Customizable: All settings via
defcustom
- Health check:
elt-check-ollama
to verify connection
- Save as
elt.el
in your Emacs config directory - Add to your init file:
(load "path/to/elt.el") (elt-enable) ; Enable globally
- Make sure Ollama is running:
ollama serve
- Customize the model:
M-x customize-group RET elt RET
Here is an example of how you can configure elt.el
in your init.el
file. You will need to adjust the path to elt.el
to match your system.
Core Features
elt-ask
: Ask questions directly (C-c l a)elt-chat
: Start an interactive chat session (C-c l x)elt-explain
: Explain selected text with context (C-c l e)elt-rewrite
: Rewrite selected text with style options (C-c l r)elt-translate
: Translate selected text (C-c l t)
- Async requests: Won't block Emacs while waiting for responses
- Context awareness:
elt-explain
includes surrounding code for better understanding - Flexible response handling: Can insert directly or show in separate buffer
- Error handling: Graceful handling of network issues and API errors
- Customizable: All settings via
defcustom
- Health check:
elt-check-ollama
to verify connection
- Save as
elt.el
in your Emacs config directory - Add to your init file:
(load "path/to/elt.el") (elt-enable) ; Enable globally
- Make sure Ollama is running:
ollama serve
- Customize the model:
M-x customize-group RET elt RET
Here is an example of how you can configure elt.el
in your init.el
file. You will need to adjust the path to elt.el
to match your system.
;; 1. Add elt.el to your Emacs load-path
;; Replace the path with the actual location of your elt.el file.
(add-to-list 'load-path "/Users/risent/Code/github/elt.el/")
;; 2. Load the library
(require 'elt)
;; 3. Customize variables (optional)
;; Here are some common settings you might want to configure.
;; Set your preferred LLM provider ('ollama, 'openai, or 'openrouter)
(setq elt-provider 'ollama)
;; Set the model for your chosen provider
(setq elt-ollama-model "llama3")
;; (setq elt-openai-model "gpt-4o")
;; Configure the SOCKS5 proxy (if you need one)
;; (setq elt-socks-proxy "localhost:9050")
;; Decide how translations are displayed
;; Set to 't to use a popup, or 'nil to insert the translation directly.
(setq elt-translate-use-popup t)
;; Control whether responses are inserted directly or in a separate buffer
;; 't = insert at point, 'nil = use a separate buffer
(setq elt-insert-response-directly nil)
;; 4. Enable the minor mode to activate the keybindings
(elt-mode 1)
;; You can now use the keybindings, such as:
;; C-c l a (elt-ask)
;; C-c l x (elt-chat)
;; C-c l t (elt-translate)
;; C-c l e (elt-explain)
After adding this code to your init.el
, you'll need to restart Emacs or evaluate the code for the changes to take effect.
C-c l c
- Check if provider is workingC-c l a
- Ask a questionC-c l x
- Start a chat session- Select text and
C-c l e
- Explain it - Select text and
C-c l r
- Rewrite it - Select text and
C-c l t
- Translate it
After adding this code to your init.el
, you'll need to restart Emacs or evaluate the code for the changes to take effect.
C-c l c
- Check if provider is workingC-c l a
- Ask a question- Select text and
C-c l e
- Explain it - Select text and
C-c l r
- Rewrite it - Select text and
C-c l t
- Translate it
C-c l g
- Generate code from descriptionC-c l G
- Generate code in specific languageC-c l f
- Generate function with nameC-c l C-c
- Generate class with name- Select code and
C-c l T
- Generate unit tests - Select code and
C-c l d
- Add comments/documentation - Select code and
C-c l o
- Optimize code
C-c l x
- Start an interactive chat session- In chat buffer:
C-c C-c
- Send messageC-c C-r
- Regenerate last responseC-c C-e
- Edit last user messageC-c C-y
- Copy last responseC-c C-h
- View full historyC-c C-x
- Export chat sessionC-c C-s
- Reset chat sessionC-c C-m
- Change LLM modelC-c C-t
- Toggle streamingC-c C-q
- Quit chatC-c ?
- Show help
C-c l h
- View response historyC-c l H
- Search response historyC-c l C-h
- Clear response historyC-c l E
- Export response history
The code includes proper error handling, customization options, and a minor mode with keybindings.
ELT provides powerful code generation capabilities to accelerate your development workflow:
- Natural Language to Code: Describe what you want and get working code
- Language-Specific Generation: Target specific programming languages
- Function Generation: Create functions with proper signatures and documentation
- Class Generation: Generate complete class structures with methods
- Test Generation: Automatically create unit tests for existing code
- Code Documentation: Add comprehensive comments and docstrings
- Code Optimization: Improve performance and readability of existing code
C-c l g
- Generate Code: Create code from natural language descriptionC-c l G
- Generate with Language: Specify target programming languageC-c l f
- Generate Function: Create a function with specific name and purposeC-c l C-c
- Generate Class: Create a class with methods and propertiesC-c l T
- Generate Tests: Create unit tests for selected code (select code first)C-c l d
- Add Documentation: Add comments and docstrings (select code first)C-c l o
- Optimize Code: Improve performance and style (select code first)
Generate a sorting function:
- Press
C-c l f
- Enter function name:
quicksort
- Describe: "implement quicksort algorithm for arrays"
Add tests to existing code:
- Select your function code
- Press
C-c l T
- Tests will be generated automatically
Optimize existing code:
- Select code block
- Press
C-c l o
- Get optimized version with explanations
- Be specific in your descriptions for better results
- Include expected input/output types when generating functions
- Use the language-specific generation for better syntax
- Review generated code before using in production
- Generated tests can serve as documentation examples
ELT automatically tracks all your AI interactions, allowing you to review, search, and reuse previous responses:
- Automatic tracking: All responses are saved with timestamps, prompts, and metadata
- History browser: View all previous interactions in a dedicated buffer
- Search functionality: Find specific responses by searching prompts or content
- Export capability: Save your history to a file for backup or sharing
- Persistence: Optionally save history between Emacs sessions
C-c l h
- Open history browserC-c l H
- Search history for specific contentC-c l C
- Clear all history (with confirmation)C-c l E
- Export history to a text file
In the history buffer, use these keys:
q
- Quit history buffern/p
- Navigate up/downs
- Search historyc
- Clear historye
- Export history-
6192
r
- Refresh history view
;; Maximum number of responses to keep (default: 50)
(setq elt-max-history-size 100)
;; Enable persistent history across sessions
(setq elt-save-history-to-file t)
;; Custom history file location
(setq elt-history-file "~/.emacs.d/my-elt-history.el")
This project is fully compatible with Kiro IDE, providing enhanced development capabilities:
- Project Context: Detailed project information and development guidelines
- API Guidelines: Best practices for API integrations (loaded when working with API code)
- Accessibility Guidelines: Available on-demand for UI/UX improvements
- Automated Testing: Hooks to check syntax and suggest improvements when saving files
- Feature Development: Spec templates for structured feature development
- AWS Documentation: Integration with AWS documentation tools via MCP
- Open the project in Kiro IDE
- Access project context with
#project-context
- Use
#accessibility
when working on UI improvements - Save
.el
files to trigger automated checks - Follow spec templates when developing new features
For more information about Kiro, visit Kiro Documentation.