Skip to content

Fix Dired DWIM context fallback - #789

Open
rpoisel wants to merge 1 commit into
xenodium:mainfrom
Embedded-Focus:dev-fix-dired-context
Open

Fix Dired DWIM context fallback#789
rpoisel wants to merge 1 commit into
xenodium:mainfrom
Embedded-Focus:dev-fix-dired-context

Conversation

@rpoisel

@rpoisel rpoisel commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Dired's current-line fallback is useful for explicit file sending, but it should not count as obvious context when starting or reusing a shell.

Only use region-selected or explicitly marked Dired files for automatic file context, and skip current-line context in Dired so raw listing rows are not inserted into prompts.

Note: I am not really good at writing elisp code. This commit has been created with the assistance of an AI agent (OpenAI Codex). I do understand the code, but there might be better ways to improve the situation. It works for me - I am typically starting agent-shell sessions from dired buffers without selecting entries (files, directories, etc.).

Checklist

  • I agree to communicate (PR description and comments) with the author myself (not AI-generated).
  • I've reviewed all code in PR myself and will vouch for its quality.
  • I've read and followed the Contributing guidelines.
  • I've filed a feature request/discussion for a new feature the observed behavior: Dired DWIM context can insert prompt garbage into new agent sessions #788
  • I'm making visual changes, so I'm including screenshots so you can view and discuss.
  • I've added tests where applicable.
  • [] I've updated documentation where necessary.
  • I've run M-x checkdoc and M-x byte-compile-file.

Dired's current-line fallback is useful for explicit file sending, but
it should not count as automatic context when starting or reusing a shell.

Only use region-selected or explicitly marked Dired files for automatic
file context, and skip current-line context in Dired so raw listing rows
are not inserted into prompts.

Co-Authored-By: OpenAI Codex GPT-5 <noreply@openai.com>
Signed-off-by: Rainer Poisel <rainer@embedded-focus.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant