1

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.

  • 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 like M-x find-variable RET ibuffer-mode-map RET because I already investigated the name of the variable I am interested in. – lawlist Oct 28 '16 at 3:05
  • Yeah, I know about o, despite the name suggesting otherwise it opens a new window no matter what. Strongly dedicated? I use (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. – Jens Lange Oct 28 '16 at 4:06
  • Your other window that you want to target may be strongly dedicated -- you can check it out with 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 with emacs -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. – lawlist Oct 28 '16 at 4:23
  • As stated in my last comment the behaviour is also in vanilla emacs (meaning -q): o always opens a new window and return always uses it's own window. I need neither. Is every buffer by default a dedicated buffer? Would be the only explaination that it also happens in vanilla emacs. – Jens Lange Oct 28 '16 at 5:32
  • 1
    Neither emacs -Q nor emacs with my custom init.el shows the behaviour that that you mention. I open some files (find-file) then C-x 3 to get the windows configuration. I call ibuffer in any window. Select a buffer and hit o... emacs version is 25.1.50.1 – Matthias Oct 28 '16 at 8:49
0

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.

  • To 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. – Jens Lange Oct 28 '16 at 5:34
  • 1
    This 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)))) – glucas Nov 11 '16 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. – Jens Lange Oct 1 '17 at 10:23

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.