# How to capture in the existing window?

**URL:** <https://org-roam.discourse.group/t/how-to-capture-in-the-existing-window/3642>\
**Category:** Requests\
**Created:** [October 29, 2024, 9:11am UTC](https://org-roam.discourse.group/t/how-to-capture-in-the-existing-window/3642 "2024-10-29T09:11:58Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![window](https://avatars.discourse-cdn.com/v4/letter/w/8dc957/32.png) [@window](https://org-roam.discourse.group/u/window)\
**Post date:** [October 29, 2024, 9:11am UTC](https://org-roam.discourse.group/t/how-to-capture-in-the-existing-window/3642/1 "2024-10-29T09:11:58Z")

</div>

Hi,

I would like to do capturing within the window I currently have active.  
For example I often have a resource on one window and org-note on the other. Now when I do a new capture, org-roam-capture buffer will be opened on the window where the resource was. How I can change this behavior?

---

<div class="post-metadata">

**Author:** ![nobiot](https://yyz2.discourse-cdn.com/free1/user_avatar/org-roam.discourse.group/nobiot/32/159_2.png) [@nobiot](https://org-roam.discourse.group/u/nobiot)\
**Post date:** [October 29, 2024, 6:28pm UTC](https://org-roam.discourse.group/t/how-to-capture-in-the-existing-window/3642/2 "2024-10-29T18:28:26Z")

</div>

If you are **not** using Doom, try the code below. If you are using Doom, it uses its own (I think it’s a module called “popup” or something; I can’t remember).

For normal Emacs, with the change below, two things will happen:

1. The selection screen of the template (if you have more than one) will open below the currently selected one
2. The CAPTURE window will appear in the window you selected when you started the capture.

This way, I think your resource file won’t be covered over the CAPTURE window.

```emacs-lisp
(setopt
 display-buffer-alist
 (cons '("\\*Org Select\\*" (display-buffer-below-selected))
       display-buffer-alist))

(setopt
 display-buffer-alist
 (cons '("CAPTURE*" (display-buffer-same-window))
       display-buffer-alist))

```

Window management in Emacs can be a rabbit hole. I suggest you first read the docstring of user option `display-buffer-alist` (the one you are adding custom values to in the code above).

There are many different functions you can use instead of `display-buffer-below-selected` and `display-buffer-same-window`. The image below is from customizing screen for `display-buffer-alist`. Note the drop-down menu I am showing where you see many functions to choose from.

 ![image](https://global.discourse-cdn.com/free1/uploads/orgroam/original/2X/9/93c22028de6298eb813d30dacb14e523bebb41e1.png)

In addition, I believe the following two resources are two of the best I have seen on this topic.

1. [The Emacs Window Management Almanac | Karthinks](https://karthinks.com/software/emacs-window-management-almanac/)
2. [Emacs: control where buffers are displayed (the ‘display-buffer-alist’) | Protesilaos Stavrou](https://protesilaos.com/codelog/2024-02-08-emacs-window-rules-display-buffer-alist/)
