0

Since an emacs upgrade I made a long time ago (or was it when I changed my laptop, or when I changed my Ubuntu release? I can't remember), emacs keeps opening new windows whenever I click into a file link in grep-mode (for example). Before, I had this behavior:

  • I have a window open (window 0)
  • I run a grep command
  • I get a new window, with the grep result (window 1)
  • I select any line in the grep result, and a new buffer is opened in window 0

Which is what I want: maximum two windows opened, and I get to see around 30 lines per window. Now, instead, I get:

  • I have a window open (window 0)
  • I run a grep command
  • I get a new window, with the grep result (window 1)
  • I select any line in the grep result, a new buffer is opened in a new window (window 3). The windows have 30, 15, and 15 lines.

So now I have 3 windows instead of 2, with too few lines. This happens again, until a maximum of 4 open windows. To keep my windows at a minimum height, I need to keep on manually closing windows, which is very annoying.

I guess this has to do with the minimum height of the window, and how many lines the frame has, but I am unable to find the exact settings.

How can I tell emacs to open at most 2 windows in the active frame?

  • 1
    Does this happen if you start Emacs without your init file (emacs -Q)? If not, show us the relevant parts of your init file. – Drew Aug 17 '15 at 15:48
  • To follow up on @Drew's comments, when I tried to reproduce this, I was finding that although a new window opened with the results (two windows total), upon clicking a result (or moving point and pressing enter), the existing window was reused. – zck Aug 17 '15 at 18:09
  • @Drew: with -Q the behavior is completely different: the grep command opens another vertical window, to the right of the existing one. Selecting one of the files in the grep window will open the selected file in the first buffer. This is more or less what I want, but instead of having a vertical window I want an horizontal one. – dangonfast Aug 17 '15 at 19:43
  • @zck: I have a very complex init file (split into lots of files), with lots of active modules (ido, etc). It would be easier for me to locate the problem if I knew which parameters are controlling these can of process, but I am unable to find the relevant documentation – dangonfast Aug 17 '15 at 19:45
  • 1
    Regardless of the complexity of your init file -- NO -- especially if you have a complex and large init file, binary search is your friend. Recursively bisect your init file to find the problem. Use comment-region to comment out 1/2, then 3/4, 7/8, 15/16, etc. of the file, until you locate the offending part. Very quick, even if it does not seem so at first. (And certainly better than asking people to guess what your problem might be.) – Drew Aug 17 '15 at 22:02

Your Answer

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

Browse other questions tagged or ask your own question.