I'm using Emacs 24.3.1 under Ubuntu 13.10

I need Emacs to open all new files in the the same window.

According to EmacsWiki: One Window, I added

(setq pop-up-windows nil)

To my configuration file, but it didn't work.

I tried how to make emacs open all buffers in one window (debian/linux/gnome)'s answer's suggestion:

(custom-set-variables '(pop-up-frames nil))

But it didn't work as well.

I tried emacs variable to “open with” in original frame's answer's suggestion:

(setq ns-pop-up-frames nil)

But it didn't work.

This should be something simple to configure, quite annoyhing..

Appreciate your help,



I think there was some kind of change in how this behaviour is customized around version 24.* (not quite sure). I think display-buffer-alist is the thing you are looking for.

So something along the lines of

(add-to-list 'display-buffer-alist
             '("^[^\\*].*[^\\*]$" display-buffer-same-window) t)

might work for you. The regexp is the one that a buffer name will be matched against (this one assumes file names don't start and end with asterisks).

See also the documentation for display-buffer, which decides where to display a buffer. There are several functions there along the lines of same-window, reuse-window, pop-up-{window,frame}.

By the way, ns-* functions are for OS X, they probably won't do anything on linux.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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