Skip to content

Window history records intermediate source buffer when using display-buffer-same-window from embark-collect #811

Description

@jamescherti

When executing an action from an *Embark Collect* buffer while forcing buffers to open in the same window, previous-buffer requires two presses to return to the collect buffer.

Steps to reproduce:

  • Configure display-buffer-alist to force buffers into the same window.
    (dolist (regexp '("\\*Embark Collect" "\\*Embark Export"))
      (push `(,regexp (display-buffer-same-window)) display-buffer-alist))
    
  • Open *Embark Collect* using consult-ripgrep and embark-collect for example.
  • Execute a default action (like opening a file or buffer) from the collect buffer.
  • Call previous-buffer in the newly opened target buffer.

Expected behavior: Calling previous-buffer once should return to the *Embark Collect* buffer.

Actual behavior: Calling previous-buffer once returns to the original source buffer (where the Embark command was initially invoked). Calling it a second time returns to the *Embark Collect* buffer.

This seems to happen because Embark temporarily switches to the source buffer to establish context before executing the action. Because display-buffer-alist forces the new buffer into the same window, Emacs records that intermediate source buffer in window-prev-buffers.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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