When I call org-edit-src-code to edit a SRC code on a buffer with the proper major mode, I get a new window configuration.

For example, if I have windows 1|2, org-edit-src-code will delete window 2 and split window 1 horizontally.

How can I have org-edit-src-code reuse the window from the org file and leave all other windows alone? In other words, I'd like org-edit-src-code to work as a narrowing command.

1 Answer 1


You can use the variable org-src-window-setup.

It seems that adding the following code to your config file would do what you want:

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

There are other options available, which you can list with M-x describe-variable org-src-window-setup

  • If you are using an emacs bundle (as in doom emacs) that comes bundled with a popup management library, the values in display-buffer-alist might get in your way. You can investigate the rules by doing a describe on display-buffer-alist variable and search for the buffer name.
    – anakha
    Commented Aug 19, 2022 at 15:04

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.