emacsclient
Always 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.
More from xenodium/emacs-skills
describe
This skill should be used when the user invokes "/describe" to look up Emacs documentation via emacsclient.
34dired
This skill should be used when the user invokes "/dired" to open files from the latest interaction in an Emacs dired buffer via emacsclient.
33open
This skill should be used when the user invokes "/open" to open files from the latest interaction in Emacs buffers via emacsclient.
32select
This skill should be used when the user invokes "/select" to open one or more files in Emacs and select a region relevant to the current discussion via emacsclient.
31highlight
This skill should be used when the user invokes "/highlight" to highlight relevant regions in one or more files in Emacs via emacsclient.
31file-links
When referencing files, format them as markdown links with line numbers using GitHub-style #L syntax.
29