How to open org-src buffers in the same window?

What happened?

I added to my config:

(setq! org-src-window-setup 'current-window)

(set-popup-rule! "^\\*Org Src"
  :actions '(display-buffer-same-window)
  :side nil
  :width nil
  :height nil
  :size nil
  :quit nil
  :select t
  :modeline t)

After this if I want to edit src block with "C-c ’ " it opens in the same window. But after I close it with “C-c C-c” my window configuration gets messed up. Window that used to contain org-src buffer gets dragged to the bottom of emacs frame.

What did you expect to happen?

It should act as I didn’t have popup.el and set org-src-window-setup to 'current-window. It shouldn’t rearrange my windows.

Steps to reproduce

  1. run attached code
  2. open 2 vertical windows, one containing org file with src block
  3. enter src block, press "C-c ’ " and than “C-c C-c” . Your windows are now horizontal.

System information

Loading data dump...

The canonical way to tell Doom’s popup manager not to handle a buffer is to use :ignore t (and to do so after the original rule is loaded. In this case, that means after org is loaded):

(after! org
  (set-popup-rule! "^\\*Org Src" :ignore t))

But that just leaves Org to its own devices, which may still choose to popup the buffer in a new window, so instead of the above, you only need to do:

(after! org
  (setq org-src-window-setup 'current-window))

See C-hvorg-src-window-setup for documentation.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.