About emacsclient
A skill for coding agents working with an already-running Emacs server. It directs every Emacs operation through `emacsclient`, including file access, evaluation, compilation, checks, and tests.
Key features
- 01Route all operations through `emacsclient`
- 02Open files without waiting
- 03Evaluate Elisp expressions
- 04Compile and check Elisp files
- 05Run ERT tests
Use cases
- 01Open a file at a specified line
- 02Evaluate an Elisp expression
- 03Check parentheses or byte-compile a file
- 04Run matching ERT tests
Install
Copy the command and run it in a terminal.
$
npx skills add https:/ / github.com/ xenodium/ emacs-skills --skill emacsclientAfter installing, type/emacsclientin Claude Code to confirm it loaded.
Details
From the project READMEAlways use emacsclient
The user has an Emacs server running. All Emacs operations must go through emacsclient, never emacs or emacs --batch. This includes both user-requested actions and agent-initiated operations like byte compilation, syntax checking, or running tests.
Examples
- Open a file:
emacsclient --no-wait "/path/to/file" - Evaluate elisp:
emacsclient --eval '(some-function)' - Open at a line:
emacsclient --no-wait +42 "/path/to/file" - Byte compile a file:
emacsclient --eval ' (byte-compile-file "/path/to/file.el")' - Check parentheses:
emacsclient --eval ' (with-temp-buffer (insert-file-contents "/path/to/file.el") (check-parens))' - Run ERT tests:
emacsclient --eval ' (progn (load "/path/to/test-file.el" nil t) (ert-run-tests-batch-and-exit "pattern"))'
Rules
- Always use
emacsclient, neveremacsoremacs --batch. - Use
--no-waitwhen opening files so the command returns immediately. - Use
--evalwhen evaluating elisp. - Always format
--evalelisp across multiple lines with proper indentation. - Run
emacsclientcommands via the Bash tool.
Comments
Markdown supported