1

What statements in the init.el file can be added so that there is a single window shown as the default I have is split into 2 windows vertically aligned (equivalent to typing C-x 1)?

Then once there is only a single window showing, how to select the buffer for the window? Eg. open a shell in the buffer (M-x shell).

This question other similar question produces 3 windows vertically aligned.

closed as unclear what you're asking by Vass, Drew, JeanPierre, Dan Oct 16 '18 at 19:02

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • Start Emacs with emacs -Q (no init file), and you will see that there is no split window. Consider how you are starting it otherwise (e.g. passing it arguments). Other than that, bisect your init file to find the culprit. If you need the effect of C-x 1 at some point you can use (delete-other-windows) but you shouldn't be bothering to create extra windows that you need to delete. You are the master of your init file. Emacs just does what you tell it to do, starting with your init file. – Drew Oct 13 '18 at 23:31
  • @Drew, I put (delete-other-windows) into my init file, and it did not work, same split of the frame. Does it need to be placed in some particular order? How can I then prevent that initial redundant creation of windows I do not need? – Vass Oct 14 '18 at 3:27
  • 1
    Do you see the same problem when you start Emacs with emacs -Q? If not, then your init file is the problem. It doesn't matter whether you see any code affecting windows in it. Something you are doing in it invokes some code that does something affecting windows. Bisect your init file, recursively, till you locate the problem. We cannot guess what you are doing in your init file. It's your file - unless you see the same problem without it then you are causing the problem yourself, with your init file. – Drew Oct 14 '18 at 21:35
  • 1
    Bisect your init file by commenting out 1/2 of it, then 3/4 of it, then 7/8, 15/16,... – Drew Oct 15 '18 at 22:39
  • 1
    I'm voting to close this question as off-topic because OP wants to delete it. He solved his problem and doesn't think the Q&A will help others. – Drew Oct 16 '18 at 14:41
1

Regarding the comment: Nothing except something in your init.el can cause the effect you are having now (if you didn't start Emacs with additional command line arguments). So there must be something in your init.el that creates a new window.

Here is something I put together to (hopefully) find what causes the window splitting.

First, add an advice to split-window-right. The lambda will be called before split-window-right was called. The lambda will print out the backtrace frame

(advice-add 'split-window-right :before (lambda (&rest _) (print (backtrace-frames))))

Then to test it I defined a function that calls split-window-right.

(defun some-function () (split-window-right))

Calling it prints this:

((t backtrace-frames nil nil)
 (nil print
      ((backtrace-frames))
      nil)
 (t
  (lambda
    (&rest _)
    (print
     (backtrace-frames)))
  nil nil)
 (t apply
    ((lambda
       (&rest _)
       (print
        (backtrace-frames)))
     nil)
    nil)
 (t split-window-right nil nil)
 (t some-function nil nil)
 (t eval
    ((some-function)
     nil)
    nil)
 (t elisp--eval-last-sexp
    (t)
    nil)
 (t eval-last-sexp
    (t)
    nil)
 (t eval-print-last-sexp
    (nil)
    nil)
 (t funcall-interactively
    (eval-print-last-sexp nil)
    nil)
 (t call-interactively
    (eval-print-last-sexp nil nil)
    nil)
 (t command-execute
    (eval-print-last-sexp)
    nil))

You can find some-function is right before split-window-right.

This may solve your problem, may not. But I think it worth giving a try : )

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