dired
Open files in Emacs dired
Open files from the most recent interaction in an Emacs dired buffer using emacsclient --eval. Only include files relevant to the latest interaction (files just generated, edited, listed, or produced by the most recent tool output), not all files mentioned throughout the conversation.
Strategy
Determine whether the relevant files all reside in the same directory or span multiple directories, then call agent-skill-dired accordingly.
- Same directory:
:diris the directory,:filesare basenames. Opens dired at that directory with the files marked in context. - Multiple directories:
:diris the common ancestor,:filesare relative paths. Creates a curated*agent-files*buffer with all files marked.
First, locate agent-skill-dired.el which lives alongside this skill file at skills/dired/agent-skill-dired.el in the emacs-skills plugin directory.
emacsclient --eval '
(progn
(load "/path/to/skills/dired/agent-skill-dired.el" nil t)
(agent-skill-dired
:dir "/path/to/directory"
:files (quote ("file1.txt"
"file2.txt"
"file3.txt"))))'
Rules
- Use relative paths in
:filesrelative to:dir. - Locate
agent-skill-dired.elrelative to this skill file's directory. - If no relevant files exist in the recent interaction, inform the user.
- Run the
emacsclient --evalcommand via the Bash tool.
More from xenodium/emacs-skills
emacsclient
Always use emacsclient instead of emacs. This applies to all Emacs operations: user requests, byte compilation, check-parens, running ERT tests, and any other elisp evaluation.
53describe
This skill should be used when the user invokes "/describe" to look up Emacs documentation via emacsclient.
36open
This skill should be used when the user invokes "/open" to open files from the latest interaction in Emacs buffers via emacsclient.
34select
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.
33highlight
This skill should be used when the user invokes "/highlight" to highlight relevant regions in one or more files in Emacs via emacsclient.
33file-links
When referencing files, format them as markdown links with line numbers using GitHub-style #L syntax.
31