I tried everything but again I'm hitting a wall here. I have one frame split in the middle with a vertical line giving me a window left and right. Now I have Ibuffer open in the left window and I just want to press a key and the selected buffer should open in the right window WITHOUT opening another window. Whatever I do I either get Ibuffer to open the selected buffer in it's own buffer (pressing Return for example) or getting it to open it new window or frame. It seems impossible for it to open it in the already opened window on the right. I'm not a coder so I can't help myself using some lisp.
1 Answer
This needs more investigation on negative side-effects, but setting display-buffer-base-action
to display-buffer-use-some-window
seem to work. Found hint to it on
https://www.reddit.com/r/emacs/comments/24zu2a/how_do_i_stop_emacs_from_taking_over_my_split/
Using the mentioned variable with the hook from glucas mentioned below seems to work and limits possible side effects to ibuffer. It's a workaround, but better than nothing.
-
1To whom who gave me -1, well first I would like an expaination why my post is not useful, since it does what I need, despite some possible negative side-effects and second do you have a better solution? I would be glad to hear about it. Commented Oct 28, 2016 at 5:34
-
1This works for me. For now I'm doing it locally for ibuffer using a hook:
(add-hook 'ibuffer-mode-hook (lambda () (setq-local display-buffer-base-action '(display-buffer-use-some-window))))
– glucasCommented Nov 11, 2016 at 15:31 -
Glucas, thanks for that hook. It works as expected. I hope this whole workaround is not needed anymore anytime soon but as of emacs 25.2.1 this problem still exists. Commented Oct 1, 2017 at 10:23
-
o
=visit-buffer-other-window
If that doesn't work, perhaps your other window/buffer is strongly dedicated? Instead of using what everyone likes to recommend -- e.g.,C-h m
to read the available commands for a given mode/buffer that has focus, I like to actually see the source code and find out the name of the variable and what it entails. So, I likeM-x find-variable RET ibuffer-mode-map RET
because I already investigated the name of the variable I am interested in.(setq split-height-threshold 5000)
but you can reproduce my problem even on a vanilla emacs. The only difference to my config is that o opens the new window for selected buffer elsewhere. Ibuffer should use the existing other window, not a new one by splitting and not itself.window-dedicated-p
: gnu.org/software/emacs/manual/html_node/elisp/… If it is strongly dedicated because something you are using set it that way, then a new window will likely be created and result in the behavior you wish to change. You may wish to try withemacs -q
and just open ibuffer with a second window and see if the behavior is the same. If it is dedicated, then you can turn it off -- see the link to the manual above.