Emacs meets Claude: AI-supported software development with the editor veteran
The open source project Claude Code IDE for Emacs integrates the AI assistant into the text editor via MCP.
(Image: Besjunior/Shutterstock.com)
The Emacs text editor can now also support AI-based software development: Claude Code IDE for Emacs integrates Anthropics Claude Code CLI into the editor, which looks back on a history of over forty years.
The open-source project uses the Model Context Protocol (MCP) to integrate the AI model into Emacs. It offers bidirectional communication, which not only enables AI help to be called but also allows Claude Code CLI to actively trigger Emacs functions.
Insight into the context
Claude Code IDE for Emacs automatically recognizes the current project to offer appropriate functions and code analysis. Via the Language Server Protocol (LSP), it offers programming language-specific functions for navigating in the code.
(Image: Claude Code IDE for Emacs)
To analyze the syntax tree within the code, it relies on the Tree-Sitter parsing library, which Emacs has been integrating directly since 2023.
MCP as a control unit
The Model Context Protocol can be used to provide any Emacs functions for Claude Code CLI. This allows the AI assistant to execute any elisp functions (Emacs Lisp) or perform project-wide refactoring across multiple files.
The wizard uses the project.el file to recognize the active project. When working on multiple projects, each project receives its own instance of Claude Code, which is located in a special buffer (*claude-code[project-name]*).
(Image: Claude Code IDE for Emacs)
Claude Code IDE provides a set of Emacs commands to control the integration: Mx claude-code-ide starts the AI wizard for the active project. The command M-x claude-code-ide-menu calls up an interactive menu with all available functions.
Prompt for customized assistance
The command claude-code-ide-system-prompt provides Claude Code CLI with a prompt. The GitHub repository lists an example prompt with which the model prefers functional programming patterns and relies on immutability: “Focus on functional programming patterns and avoid mutations.”
Videos by heise
Claude Code for Emacs is available under the GPL 3.0 license. It requires Emacs version 28.1 or higher and one of the terminal packages vterm or eat. Claude Code CLI must also be available in the PATH.
Further details and the source code can be found in the project's GitHub repository. It currently only has 800 stars and six contributors, but who needs cursors and the like when Claude Code CLI helps you program with good old Emacs? An interesting bonus project would be the connection of Claude Code to ELIZA: The primitive chatbot developed in 1966 is part of Emacs' basic equipment.
(rme)