0

I'm using Emacs org-mode and when I run M-x org-agenda, the agenda dispatcher menu (the buffer named *Org Agenda Commands* where you select options like "a" for agenda, "t" for TODO list, etc.) opens in a split window.

I want this dispatcher menu to open in the current window instead of splitting.

What I've tried:

;; This controls the agenda view itself, not the dispatcher
(setq org-agenda-window-setup 'current-window)

;; Tried display-buffer-alist
(add-to-list 'display-buffer-alist
             '("\\*Org Agenda Commands\\*"
               (display-buffer-same-window)))

;; Tried advice
(defun my-org-agenda-same-window (orig-fun &rest args)
  "Force org-agenda dispatcher to use current window."
  (let ((display-buffer-overriding-action '(display-buffer-same-window)))
    (apply orig-fun args)))

(advice-add 'org-agenda :around #'my-org-agenda-same-window)

None of these prevent the dispatcher from splitting the window.

How can I make the org-agenda dispatcher open in the current window without splitting?

1 Answer 1

1

The name of the buffer is *Agenda Commands* - there is a space at the beginning; there is no Org. See the function org-agenda-get-restriction-and-command.

So try this:

(add-to-list 'display-buffer-alist '("^ \\*Agenda Commands\\*"
                                            (display-buffer-same-window)))

I've tested it and it works.

2
  • Thanks, yes, that works to keep it in the same window, but it seems it doesn't solve my entire problem. As it is now, it resizes temporarily the current window to fit its entire menu. I guess I have to open a new ticket on that one, unless you know how to prevent it from resizing;) Commented Nov 26 at 8:53
  • You mean the window is too small to contain the whole menu to begin with, and it is resized to contain the whole menu after M-x org-agenda? I cannot reproduce that, starting from emacs -Q, so I suspect it is caused by something in your init file. Try without (most of) your init file and see. Commented 2 days ago

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.