简体   繁体   中英

How can I prevent emacs from opening a new window for a buffer I already have open in this session?

I typically have two emacs frames open at once.

When I run vc-diff a new window is created, regardless of whether a window is displaying that buffer already.

Is there a general way to prevent this occurring?

Setting pop-up-frames to a non-nil value will prevent pop-to-buffer from opening a new window. Instead the *vc-diff* buffer will become the active window in the frame that is displaying it.

(setq pop-up-frames t)

Changing this variable will affect other functions that use pop-to-buffer as well.

I think you need to customize display-buffer-base-action to display-buffer--other-frame-action by adding

(custom-set-variables
 '(display-buffer-base-action display-buffer--other-frame-action))

to your .emacs.el or maybe

(custom-set-variables
 '(display-buffer-base-action 
   '(display-buffer-reuse-window (reusable-frames . t))))

I suggest reading help on all variables ( Ch v ) and functions ( Ch f ) mentioned above.

Good luck!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM