Hello,

I noticed that org-agenda-goto (TAB in agenda buffers) recently
started occasionally reusing my selected window, which was unexpected.
I believe it also contradicts the Org Manual description of the
intended behavior.

I used an LLM to diagnose the issue, but the patch (which is just a
one-liner anyway) is hand-written.

Thanks,
Aaron

Emacs  : GNU Emacs 32.0.50 (build 1, x86_64-pc-linux-gnu, X toolkit, cairo 
version 1.18.4, Xaw scroll bars)
Package: Org mode version 9.8.12 (release_9.8.12 @ 
/home/azeng/src/emacs/primary/lisp/org/)

>From 75bdaa5b6c50ee0de2302022526bb51000a6a20c Mon Sep 17 00:00:00 2001
From: "Aaron L. Zeng" <[email protected]>
Date: Mon, 9 Nov 2026 17:52:11 +0000
Subject: [PATCH] org-agenda-goto: Avoid switching selected window

* lisp/org-agenda.el (org-agenda-goto): Ensure pop-to-buffer
does not reuse the selected window.
---
 lisp/org-agenda.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index f525fb019..cc66691a1 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -9283,7 +9283,8 @@ When called with a prefix argument, include all archive files as well."
     (pop-to-buffer
      buffer
      `((display-buffer-reuse-window display-buffer-pop-up-window)
-       (reuse-indirect . buffer)))
+       (reuse-indirect . buffer)
+       (inhibit-same-window . t)))
     (unless (<= (point-min) pos (point-max))
       (widen))
     (push-mark)
-- 
2.43.7

Reply via email to