Skip to content

Doom Emacs: agent-shell buffers disappear when quitting other buffers #259

@ElleNajt

Description

@ElleNajt

Problem

In Doom Emacs, agent-shell buffers get skipped by switch-to-prev-buffer when quitting other buffers (like org-agenda). After pressing q to quit the agenda, instead of returning to the agent-shell buffer, Emacs switches to a different buffer.

Cause

Doom Emacs filters "unreal" buffers from buffer switching via a frame buffer-predicate. Agent-shell buffers are considered "unreal" because they don't visit files (triggers doom-non-file-visiting-buffer-p).

Fix

Setting doom-real-buffer-p buffer-locally to t marks agent-shell buffers as first-class citizens:

(add-hook 'agent-shell-mode-hook
          (lambda ()
            (setq-local doom-real-buffer-p t)))

Question

Should this be added to agent-shell itself? Options:

  1. Add to agent-shell.el with a boundp check:

    (when (boundp 'doom-real-buffer-p)
      (setq-local doom-real-buffer-p t))
  2. Document in README as a recommended config for Doom users

  3. Add via mode hook in agent-shell.el:

    (add-hook 'agent-shell-mode-hook
              (lambda ()
                (when (boundp 'doom-real-buffer-p)
                  (setq-local doom-real-buffer-p t))))

I have a branch with option 1 ready if you'd prefer that approach.


Written by Claude

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions